fix(auth): unify refresh checks and error handling - #1236
Open
DaleSeo wants to merge 2 commits into
Open
Conversation
DaleSeo
force-pushed
the
fix/auth-refresh-guard
branch
from
September 2, 2026 03:44
dbaa814 to
4e1b16a
Compare
DaleSeo
force-pushed
the
fix/auth-refresh-guard
branch
from
September 2, 2026 04:07
4e1b16a to
4cf38f7
Compare
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.
Motivation and Context
PR #1232 added
CredentialStore::acquire_refresh_guard. Three refresh behaviors ended up depending on whether a store returns a guard.call_reacting_to_challengesonly propagatesCredentialStoreErrorand converts every other refresh error intoAuthRequired.The presence of a guard tells us whether a store can coordinate. It does not tell us whether its contents are trustworthy. For example, a store might return
Ok(None)in single-process mode because it does not need a lock. In that case, we would silently skip the client ID check. The trait docs also describe this hook as coordination only, so implementors have no reason to know that validation depends on it.This PR makes the following changes:
resolve_granted_scopeshelper. This follows the same SEP-2350 and RFC 6749 section 5.1 rule already used by the authorization-code path. Thecurrent_scopesfallback is used only when no scopes were recorded.AuthorizationRequiredto the challenge incall_reacting_to_challengesand propagates every other error. This removes the special handling forCredentialStoreError.How Has This Been Tested?
Added regression tests
Breaking Changes
None
Types of changes
Checklist