CognitoIdentityProvider / Client / revoke_user_session

revoke_user_session

CognitoIdentityProvider.Client.revoke_user_session(**kwargs)

Revokes a specific session for the currently signed-in user. Amazon Cognito authorizes this operation with the user’s access token, revokes all refresh and access tokens that are associated with the session, and deletes the session record. You can’t revoke the session that the calling access token belongs to.

See also: AWS API Documentation

Request Syntax

response = client.revoke_user_session(
    AccessToken='string',
    SessionId='string',
    RevokeAssociatedSessions='NONE'|'LINKED'
)
Parameters:
  • AccessToken (string) –

    [REQUIRED]

    A valid access token that Amazon Cognito issued to the user. Amazon Cognito uses this token to authorize the request and to identify the user.

  • SessionId (string) –

    [REQUIRED]

    The ID of the session to revoke. This is a 28-character string of lowercase letters and digits, prefixed with tkn for a token session or sso for an SSO session. This value can’t identify the caller’s own current session.

  • RevokeAssociatedSessions (string) – Specifies whether to also revoke the sessions that are linked to the targeted session. NONE, the default, revokes only the targeted session. LINKED also revokes the directly linked session or sessions, interpreted relative to the type of the targeted session: revoking a token session also revokes the parent SSO session it came through, and revoking an SSO session also revokes the token sessions that came through it. The set of linked sessions is eventually consistent, so associated sessions are typically revoked within a few seconds.

Return type:

dict

Returns:

Response Syntax

{}

Response Structure

  • (dict) –

Exceptions