# Method: accounts.revokeToken

- [HTTP request](https://docs.cloud.google.com/identity-platform/docs/reference/rest/v2/accounts/revokeToken#body.HTTP_TEMPLATE)
- [Request body](https://docs.cloud.google.com/identity-platform/docs/reference/rest/v2/accounts/revokeToken#body.request_body)
  - [JSON representation](https://docs.cloud.google.com/identity-platform/docs/reference/rest/v2/accounts/revokeToken#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://docs.cloud.google.com/identity-platform/docs/reference/rest/v2/accounts/revokeToken#body.response_body)
- [Authorization scopes](https://docs.cloud.google.com/identity-platform/docs/reference/rest/v2/accounts/revokeToken#body.aspect)
- [TokenType](https://docs.cloud.google.com/identity-platform/docs/reference/rest/v2/accounts/revokeToken#TokenType)
- [Try it!](https://docs.cloud.google.com/identity-platform/docs/reference/rest/v2/accounts/revokeToken#try-it)

Revokes a user's token from an Identity Provider (IdP). This is done by manually providing an IdP credential, and the token types for revocation.

An [API key](https://cloud.google.com/docs/authentication/api-keys) is required in the request in order to identify the Google Cloud project.

### HTTP request

`POST https://identitytoolkit.googleapis.com/v2/accounts:revokeToken`

The URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "providerId": string, "tokenType": enum (`https://docs.cloud.google.com/identity-platform/docs/reference/rest/v2/accounts/revokeToken#TokenType`), "token": string, "idToken": string, "tenantId": string, "redirectUri": string } ``` |

| Fields ||
|---|---|
| `providerId` | `string` Required. The idp provider for the token. Currently only supports Apple Idp. The format should be "apple.com". |
| `tokenType` | ``enum (`https://docs.cloud.google.com/identity-platform/docs/reference/rest/v2/accounts/revokeToken#TokenType`)`` Required. The type of the token to be revoked. |
| `token` | `string` Required. The token to be revoked. If an authorization_code is passed in, the API will first exchange the code for access token and then revoke the token exchanged. |
| `idToken` | `string` Required. A valid Identity Platform ID token to link the account. If there was a successful token revocation request on the account and no tokens are generated after the revocation, the duplicate requests will be ignored and returned immediately. |
| `tenantId` | `string` The ID of the Identity Platform tenant the user is signing in to. If not set, the user will sign in to the default Identity Platform project. |
| `redirectUri` | `string` The redirect URI provided in the initial authorization request made by the client to the IDP. The URI must use the HTTPS protocol, include a domain name, and can't contain an IP address or localhost. Required if tokenType is CODE. |

### Response body

If successful, the response body is empty.

### Authorization scopes

Requires one of the following OAuth scopes:

- `https://www.googleapis.com/auth/identitytoolkit`
- `
  https://www.googleapis.com/auth/cloud-platform`

For more information, see the [Authentication Overview](https://docs.cloud.google.com/docs/authentication#authorization-gcp).

## TokenType

The type of the token to be revoked.

| Enums ||
|---|---|
| `TOKEN_TYPE_UNSPECIFIED` | Default value, do not use. |
| `REFRESH_TOKEN` | Token type is refreshToken. |
| `ACCESS_TOKEN` | Token type is accessToken. |
| `CODE` | Token type is authorization_code. |