CognitoIdentityProvider / Client / admin_get_user

admin_get_user#

CognitoIdentityProvider.Client.admin_get_user(**kwargs)#

Gets the specified user by user name in a user pool as an administrator. Works on any user.

Note

Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding IAM permission in a policy.

Learn more

See also: AWS API Documentation

Request Syntax

response = client.admin_get_user(
    UserPoolId='string',
    Username='string'
)
Parameters:
  • UserPoolId (string) –

    [REQUIRED]

    The user pool ID for the user pool where you want to get information about the user.

  • Username (string) –

    [REQUIRED]

    The user name of the user you want to retrieve.

Return type:

dict

Returns:

Response Syntax

{
    'Username': 'string',
    'UserAttributes': [
        {
            'Name': 'string',
            'Value': 'string'
        },
    ],
    'UserCreateDate': datetime(2015, 1, 1),
    'UserLastModifiedDate': datetime(2015, 1, 1),
    'Enabled': True|False,
    'UserStatus': 'UNCONFIRMED'|'CONFIRMED'|'ARCHIVED'|'COMPROMISED'|'UNKNOWN'|'RESET_REQUIRED'|'FORCE_CHANGE_PASSWORD',
    'MFAOptions': [
        {
            'DeliveryMedium': 'SMS'|'EMAIL',
            'AttributeName': 'string'
        },
    ],
    'PreferredMfaSetting': 'string',
    'UserMFASettingList': [
        'string',
    ]
}

Response Structure

  • (dict) –

    Represents the response from the server from the request to get the specified user as an administrator.

    • Username (string) –

      The username of the user that you requested.

    • UserAttributes (list) –

      An array of name-value pairs representing user attributes.

      • (dict) –

        Specifies whether the attribute is standard or custom.

        • Name (string) –

          The name of the attribute.

        • Value (string) –

          The value of the attribute.

    • UserCreateDate (datetime) –

      The date the user was created.

    • UserLastModifiedDate (datetime) –

      The date and time, in ISO 8601 format, when the item was modified.

    • Enabled (boolean) –

      Indicates that the status is enabled.

    • UserStatus (string) –

      The user status. Can be one of the following:

      • UNCONFIRMED - User has been created but not confirmed.

      • CONFIRMED - User has been confirmed.

      • UNKNOWN - User status isn’t known.

      • RESET_REQUIRED - User is confirmed, but the user must request a code and reset their password before they can sign in.

      • FORCE_CHANGE_PASSWORD - The user is confirmed and the user can sign in using a temporary password, but on first sign-in, the user must change their password to a new value before doing anything else.

    • 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.TooManyRequestsException

  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException

  • CognitoIdentityProvider.Client.exceptions.UserNotFoundException

  • CognitoIdentityProvider.Client.exceptions.InternalErrorException