mirror of
https://github.com/davidkaya/aryx.git
synced 2026-08-29 14:07:13 +02:00
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>
This commit is contained in:
@@ -160,7 +160,11 @@ async function discoverAuthorizationServer(serverUrl: string): Promise<string> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function fetchAuthServerMetadata(authServerUrl: string): Promise<AuthServerMetadata> {
|
async function fetchAuthServerMetadata(authServerUrl: string): Promise<AuthServerMetadata> {
|
||||||
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) {
|
if (!metadata) {
|
||||||
throw new Error('Authorization Server Metadata fetch failed: no well-known endpoint found');
|
throw new Error('Authorization Server Metadata fetch failed: no well-known endpoint found');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user