GeminiGemini
Demo environmentGet API key
  • Overview
  • Crypto Trading
  • Prediction Markets
  • Perpetuals
  • Stocks
  • API Reference
  • SDKs & Tools
Changelog
Gemini logoGemini logo

© 2026 Gemini Space Station, Inc.

TypeScript SDK — Account Services: OAuth Token Revocation

Low-level OAuth token revocation endpoint. This method is on client.account.

See the API specifications for the full request/response schema and the authentication guide for OAuth setup.

Methods

revokeOAuthToken

POST /v1/oauth/revokeByToken · Authenticated

Revokes the current OAuth access and refresh tokens. This is the low-level REST endpoint — most users should use OAuthAuth.revoke() instead, which handles token lifecycle, store cleanup, and calls this endpoint under the hood.

Code
// Low-level: direct REST call const result = await client.account.revokeOAuthToken({}); console.log(result.message); // confirmation message

This is a POST mutation — never automatically retried.

The preferred approach uses the OAuthAuth class directly. It owns the revocation request and uses the same configured environment as the OAuth client:

Code
import { OAuthAuth } from "@gemini-markets/sdk/server"; const auth = new OAuthAuth({ client: { type: "public", clientId: "your-client-id", redirectUri: "http://localhost:3000/callback" }, env: "sandbox", tokenStore: yourTokenStore, }); await auth.revoke(); // Tokens are revoked server-side and cleared from your token store

When to use each:

  • OAuthAuth.revoke() — the recommended path. It loads the stored access token as-is, calls the revocation endpoint, and clears the token store in a finally block. It does not refresh an expired token; if the server request fails, the local store is still cleared. Use this for logout flows, token rotation, and session cleanup.
  • client.account.revokeOAuthToken({}) — the raw REST call. Use only if you need direct control over the HTTP request (e.g. custom error handling, auditing) and are managing token store cleanup yourself.

Caveat: After revocation, the access token and refresh token are both invalidated. You'll need to complete a new authorization flow to obtain fresh tokens.

What's next

  • Authentication — OAuth setup, HMAC auth, and the OAuthAuth class
  • Error Handling — OAuthTokenError and OAuthAuthorizationError
On this page
  • Methods
    • revokeOAuthToken
  • What's next
TypeScript
TypeScript