Fix client secret post for client credentials auth#2140
Open
Noravee wants to merge 3 commits intomodelcontextprotocol:v1.xfrom
Open
Fix client secret post for client credentials auth#2140Noravee wants to merge 3 commits intomodelcontextprotocol:v1.xfrom
Noravee wants to merge 3 commits intomodelcontextprotocol:v1.xfrom
Conversation
- initialize provider in test_exchange_token_client_credentials and test_exchange_token_without_scopes unittests
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.
Fixes #2128
Summary
Adds missing
client_idparameter to token request body forclient_secret_postauthentication method inClientCredentialsOAuthProvider.Motivation and Context
When using
token_endpoint_auth_method="client_secret_post"with theClientCredentialsOAuthProvider, the token exchange request was missing the requiredclient_idparameter in the request body, causing authentication to fail.Per RFC 6749 Section 2.3.1, the
client_secret_postmethod requires bothclient_idandclient_secretto be included in the request body. Previously, onlyclient_secretwas being added byprepare_token_auth(), whileclient_idwas never included.This bug completely prevented
client_secret_postauthentication from working, as OAuth servers would reject requests without the client identifier.Changes Made
client_idto the initialtoken_datadictionary in_exchange_token_client_credentials()client_infoandclient_idare available before building the request_initialize()before authorizationHow Has This Been Tested?
client_secret_basicandclient_secret_postauthentication methodsBreaking Changes
None. This is a pure bug fix that adds a required parameter that should have been present. No API changes.
Types of changes
Checklist
Additional context
The
client_idis now included in all token requests, which is:client_secret_post(fixing the bug)client_secret_basic(already in Authorization header)This ensures compliance with OAuth 2.0 RFC 6749 and enables
client_secret_postto work correctly.