logout method

Future<void> logout({
  1. required String accessToken,
})

Removes the locally stored SSO tokens from the client-side cache and sends an API call to the IAM Identity Center service to invalidate the corresponding server-side IAM Identity Center sign in session.

After user logout, any existing IAM role sessions that were created by using IAM Identity Center permission sets continue based on the duration configured in the permission set. For more information, see User authentications in the IAM Identity Center User Guide.

May throw InvalidRequestException. May throw TooManyRequestsException. May throw UnauthorizedException.

Parameter accessToken : The token issued by the CreateToken API call. For more information, see CreateToken in the IAM Identity Center OIDC API Reference Guide.

Implementation

Future<void> logout({
  required String accessToken,
}) async {
  final headers = <String, String>{
    'x-amz-sso_bearer_token': accessToken.toString(),
  };
  await _protocol.send(
    payload: null,
    method: 'POST',
    requestUri: '/logout',
    signed: false,
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
}