get_user

get_user(**kwargs)

Gets the user attributes and metadata for a user.

See also: AWS API Documentation

Request Syntax

response = client.get_user(
    AccessToken='string'
)
Parameters
AccessToken (string) --

[REQUIRED]

A non-expired access token for the user whose information you want to query.

Return type
dict
Returns
Response Syntax
{
    'Username': 'string',
    'UserAttributes': [
        {
            'Name': 'string',
            'Value': 'string'
        },
    ],
    'MFAOptions': [
        {
            'DeliveryMedium': 'SMS'|'EMAIL',
            'AttributeName': 'string'
        },
    ],
    'PreferredMfaSetting': 'string',
    'UserMFASettingList': [
        'string',
    ]
}

Response Structure

  • (dict) --

    Represents the response from the server from the request to get information about the user.

    • Username (string) --

      The user name of the user you want to retrieve from the get user request.

    • UserAttributes (list) --

      An array of name-value pairs representing user attributes.

      For custom attributes, you must prepend the custom: prefix to the attribute name.

      • (dict) --

        Specifies whether the attribute is standard or custom.

        • Name (string) --

          The name of the attribute.

        • Value (string) --

          The value of the attribute.

    • MFAOptions (list) --
      This response parameter is no longer supported. It provides information only about SMS MFA configurations. It doesn't provide information about time-based one-time password (TOTP) software token MFA configurations. To look up information about either type of MFA configuration, use UserMFASettingList instead.
      • (dict) --
        This data type is no longer supported. Applies only to SMS multi-factor authentication (MFA) configurations. Does not apply to time-based one-time password (TOTP) software token MFA configurations.
        • DeliveryMedium (string) --

          The delivery medium to send the MFA code. You can use this parameter to set only the SMS delivery medium value.

        • AttributeName (string) --

          The attribute name of the MFA option type. The only valid value is phone_number .

    • PreferredMfaSetting (string) --

      The user's preferred MFA setting.

    • UserMFASettingList (list) --

      The MFA options that are activated for the user. The possible values in this list are SMS_MFA and SOFTWARE_TOKEN_MFA .

      • (string) --

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.PasswordResetRequiredException
  • CognitoIdentityProvider.Client.exceptions.UserNotFoundException
  • CognitoIdentityProvider.Client.exceptions.UserNotConfirmedException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
  • CognitoIdentityProvider.Client.exceptions.ForbiddenException