Skip to content

Commit 64131a2

Browse files
committed
make authserver url make more sense
1 parent a004e6d commit 64131a2

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

client/src/components/__tests__/AuthDebugger.test.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ describe("AuthDebugger", () => {
203203

204204
// Should first discover and save OAuth metadata
205205
expect(mockDiscoverOAuthMetadata).toHaveBeenCalledWith(
206-
new URL("https://example.com/mcp"),
206+
new URL("https://example.com/"),
207207
);
208208

209209
// Check that updateAuthState was called with the right info message
@@ -361,7 +361,7 @@ describe("AuthDebugger", () => {
361361
});
362362

363363
expect(mockDiscoverOAuthMetadata).toHaveBeenCalledWith(
364-
new URL("https://example.com/mcp"),
364+
new URL("https://example.com/"),
365365
);
366366
});
367367

@@ -594,15 +594,15 @@ describe("AuthDebugger", () => {
594594
expect.objectContaining({
595595
resourceMetadataError: mockError,
596596
// Should use the original server URL as fallback
597-
authServerUrl: new URL("https://example.com/mcp"),
597+
authServerUrl: new URL("https://example.com/"),
598598
oauthStep: "client_registration",
599599
}),
600600
);
601601
});
602602

603603
// Verify that regular OAuth metadata discovery was still called
604604
expect(mockDiscoverOAuthMetadata).toHaveBeenCalledWith(
605-
new URL("https://example.com/mcp"),
605+
new URL("https://example.com/"),
606606
);
607607
});
608608
});

client/src/lib/oauth-state-machine.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ export const oauthTransitions: Record<OAuthStep, StateTransition> = {
2929
metadata_discovery: {
3030
canTransition: async () => true,
3131
execute: async (context) => {
32-
let authServerUrl = new URL(context.serverUrl);
32+
// Default to discovering from the server's URL
33+
let authServerUrl = new URL("/", context.serverUrl);
3334
let resourceMetadata: OAuthProtectedResourceMetadata | null = null;
3435
let resourceMetadataError: Error | null = null;
3536
try {

0 commit comments

Comments
 (0)