CognitoIdentityProvider / Client / admin_get_user

admin_get_user#

CognitoIdentityProvider.Client.admin_get_user(**kwargs)#

Given the username, returns details about a user profile in a user pool. This operation contributes to your monthly active user (MAU) count for the purpose of billing. You can specify alias attributes in the Username parameter.

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 ID of the user pool where you want to get information about the user.

  • Username (string) –

    [REQUIRED]

    The username of the user that you want to query or modify. The value of this parameter is typically your user’s username, but it can be any of their alias attributes. If username isn’t an alias attribute in your user pool, this value must be the sub of a local user or the username of a user from a third-party IdP.

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'|'EXTERNAL_PROVIDER',
    '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 of user attributes and their values, for example "email": "testuser@example.com".

      • (dict) –

        The name and value of a user attribute.

        This data type is a request parameter of AdminUpdateUserAttributes and UpdateUserAttributes.

        • Name (string) –

          The name of the attribute.

        • Value (string) –

          The value of the attribute.

    • UserCreateDate (datetime) –

      The date and time when the item was created. Amazon Cognito returns this timestamp in UNIX epoch time format. Your SDK might render the output in a human-readable format like ISO 8601 or a Java Date object.

    • UserLastModifiedDate (datetime) –

      The date and time when the item was modified. Amazon Cognito returns this timestamp in UNIX epoch time format. Your SDK might render the output in a human-readable format like ISO 8601 or a Java Date object.

    • Enabled (boolean) –

      Indicates whether the user is activated for sign-in. The AdminDisableUser and AdminEnableUser API operations deactivate and activate user sign-in, respectively.

    • UserStatus (string) –

      The user’s 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.

      • EXTERNAL_PROVIDER - The user signed in with a third-party identity provider.

    • 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. Users can prefer SMS message, email message, or TOTP MFA.

    • UserMFASettingList (list) –

      The MFA options that are activated for the user. The possible values in this list are SMS_MFA, EMAIL_OTP, and SOFTWARE_TOKEN_MFA. You can change the MFA preference for users who have more than one available MFA factor with AdminSetUserMFAPreference or SetUserMFAPreference.

      • (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