getUser method

Future<GetUserResponse> getUser({
  1. required String accessToken,
})

Gets the user attributes and metadata for a user.

May throw ResourceNotFoundException. May throw InvalidParameterException. May throw NotAuthorizedException. May throw TooManyRequestsException. May throw PasswordResetRequiredException. May throw UserNotFoundException. May throw UserNotConfirmedException. May throw InternalErrorException.

Parameter accessToken : The access token returned by the server response to get information about the user.

Implementation

Future<GetUserResponse> getUser({
  required String accessToken,
}) async {
  ArgumentError.checkNotNull(accessToken, 'accessToken');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSCognitoIdentityProviderService.GetUser'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    signed: false,
    // TODO queryParams
    headers: headers,
    payload: {
      'AccessToken': accessToken,
    },
  );

  return GetUserResponse.fromJson(jsonResponse.body);
}