Skip to content

Commit e53feed

Browse files
fix: use authorization_server_url as issuer when fetching metadata
1 parent c6ac083 commit e53feed

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
@@ -1759,7 +1759,7 @@ describe("OAuth Authorization", () => {
17591759
status: 200,
17601760
json: async () => ({
17611761
resource: "https://my.resource.com/",
1762-
authorization_servers: ["https://auth.example.com/"],
1762+
authorization_servers: ["https://auth.example.com/oauth"],
17631763
}),
17641764
});
17651765
} else if (urlString === "https://auth.example.com/.well-known/oauth-authorization-server/path/name") {
@@ -1802,8 +1802,8 @@ describe("OAuth Authorization", () => {
18021802
// First call should be to PRM
18031803
expect(calls[0][0].toString()).toBe("https://my.resource.com/.well-known/oauth-protected-resource/path/name");
18041804

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

src/client/auth.ts

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

527527
const response = await discoverMetadataWithFallback(
528-
issuer,
528+
authorizationServerUrl,
529529
'oauth-authorization-server',
530530
{
531531
protocolVersion,

0 commit comments

Comments
 (0)