diff --git a/client/src/lib/oauth-state-machine.ts b/client/src/lib/oauth-state-machine.ts index d87b3ecd..f2ab249a 100644 --- a/client/src/lib/oauth-state-machine.ts +++ b/client/src/lib/oauth-state-machine.ts @@ -88,6 +88,16 @@ export const oauthTransitions: Record = { clientMetadata.scope = scopesSupported.join(" "); } + // Select a preferred auth method + const authMethodsSupported = + metadata.token_endpoint_auth_methods_supported; + for (const authMethod of ["client_secret_basic", "client_secret_post"]) { + if (authMethodsSupported && authMethodsSupported.includes(authMethod)) { + clientMetadata.token_endpoint_auth_method = authMethod; + break; + } + } + const fullInformation = await registerClient(context.serverUrl, { metadata, clientMetadata,