CognitoIdentityProvider / Client / get_user
get_user#
- CognitoIdentityProvider.Client.get_user(**kwargs)#
Gets user attributes and and MFA settings for the currently signed-in user.
Authorize this action with a signed-in user’s access token. It must include the scope
aws.cognito.signin.user.admin
.Note
Amazon Cognito doesn’t evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can’t use IAM credentials to authorize requests, and you can’t grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.
See also: AWS API Documentation
Request Syntax
response = client.get_user( AccessToken='string' )
- Parameters:
AccessToken (string) –
[REQUIRED]
A valid access token that Amazon Cognito issued to the currently signed-in user. Must include a scope claim for
aws.cognito.signin.user.admin
.- 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 name of the user that you requested.
UserAttributes (list) –
An array of name-value pairs representing user attributes.
Custom attributes are prepended with the
custom:
prefix.(dict) –
The name and value of a user attribute.
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. 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
, andSOFTWARE_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