Retain URL search parameter

This commit is contained in:
Henry Mao 2025-07-07 03:56:42 +08:00 • committed by GitHub
commit 7b02c5cda3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -263,6 +263,7 @@ export async function discoverOAuthProtectedResourceMetadata(
} else {
const issuer = new URL(serverUrl);
const wellKnownPath = buildWellKnownPath('oauth-protected-resource', issuer.pathname);
wellKnownPath.search = issuer.search;
url = new URL(wellKnownPath, issuer);
}
@ -365,6 +366,7 @@ export async function discoverOAuthMetadata(
// Try path-aware discovery first (RFC 8414 compliant)
const wellKnownPath = buildWellKnownPath('oauth-authorization-server', issuer.pathname);
const pathAwareUrl = new URL(wellKnownPath, issuer);
pathAwareUrl.search = issuer.search;
let response = await tryMetadataDiscovery(pathAwareUrl, protocolVersion);
// If path-aware discovery fails with 404, try fallback to root discovery