Skip to main content

Important

Only can be revoked. are not stored by Clerk and therefore cannot be revoked. If you need revocation capability, use the default opaque token format when creating tokens.

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

  • When revoking M2M tokens with a Machine Secret Key, the token will be revoked using the machine secret key.
  • When revoking M2M tokens with a Clerk Secret Key, the token will be revoked using the instance secret key.

Returns the revoked M2MToken object.

function revokeToken(params: RevokeM2MTokenParams): Promise<M2MToken>
  • Name
    m2mTokenId
    Type
    string
    Description

    The ID of the M2M token to revoke.

  • Name
    machineSecretKey?
    Type
    string
    Description

    The custom machine secret key for authentication. If not provided, the SDK will use the value from the environment variables.

  • Name
    revocationReason?
    Type
    string | null
    Description

    The reason for revoking the M2M token. Useful for your records.

Note

Using clerkClient varies based on the SDK you're using. Refer to the 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