Repository navigation
fix: remove default-audience cache entry when MRRT refresh is missing scopes - #1804
Merged
yogeshchoudhary147 merged 1 commit intoOct 21, 2026
Conversation
yogeshchoudhary147
approved these changes
Oct 20, 2026
yogeshchoudhary147
left a comment
Contributor
There was a problem hiding this comment.
Thanks @RaphaelFakhri ! Tested this locally and it fixes the issue, the partial-scope token doesn't stay in the cache anymore. LGTM 👍
Contributor
|
@RaphaelFakhri could you please sign your commit? Thanks! |
RaphaelFakhri
force-pushed
the
fix/mrrt-missing-scopes-default-audience
branch
from
October 21, 2026 12:18
35c0dde to
ef27bd7
Compare
Contributor
Author
|
@yogeshchoudhary147 The commit is signed now and shows as Verified. The code is unchanged. |
yogeshchoudhary147
added a commit
that referenced
this pull request
Oct 21, 2026
**Added** - feat(passkey): add identifier verification with step-up pattern [\#1802](#1802) ([yogeshchoudhary147](https://github.com/yogeshchoudhary147)) **Fixed** - fix: remove default-audience cache entry when MRRT refresh is missing scopes [\#1804](#1804) ([RaphaelFakhri](https://github.com/RaphaelFakhri))
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
When
useMrrtis enabled and a refresh returns fewer scopes than requested,_getTokenUsingRefreshTokenremoves the entry that_requestTokenjust cached, then throwsMissingScopesError. The entry is saved underoptions.audience || DEFAULT_AUDIENCE, but the removal usedoptions.authorizationParams.audienceas is. When no audience is configured or passed, the removal targets a key without an audience segment, so the partial-scope token stays in the cache.As a result, the first
getTokenSilently()call throwsMissingScopesError, and the next call with the same scopes returns the cached token that is missing those scopes, without an error.This change passes
DEFAULT_AUDIENCEas the fallback audience tocacheManager.remove, matching the key used when the entry is saved.src/Auth0Client.ts:_getTokenUsingRefreshTokenfalls back toDEFAULT_AUDIENCEwhen removing the entry before throwingMissingScopesError.References
Testing
Added a unit test in
__tests__/Auth0Client/getTokenSilently.test.ts. It logs in withuseRefreshTokens,useMrrtand no audience, requests an extra scope that the refresh response omits, expectsMissingScopesError, then checks that acacheMode: 'cache-only'call returnsundefined. Without the fix, thecache-onlycall returns the partial-scope access token.Checklist
Fixes #1803
Summary by CodeRabbit