revokeToken method

Future<void> revokeToken({
  1. required String clientId,
  2. required String token,
  3. String? clientSecret,
})

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.

May throw ForbiddenException. May throw InternalErrorException. May throw InvalidParameterException. May throw OperationNotEnabledException. May throw TooManyRequestsException. May throw UnauthorizedException. May throw UnsupportedOperationException. May throw UnsupportedTokenTypeException.

Parameter clientId : The ID of the app client where the token that you want to revoke was issued.

Parameter token : The refresh token that you want to revoke.

Parameter clientSecret : The client secret of the requested app client, if the client has a secret.

Implementation

Future<void> revokeToken({
  required String clientId,
  required String token,
  String? clientSecret,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSCognitoIdentityProviderService.RevokeToken'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    signed: false,
    // TODO queryParams
    headers: headers,
    payload: {
      'ClientId': clientId,
      'Token': token,
      if (clientSecret != null) 'ClientSecret': clientSecret,
    },
  );
}