revoke_token
¶
revoke_token(
token: TokenModelType,
client_id: ClientIdType,
*,
config_overrides: Optional[CognitoIdentityProviderClientConfig] = None,
client_secret: Optional[ClientSecretType] = None,
revoke_associated_sessions: Optional[RevokeAssociatedSessionsType] = None,
) -> RevokeTokenResponse
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.
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.
Parameters:
-
token(TokenModelType) –The refresh token that you want to revoke.
-
client_id(ClientIdType) –The ID of the app client where the token that you want to revoke was issued.
-
client_secret(Optional[ClientSecretType], default:None) –The client secret of the requested app client, if the client has a secret.
-
revoke_associated_sessions(Optional[RevokeAssociatedSessionsType], default:None) –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.
Raises:
-
ForbiddenException–This exception is thrown when WAF doesn't allow your request based on a web ACL that's associated with your user pool.
-
InternalErrorException–This exception is thrown when Amazon Cognito encounters an internal error.
-
InvalidParameterException–This exception is thrown when the Amazon Cognito service encounters an invalid parameter.
-
OperationNotEnabledException–This exception is thrown when an operation is not available in the current region or for the current user pool configuration. This can occur when attempting to perform operations that are not supported in secondary replica regions.
-
TooManyRequestsException–This exception is thrown when the user has made too many requests for a given operation.
-
UnauthorizedException–Exception that is thrown when the request isn't authorized. This can happen due to an invalid access token in the request.
-
UnsupportedOperationException–Exception that is thrown when you attempt to perform an operation that isn't enabled for the user pool client.
-
UnsupportedTokenTypeException–Exception that is thrown when an unsupported token is passed to an operation.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_cognito_identity_provider/_services/cognito_identity_provider.py
9848 9849 9850 9851 9852 9853 9854 9855 9856 9857 9858 9859 9860 9861 9862 9863 9864 9865 9866 9867 9868 9869 9870 9871 9872 9873 9874 9875 9876 9877 9878 9879 9880 9881 9882 9883 9884 9885 9886 9887 9888 9889 9890 9891 9892 9893 9894 9895 9896 9897 9898 9899 9900 9901 9902 9903 9904 9905 9906 9907 9908 9909 9910 9911 9912 9913 9914 9915 9916 9917 9918 9919 9920 9921 9922 9923 9924 9925 | |