Skip to main content
Docs

revokeToken()

Revokes an M2M token. This endpoint can be authenticated by either a Machine Secret Key or by a Clerk Secret Key.

  • When revoking a M2M token with a Machine Secret Key, the token must be managed by the Machine associated with the Machine Secret Key.
  • When revoking a M2M token with a Clerk Secret Key, any token on the instance can be revoked.
function revokeToken(params: RevokeM2MTokenParams): Promise<M2MToken>
  • Name
    machineSecretKey?
    Type
    string
    Description

    Custom machine secret key for authentication. If not provided, the SDK will use the value from the environment variable.

  • Name
    m2mTokenId
    Type
    string
    Description

    The ID of the M2M token to revoke.

  • Name
    revocationReason?
    Type
    string | null
    Description

    Optional reason for revocation. Useful for your records.

Note

Importing clerkClient varies based on your framework. Refer to the Backend SDK overview for usage details, including guidance on how to access the userId and other properties.

const response = await clerkClient.m2m.revokeToken({ m2mTokenId })

Backend API (BAPI) endpoint

This method in the SDK is a wrapper around the BAPI endpoint POST/m2m_tokens/{m2m_token_id}/revoke. See the BAPI reference for more information.

Feedback

What did you think of this content?

Last updated on