diff options
| author | Eduardo Gomes <[email protected]> | 2026-02-17 19:46:26 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-02-17 12:46:26 -0600 |
| commit | fb79dd7bf857a95a6045209cc1f3f859563a8081 (patch) | |
| tree | 5f42a5ca954350585884f8403bc5217fb6a1f8ef | |
| parent | 4025b655a403141ef34102daf33fca1a886ae540 (diff) | |
| download | opencode-fb79dd7bf857a95a6045209cc1f3f859563a8081.tar.gz opencode-fb79dd7bf857a95a6045209cc1f3f859563a8081.zip | |
fix: Invalidate oauth credentials when oauth provider says so (#14007)
Co-authored-by: Eduardo Gomes <[email protected]>
| -rw-r--r-- | packages/opencode/src/mcp/oauth-provider.ts | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/packages/opencode/src/mcp/oauth-provider.ts b/packages/opencode/src/mcp/oauth-provider.ts index 35ead25e8..164b1d1f1 100644 --- a/packages/opencode/src/mcp/oauth-provider.ts +++ b/packages/opencode/src/mcp/oauth-provider.ts @@ -149,6 +149,28 @@ export class McpOAuthProvider implements OAuthClientProvider { } return entry.oauthState } + + async invalidateCredentials(type: "all" | "client" | "tokens"): Promise<void> { + log.info("invalidating credentials", { mcpName: this.mcpName, type }) + const entry = await McpAuth.get(this.mcpName) + if (!entry) { + return + } + + switch (type) { + case "all": + await McpAuth.remove(this.mcpName) + break + case "client": + delete entry.clientInfo + await McpAuth.set(this.mcpName, entry) + break + case "tokens": + delete entry.tokens + await McpAuth.set(this.mcpName, entry) + break + } + } } export { OAUTH_CALLBACK_PORT, OAUTH_CALLBACK_PATH } |
