Repository navigation
feat: add caching for Token Vault connection token exchanges - #139
Merged
Merged
Conversation
kishore7snehil
marked this pull request as ready for review
October 6, 2026 06:55
kishore7snehil
force-pushed
the
feat/token-vault-caching
branch
from
October 7, 2026 14:54
64a62ec to
bdbcef3
Compare
kishore7snehil
changed the base branch from
feat/obo-token-storage
to
feat/m2m-client-credentials
October 7, 2026 14:54
nandan-bhat
reviewed
Oct 7, 2026
kishore7snehil
force-pushed
the
feat/token-vault-caching
branch
from
October 8, 2026 04:07
bdbcef3 to
2abdc32
Compare
kishore7snehil
force-pushed
the
feat/m2m-client-credentials
branch
2 times, most recently
from
October 8, 2026 04:22
6576276 to
a9668aa
Compare
kishore7snehil
force-pushed
the
feat/token-vault-caching
branch
from
October 8, 2026 04:22
2abdc32 to
eee148a
Compare
kishore7snehil
force-pushed
the
feat/m2m-client-credentials
branch
from
October 12, 2026 09:59
a9668aa to
0d427d9
Compare
kishore7snehil
force-pushed
the
feat/token-vault-caching
branch
2 times, most recently
from
October 13, 2026 10:11
b8c3920 to
d75882f
Compare
nandan-bhat
previously approved these changes
Oct 22, 2026
kishore7snehil
force-pushed
the
feat/m2m-client-credentials
branch
from
October 22, 2026 06:41
398a6bf to
9349c8f
Compare
kishore7snehil
force-pushed
the
feat/token-vault-caching
branch
from
October 22, 2026 06:41
a941898 to
e25abee
Compare
- Return scope on every cache hit so it matches a fresh result - Include login_hint in the cache key - Skip the cache for a non-string sub and treat wrongly typed stored entries as a miss - Document the organization errors and fix the VerifiedToken usage in the examples
kishore7snehil
force-pushed
the
feat/m2m-client-credentials
branch
from
October 22, 2026 06:52
9349c8f to
75290da
Compare
kishore7snehil
force-pushed
the
feat/token-vault-caching
branch
from
October 22, 2026 06:52
e25abee to
e32b157
Compare
kishore7snehil
dismissed
nandan-bhat’s stale review
October 22, 2026 07:19
The base branch was changed.
nandan-bhat
approved these changes
Oct 22, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📋 Changes
This PR extends the token store added in the previous PR to also cache Token Vault exchanges. When a token store is configured,
get_access_token_for_connection()reuses a previously exchanged connection token instead of hitting the token endpoint on every call.✨ Features
get_access_token_for_connection()caches exchanged tokens whentoken_storeis set. Entries are keyed by tenant, client, callersuband connection, so one caller or connection never gets another's token.sub: If the verified token has no usablesubclaim, the cache is skipped with a warning.🔧 API Changes
verified(VerifiedToken, defaultNone) toget_access_token_for_connection(). Callers that have already verified the token (for example an MCP server) can pass it to avoid a second verification. When omitted and a token store is configured, the token is verified before any cache lookup.get_access_token_for_connection()now raisesVerifyAccessTokenErrorwhen a store is configured and the token fails verification, or whenverifieddoes not match the access token being exchanged.expires_inalongsideaccess_token,expires_atandscope.📖 Documentation
EXAMPLES.mdwith a Token Vault section covering a basic call and cachingREADME.mdanddocs/TokenStorage.mdto mention Token Vault caching🧪 Testing
Contributor Checklist