auth: improve ClientAuthenticator error messaging#2709
Open
haoxuw wants to merge 2 commits into
Open
Conversation
haoxuw
commented
May 28, 2026
|
|
||
| elif client.token_endpoint_auth_method == "none": | ||
| if client.client_secret: | ||
| raise AuthenticationError("Require valid auth method, with client secret") |
Author
There was a problem hiding this comment.
Even with out this if client.client_secret check, the current logic would still gives AuthenticationError, at L105
No behavior changes
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.
Summary
Aligns the ClientAuthenticator with RFC 6749 and RFC 7591 by explicitly preventing confidential clients from bypassing authentication using token_endpoint_auth_method="none".
Note: NO changes to the current behavior, only change error message and code maintainability
Closes #1842
Spec Definition:
The authenticator now explicitly rejects requests where a client has a registered secret but attempts to use token_endpoint_auth_method="none". This prevents credential
downgrade attacks and clarifies configuration errors.
Changes
Verification
Validated via tests/server/mcpserver/auth/test_auth_integration.py: