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 user pools API and user pool endpoints.
See also: AWS API Documentation
Request Syntax
response = client.revoke_token( Token='string', ClientId='string', ClientSecret='string', RevokeAssociatedSessions='NONE'|'LINKED' )
- Parameters:
Token (string) –
[REQUIRED]
The refresh token that you want to revoke.
ClientId (string) –
[REQUIRED]
The ID of the app client where the token that you want to revoke was issued.
ClientSecret (string) – The client secret of the requested app client, if the client has a secret.
RevokeAssociatedSessions (string) – Specifies whether to also revoke the SSO session that is linked to the token session being revoked.
NONE, the default, revokes only the token session that is associated with the refresh token.LINKEDalso revokes the parent SSO session that the token session came through; the other token sessions that came through that SSO session aren’t revoked.LINKEDhas no effect when session tracking is disabled or when the token session has no parent SSO session.
- Return type:
dict
- Returns:
Response Syntax
{}Response Structure
(dict) –
Exceptions
CognitoIdentityProvider.Client.exceptions.TooManyRequestsExceptionCognitoIdentityProvider.Client.exceptions.InternalErrorExceptionCognitoIdentityProvider.Client.exceptions.UnauthorizedExceptionCognitoIdentityProvider.Client.exceptions.InvalidParameterExceptionCognitoIdentityProvider.Client.exceptions.UnsupportedOperationExceptionCognitoIdentityProvider.Client.exceptions.UnsupportedTokenTypeExceptionCognitoIdentityProvider.Client.exceptions.ForbiddenExceptionCognitoIdentityProvider.Client.exceptions.OperationNotEnabledException