Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions client/src/lib/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,14 @@ export class InspectorOAuthClientProvider implements OAuthClientProvider {
return window.location.origin + "/oauth/callback";
}

get debugRedirectUrl() {
return window.location.origin + "/oauth/callback/debug";
}

get clientMetadata(): OAuthClientMetadata {
// Register both redirect URIs to support both normal and debug flows
return {
redirect_uris: [this.redirectUrl],
redirect_uris: [this.redirectUrl, this.debugRedirectUrl],
token_endpoint_auth_method: "none",
grant_types: ["authorization_code", "refresh_token"],
response_types: ["code"],
Expand Down Expand Up @@ -223,11 +228,13 @@ export class InspectorOAuthClientProvider implements OAuthClientProvider {
}
}

// Overrides debug URL and allows saving server OAuth metadata to
// Overrides redirect URL to use the debug endpoint and allows saving server OAuth metadata to
// display in debug UI.
export class DebugInspectorOAuthClientProvider extends InspectorOAuthClientProvider {
get redirectUrl(): string {
return `${window.location.origin}/oauth/callback/debug`;
// We can use the debug redirect URL here because it was already registered
// in the parent class's clientMetadata along with the normal redirect URL
return this.debugRedirectUrl;
}

saveServerMetadata(metadata: OAuthMetadata) {
Expand Down