Skip to content

Commit 2ce233e

Browse files
committed
Set a preferred auth method on the client registration
1 parent 9f6e731 commit 2ce233e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

client/src/lib/oauth-state-machine.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,16 @@ export const oauthTransitions: Record<OAuthStep, StateTransition> = {
8888
clientMetadata.scope = scopesSupported.join(" ");
8989
}
9090

91+
// Select a preferred auth method
92+
const authMethodsSupported =
93+
metadata.token_endpoint_auth_methods_supported;
94+
for (const authMethod of ["client_secret_basic", "client_secret_post"]) {
95+
if (authMethodsSupported && authMethodsSupported.includes(authMethod)) {
96+
clientMetadata.token_endpoint_auth_method = authMethod;
97+
break;
98+
}
99+
}
100+
91101
const fullInformation = await registerClient(context.serverUrl, {
92102
metadata,
93103
clientMetadata,

0 commit comments

Comments
 (0)