Skip to content

Commit f3584f2

Browse files
fix: use authorization_server_url as issuer when fetching metadata (#763)
1 parent 4b2ad03 commit f3584f2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/client/auth.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1778,7 +1778,7 @@ describe("OAuth Authorization", () => {
17781778
status: 200,
17791779
json: async () => ({
17801780
resource: "https://my.resource.com/",
1781-
authorization_servers: ["https://auth.example.com/"],
1781+
authorization_servers: ["https://auth.example.com/oauth"],
17821782
}),
17831783
});
17841784
} else if (urlString === "https://auth.example.com/.well-known/oauth-authorization-server/path/name") {
@@ -1821,8 +1821,8 @@ describe("OAuth Authorization", () => {
18211821
// First call should be to PRM
18221822
expect(calls[0][0].toString()).toBe("https://my.resource.com/.well-known/oauth-protected-resource/path/name");
18231823

1824-
// Second call should be to AS metadata with the path from serverUrl
1825-
expect(calls[1][0].toString()).toBe("https://auth.example.com/.well-known/oauth-authorization-server/path/name");
1824+
// Second call should be to AS metadata with the path from authorization server
1825+
expect(calls[1][0].toString()).toBe("https://auth.example.com/.well-known/oauth-authorization-server/oauth");
18261826
});
18271827
});
18281828

src/client/auth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ export async function discoverOAuthMetadata(
606606
protocolVersion ??= LATEST_PROTOCOL_VERSION;
607607

608608
const response = await discoverMetadataWithFallback(
609-
issuer,
609+
authorizationServerUrl,
610610
'oauth-authorization-server',
611611
{
612612
protocolVersion,

0 commit comments

Comments
 (0)