Skip to content

Revoke Token

This document describes how to revoke access_token and refresh_token.

DANGER

Note: If you use the method of verifying access_token and refresh_token locally, when revoking access_token and refresh_token, be sure to clear the cache of access_token and refresh_token locally, otherwise the result of local verification will still be valid. For details, please see Verify access_token.

Revoke Token

This interface is used to revoke the issued access_token and refresh_token.

Request parameters

NameTypeRequiredDefault valueDescriptionSample value
tokenstringYes-Access Token or Refresh Tokensome-randon-string

Sample code

typescript
import { AuthenticationClient, Models } from "authing-node-sdk";

const authenticationClient = new AuthenticationClient({
  // Need to be replaced with your GenAuth application ID
  appId: "GEN_AUTH_APP_ID",
  // Need to be replaced with your GenAuth application key
  appSecret: "GEN_AUTH_APP_SECRET",
  // Need to be replaced with your GenAuth application domain name
  appHost: "GEN_AUTH_APP_HOST",
  // Need to be replaced with your GenAuth application callback address
  redirectUri: "GEN_AUTH_APP_REDIRECT_URI",
});

(async () => {
  const result = await authenticationClient.revokeToken(
    // Need to be replaced with the real access_token or refresh_token
    "REPLACE_ME_WITH_REAL_CODE"
  );
  console.log(JSON.stringify(result, null, 2));
})();

Request response

Type: IntrospectTokenResult

NameTypeIs it requiredDescriptionSample value
successboolyesWhether the withdrawal was successfultrue

Sample result:

json
true

Agent infrastructure for identity, memory, and web action.