Accept the issuer URL as a valid audience#865
Merged
lepture merged 2 commits intoauthlib:mainfrom Mar 16, 2026
Merged
Conversation
6c275e9 to
fcd8cf6
Compare
fcd8cf6 to
4c39b24
Compare
lepture
reviewed
Mar 1, 2026
| # token endpoint URL and the AS issuer identifier are valid audiences. | ||
| aud_values = [self.token_url] | ||
| if self.issuer: | ||
| aud_values.append(self.issuer) |
Member
There was a problem hiding this comment.
How about we define a get_audiences method instead of adding a issuer parameter?
There was a problem hiding this comment.
This would also allow the server to disallow the token endpoint as an audience.
Member
Author
There was a problem hiding this comment.
I implemented get_audiences and added deprecation warnings so the get_audiences methods must be implemented for Authlib 1.8.
Per RFC 7523 Section 3 and draft-ietf-oauth-rfc7523bis, the AS issuer identifier should be a valid audience value alongside the token endpoint URL.
lepture
approved these changes
Mar 16, 2026
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.
What kind of change does this PR introduce?
Per RFC 7523 Section 3 and draft-ietf-oauth-rfc7523bis, the AS issuer identifier should be a valid audience value alongside the token endpoint URL.
JWTBearerGrant was not checking the audience value at all. A
get_audiencesmethod is introduced to let developers indicate the valid audiences. I guess someday when #260 is implemented, we could guess the token urls and issuer and build this dynamically.JWTBearerClientAssertion was checking that the audience value was the token url, but now it also accepts the issuer.
Does this PR introduce a breaking change?
No
Checklist
prek.pragma: no cover