Merge pull request #280 from max-stytch/max/disconnect

fix: Disconnecting should clear oauth state
This commit is contained in:
Cliff Hall
2025-04-17 10:43:37 -04:00
committed by GitHub
2 changed files with 14 additions and 0 deletions

View File

@@ -88,4 +88,16 @@ export class InspectorOAuthClientProvider implements OAuthClientProvider {
return verifier;
}
clear() {
sessionStorage.removeItem(
getServerSpecificKey(SESSION_KEYS.CLIENT_INFORMATION, this.serverUrl),
);
sessionStorage.removeItem(
getServerSpecificKey(SESSION_KEYS.TOKENS, this.serverUrl),
);
sessionStorage.removeItem(
getServerSpecificKey(SESSION_KEYS.CODE_VERIFIER, this.serverUrl),
);
}
}

View File

@@ -396,6 +396,8 @@ export function useConnection({
const disconnect = async () => {
await mcpClient?.close();
const authProvider = new InspectorOAuthClientProvider(sseUrl);
authProvider.clear();
setMcpClient(null);
setConnectionStatus("disconnected");
setCompletionsSupported(false);