Set audience on DCR clients for refresh token support - #3796
Merged
Conversation
DCR-registered clients had no Audience field set on the fosite DefaultClient. During refresh token requests with resource= (RFC 8707), Fosite validates the original session's granted audience against the client's registered audience whitelist. With an empty whitelist, all refresh token requests failed with "has not been whitelisted". Pass AllowedAudiences from the server config to registration.New() so DCR clients inherit the server's allowed audiences. Fixes: #3777
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3796 +/- ##
==========================================
- Coverage 66.78% 66.77% -0.01%
==========================================
Files 437 437
Lines 43002 43007 +5
==========================================
Hits 28718 28718
- Misses 12078 12085 +7
+ Partials 2206 2204 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
tgrunnagle
approved these changes
Feb 12, 2026
This was referenced Sep 2, 2026
alex-feel
added a commit
to alex-feel/toolhive
that referenced
this pull request
Sep 3, 2026
CIMD-resolved clients were built with an empty audience list, so fosite's DefaultAudienceMatchingStrategy rejected every refresh_token grant with "has not been whitelisted by the OAuth 2.0 Client". The authorization_code grant was unaffected because that path never validates audience, so the failure only surfaced on refresh, roughly an access-token lifetime after the first sign-in. CIMDDecoratorConfig now carries AllowedAudiences, threaded from the server's own AllowedAudiences at construction, and buildFositeClient grants that list to every resolved client, mirroring how DCR clients already inherit the server's AllowedAudiences (stacklok#3796). Fixes: stacklok#6489
blkt
pushed a commit
that referenced
this pull request
Sep 3, 2026
CIMD-resolved clients were built with an empty audience list, so fosite's DefaultAudienceMatchingStrategy rejected every refresh_token grant with "has not been whitelisted by the OAuth 2.0 Client". The authorization_code grant was unaffected because that path never validates audience, so the failure only surfaced on refresh, roughly an access-token lifetime after the first sign-in. CIMDDecoratorConfig now carries AllowedAudiences, threaded from the server's own AllowedAudiences at construction, and buildFositeClient grants that list to every resolved client, mirroring how DCR clients already inherit the server's AllowedAudiences (#3796). Fixes: #6489
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.
DCR-registered clients had no Audience field set on the fosite DefaultClient. During refresh token requests with resource= (RFC 8707), Fosite validates the original session's granted audience against the client's registered audience whitelist. With an empty whitelist, all refresh token requests failed with "has not been whitelisted".
Pass AllowedAudiences from the server config to registration.New() so DCR clients inherit the server's allowed audiences.
Fixes: #3777