Skip to content

feature: Added configurable token endpoint auth method selection#1496

Open
RobotechUSA wants to merge 2 commits intomodelcontextprotocol:mainfrom
toolsgroup:feature/oauth-token-endpoint-auth-selector
Open

feature: Added configurable token endpoint auth method selection#1496
RobotechUSA wants to merge 2 commits intomodelcontextprotocol:mainfrom
toolsgroup:feature/oauth-token-endpoint-auth-selector

Conversation

@RobotechUSA
Copy link
Copy Markdown

Summary

The OAuth client currently selects the first token endpoint authentication method advertised by the authorization server. That can fail when a server exposes multiple supported methods and the client needs to prefer a specific method based on client type or available credentials.

This change adds TokenEndpointAuthMethodSelector to ClientOAuthOptions and uses it in ClientOAuthProvider when resolving the token endpoint authentication method. Existing behavior is preserved by defaulting to the first advertised method when no selector is provided.

Motivation and Context

Some authorization servers advertise multiple token endpoint authentication methods. In those cases, always choosing the first advertised method is not flexible enough for clients that need to prefer a different supported method.

This change allows callers to control that selection without changing the default behavior for existing consumers.

How Has This Been Tested?

Validated in a downstream application that requires selecting a specific token endpoint authentication method.

Breaking Changes

This is a non-breaking change. Existing behavior is preserved when TokenEndpointAuthMethodSelector is not configured.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

N/A

RobotechUSA and others added 2 commits April 2, 2026 10:40
The OAuth client currently selects the first token endpoint authentication
method advertised by the authorization server. That can fail when servers
expose multiple supported methods and the caller needs to prefer a different
option based on client type or credentials.

Added TokenEndpointAuthMethodSelector to ClientOAuthOptions and use it in
ClientOAuthProvider when resolving the token endpoint auth method. Preserve
the existing behavior by defaulting to the first advertised method when no
selector is provided.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant