CognitoIdentityProvider / Client / revoke_token

revoke_token#

CognitoIdentityProvider.Client.revoke_token(**kwargs)#

Revokes all of the access tokens generated by, and at the same time as, the specified refresh token. After a token is revoked, you can’t use the revoked token to access Amazon Cognito user APIs, or to authorize access to your resource server.

Note

Amazon Cognito doesn’t evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can’t use IAM credentials to authorize requests, and you can’t grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito native and OIDC APIs.

See also: AWS API Documentation

Request Syntax

response = client.revoke_token(
    Token='string',
    ClientId='string',
    ClientSecret='string'
)
Parameters:
  • Token (string) –

    [REQUIRED]

    The refresh token that you want to revoke.

  • ClientId (string) –

    [REQUIRED]

    The client ID for the token that you want to revoke.

  • ClientSecret (string) – The secret for the client ID. This is required only if the client ID has a secret.

Return type:

dict

Returns:

Response Syntax

{}

Response Structure

  • (dict) –

Exceptions

  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException

  • CognitoIdentityProvider.Client.exceptions.InternalErrorException

  • CognitoIdentityProvider.Client.exceptions.UnauthorizedException

  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException

  • CognitoIdentityProvider.Client.exceptions.UnsupportedOperationException

  • CognitoIdentityProvider.Client.exceptions.UnsupportedTokenTypeException

  • CognitoIdentityProvider.Client.exceptions.ForbiddenException