Allow OAuth client provider to implement token endpoint authentication methods #531
+136
−16
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.
Adds an optional
authToTokenEndpoint
function to theOAuthClientProvider
interface. This allows client providers implement other token endpoint authentication methods such asprivate_key_jwt
that are more secure thanclient_secret_post
andnone
, which are implemented by default currently.Motivation and Context
Allows implementation of other methods for authenticating to the token endpoint.
How Has This Been Tested?
This is being tested in a real agent that I'm currently developing, which is using key pairs for authentication.
Breaking Changes
This adds a required
provider
parameter toexchangeAuthorization
andrefreshAuthorization
which are exported from@modelcontextprotocol/sdk/client/auth
. In that sense it is a breaking change. However, these functions seem to be used only internally to this package, which limits the impact.Types of changes
NOTE: This could be considered breaking, per description above, but it seems low probability at this point.
Checklist