From 4f7b479996c1b33f00f1de4403a8108c6ff56391 Mon Sep 17 00:00:00 2001 From: David Kaya Date: Fri, 27 Mar 2026 20:06:02 +0100 Subject: [PATCH] fix: fall back to openid-configuration for auth server metadata discovery Microsoft Entra ID and other OIDC providers expose metadata at .well-known/openid-configuration rather than RFC 8414's .well-known/oauth-authorization-server. Now tries both suffixes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/main/services/mcpOAuthService.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/services/mcpOAuthService.ts b/src/main/services/mcpOAuthService.ts index 5d5076a..1f07860 100644 --- a/src/main/services/mcpOAuthService.ts +++ b/src/main/services/mcpOAuthService.ts @@ -160,7 +160,11 @@ async function discoverAuthorizationServer(serverUrl: string): Promise { } async function fetchAuthServerMetadata(authServerUrl: string): Promise { - const metadata = await fetchWellKnownMetadata(authServerUrl, 'oauth-authorization-server'); + // RFC 8414 suffix first, then OpenID Connect Discovery suffix (used by Entra ID, Google, etc.) + const metadata = + (await fetchWellKnownMetadata(authServerUrl, 'oauth-authorization-server')) ?? + (await fetchWellKnownMetadata(authServerUrl, 'openid-configuration')); + if (!metadata) { throw new Error('Authorization Server Metadata fetch failed: no well-known endpoint found'); }