Add client_secret_basic and none authentication methods #552
+383
−25
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.
Add support for
client_secret_basic
andnone
OAuth client authentication methods to complement the existing client_secret_post method.Motivation and Context
Currently, the TypeScript SDK only supports
client_secret_post
authentication method for OAuth token exchanges. However, OAuth 2.1 specification defines multiple client authentication methods, and many authorization servers prefer or requireclient_secret_basic
(HTTP Basic authentication) for better security practices.This change adds built-in support for:
client_secret_basic
: HTTP Basic authentication (RFC 6749 Section 2.3.1)none
: Public client authentication (RFC 6749 Section 2.1)The implementation automatically selects the best authentication method based on server capabilities and client credentials, following OAuth 2.1 best practices.
How Has This Been Tested?
client_secret_basic
authentication in bothexchangeAuthorization
andrefreshAuthorization
client_secret_post
authentication (existing behavior)none
authentication for public clientsBreaking Changes
No breaking changes. This is fully backward compatible:
client_secret_post
continues to work unchangedTypes of changes
Checklist
Additional context
Design Philosophy: Built-in vs External Implementation
This PR takes a different approach from PR #531, which delegates authentication to external providers via an
authToTokenEndpoint
callback.While that approach offers maximum flexibility,
But I believe that standard OAuth authentication methods should be built into the SDK for the following reasons:
client_secret_basic
andnone
are well-defined in RFC 6749 and don't require custom implementationThe external delegation approach in PR #531 is better suited for advanced/custom authentication methods like
private_key_jwt
that require specialized cryptographic operations and key management.