fix: Invalidate oauth credentials when oauth provider says so (#14007)

Co-authored-by: Eduardo Gomes <egomes@cloudflare.com>
pull/14101/head
Eduardo Gomes 2026-02-17 19:46:26 +01:00 committed by GitHub
parent 4025b655a4
commit fb79dd7bf8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 22 additions and 0 deletions

View File

@ -149,6 +149,28 @@ export class McpOAuthProvider implements OAuthClientProvider {
} }
return entry.oauthState 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 } export { OAUTH_CALLBACK_PORT, OAUTH_CALLBACK_PATH }