From 6a16e7cd24676f24b616b88dc9274cdca0f06224 Mon Sep 17 00:00:00 2001 From: Maxwell Gerber Date: Mon, 7 Apr 2025 15:15:28 -0700 Subject: [PATCH] fix: Disconnecting should clear oauth state --- client/src/lib/auth.ts | 6 ++++++ client/src/lib/hooks/useConnection.ts | 1 + 2 files changed, 7 insertions(+) diff --git a/client/src/lib/auth.ts b/client/src/lib/auth.ts index ba610bc..72d194e 100644 --- a/client/src/lib/auth.ts +++ b/client/src/lib/auth.ts @@ -68,6 +68,12 @@ class InspectorOAuthClientProvider implements OAuthClientProvider { return verifier; } + + clear() { + sessionStorage.removeItem(SESSION_KEYS.CLIENT_INFORMATION); + sessionStorage.removeItem(SESSION_KEYS.TOKENS); + sessionStorage.removeItem(SESSION_KEYS.CODE_VERIFIER); + } } export const authProvider = new InspectorOAuthClientProvider(); diff --git a/client/src/lib/hooks/useConnection.ts b/client/src/lib/hooks/useConnection.ts index bff01ce..667da77 100644 --- a/client/src/lib/hooks/useConnection.ts +++ b/client/src/lib/hooks/useConnection.ts @@ -361,6 +361,7 @@ export function useConnection({ const disconnect = async () => { await mcpClient?.close(); + authProvider.clear(); setMcpClient(null); setConnectionStatus("disconnected"); setCompletionsSupported(false);