Skip to content

Commit eda547e

Browse files
committed
Fix duplicate OAuth redirect URIs
* In auth.ts - add getter for redirect_uris which returns redirectUrl and debugRedirectUrl but de-duped - included comments that explains the problem and link to issue - in clientMetadata getter, - replace hardcoded array value with this..redirect_uris, so it will never contain duplicate uris Fixes #825
1 parent ccb68b9 commit eda547e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

client/src/lib/auth.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,16 @@ export class InspectorOAuthClientProvider implements OAuthClientProvider {
121121
return window.location.origin + "/oauth/callback/debug";
122122
}
123123

124+
get redirect_uris() {
125+
// Normally register both redirect URIs to support both normal and debug flows
126+
// In debug subclass, redirectUrl may be the same as debugRedirectUrl, so remove duplicates
127+
// See: https://github.com/modelcontextprotocol/inspector/issues/825
128+
return [...new Set([this.redirectUrl, this.debugRedirectUrl])];
129+
}
130+
124131
get clientMetadata(): OAuthClientMetadata {
125-
// Register both redirect URIs to support both normal and debug flows
126132
return {
127-
redirect_uris: [this.redirectUrl, this.debugRedirectUrl],
133+
redirect_uris: this.redirect_uris,
128134
token_endpoint_auth_method: "none",
129135
grant_types: ["authorization_code", "refresh_token"],
130136
response_types: ["code"],

0 commit comments

Comments
 (0)