{{ message }}
Fix OAuth2 resource parameter compliance with RFC 8707#261815
Merged
TylerLeonhardt merged 2 commits intomicrosoft:mainfrom Aug 28, 2025
Merged
Fix OAuth2 resource parameter compliance with RFC 8707#261815TylerLeonhardt merged 2 commits intomicrosoft:mainfrom
TylerLeonhardt merged 2 commits intomicrosoft:mainfrom
Conversation
Include resource parameter in token exchange requests for OAuth2 flow to comply with RFC 8707. The resource indicator was previously only included in the authorization request but missing from both the authorization code and refresh token exchange requests. This fix ensures that when a resource is specified in the metadata, it is consistently included in all OAuth2 requests: - Authorization request (already implemented) - Authorization code for token exchange (now fixed) - Refresh token exchange (now fixed) Fixes microsoft#261364
TylerLeonhardt
approved these changes
Aug 28, 2025
Member
TylerLeonhardt
left a comment
There was a problem hiding this comment.
This LGTM. We also need to do this here https://github.com/bluedog13/vscode/blob/80c2dec96d860b41e7001a86b93203dafe9eeedb/src/vs/workbench/api/node/extHostAuthentication.ts#L250-L258
but that can be a separate PR since it would be an addition
Tyriar
approved these changes
Aug 28, 2025
auto-merge was automatically disabled
August 28, 2025 21:05
Pull request was closed
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.

Summary
This PR fixes VS Code's OAuth2 flow to comply with RFC 8707 by including the resource parameter in token exchange requests.
Problem
The current implementation includes the resource indicator in the authorization request but omits it from both the authorization code and refresh token exchange requests. This violates RFC 8707 and can cause token validation failures on protected resources that require the resource parameter to be consistently present throughout the OAuth2 flow.
Solution
Added the resource parameter to both token exchange methods in the
DynamicAuthProviderclass:exchangeCodeForToken()- now includes resource parameter when exchanging authorization code for tokensexchangeRefreshTokenForToken()- now includes resource parameter when refreshing tokensThe fix ensures that when
_resourceMetadata?.resourceis available, it is consistently included in all OAuth2 requests throughout the authentication flow.Test Plan
Fixes #261364