feat(auth): support resource indicators in auth flow #498
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.
Support Resource Indicators in OAuth Flow
Motivation and Context
This PR adds support for Resource Indicators as specified in RFC 8707, which allows OAuth clients to specify the target resource for access tokens. Many modern OAuth servers (like Auth0 and Logto) implement this specification to enable more granular access control and token audience restrictions.
While RFC 8707 supports specifying multiple resources during authorization and selecting specific resources during token exchange, this implementation intentionally handles only a single resource per authorization session. This design decision aligns with our current auth flow architecture where:
How Has This Been Tested?
auth.test.ts
verifying:Breaking Changes
No breaking changes. The resource support is implemented as an optional feature through:
resource()
method inOAuthClientProvider
interfaceresource
parameter in auth flow functionsTypes of changes
Checklist
Additional context
The implementation follows RFC 8707 specifications while maintaining simplicity in the auth flow. The resource parameter is consistently propagated through all relevant auth operations:
This ensures that tokens are always bound to their intended resources throughout the entire authorization lifecycle.