CognitoIdentityProvider

Client

class CognitoIdentityProvider.Client

A low-level client representing Amazon Cognito Identity Provider

Using the Amazon Cognito user pools API, you can create a user pool to manage directories and users. You can authenticate a user to obtain tokens related to user identity and access policies.

This API reference provides information about user pools in Amazon Cognito user pools.

For more information, see the Amazon Cognito Documentation .

import boto3

client = boto3.client('cognito-idp')

These are the available methods:

add_custom_attributes(**kwargs)

Adds additional user attributes to the user pool schema.

See also: AWS API Documentation

Request Syntax

response = client.add_custom_attributes(
    UserPoolId='string',
    CustomAttributes=[
        {
            'Name': 'string',
            'AttributeDataType': 'String'|'Number'|'DateTime'|'Boolean',
            'DeveloperOnlyAttribute': True|False,
            'Mutable': True|False,
            'Required': True|False,
            'NumberAttributeConstraints': {
                'MinValue': 'string',
                'MaxValue': 'string'
            },
            'StringAttributeConstraints': {
                'MinLength': 'string',
                'MaxLength': 'string'
            }
        },
    ]
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool where you want to add custom attributes.

  • CustomAttributes (list) --

    [REQUIRED]

    An array of custom attributes, such as Mutable and Name.

    • (dict) --

      Contains information about the schema attribute.

      • Name (string) --

        A schema attribute of the name type.

      • AttributeDataType (string) --

        The attribute data type.

      • DeveloperOnlyAttribute (boolean) --

        Note

        You should use WriteAttributes in the user pool client to control how attributes can be mutated for new use cases instead of using DeveloperOnlyAttribute .

        Specifies whether the attribute type is developer only. This attribute can only be modified by an administrator. Users won't be able to modify this attribute using their access token. For example, DeveloperOnlyAttribute can be modified using AdminUpdateUserAttributes but can't be updated using UpdateUserAttributes.

      • Mutable (boolean) --

        Specifies whether the value of the attribute can be changed.

        For any user pool attribute that is mapped to an IdP attribute, you must set this parameter to true . Amazon Cognito updates mapped attributes when users sign in to your application through an IdP. If an attribute is immutable, Amazon Cognito throws an error when it attempts to update the attribute. For more information, see Specifying Identity Provider Attribute Mappings for Your User Pool .

      • Required (boolean) --

        Specifies whether a user pool attribute is required. If the attribute is required and the user doesn't provide a value, registration or sign-in will fail.

      • NumberAttributeConstraints (dict) --

        Specifies the constraints for an attribute of the number type.

        • MinValue (string) --

          The minimum value of an attribute that is of the number data type.

        • MaxValue (string) --

          The maximum value of an attribute that is of the number data type.

      • StringAttributeConstraints (dict) --

        Specifies the constraints for an attribute of the string type.

        • MinLength (string) --

          The minimum length.

        • MaxLength (string) --

          The maximum length.

Return type

dict

Returns

Response Syntax

{}

Response Structure

  • (dict) --

    Represents the response from the server for the request to add custom attributes.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.UserImportInProgressException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
admin_add_user_to_group(**kwargs)

Adds the specified user to the specified group.

Calling this action requires developer credentials.

See also: AWS API Documentation

Request Syntax

response = client.admin_add_user_to_group(
    UserPoolId='string',
    Username='string',
    GroupName='string'
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool.

  • Username (string) --

    [REQUIRED]

    The username for the user.

  • GroupName (string) --

    [REQUIRED]

    The group name.

Returns

None

Exceptions

  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.UserNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
admin_confirm_sign_up(**kwargs)

Confirms user registration as an admin without using a confirmation code. Works on any user.

Calling this action requires developer credentials.

See also: AWS API Documentation

Request Syntax

response = client.admin_confirm_sign_up(
    UserPoolId='string',
    Username='string',
    ClientMetadata={
        'string': 'string'
    }
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for which you want to confirm user registration.

  • Username (string) --

    [REQUIRED]

    The user name for which you want to confirm user registration.

  • ClientMetadata (dict) --

    A map of custom key-value pairs that you can provide as input for any custom workflows that this action triggers.

    If your user pool configuration includes triggers, the AdminConfirmSignUp API action invokes the Lambda function that is specified for the post confirmation trigger. When Amazon Cognito invokes this function, it passes a JSON payload, which the function receives as input. In this payload, the clientMetadata attribute provides the data that you assigned to the ClientMetadata parameter in your AdminConfirmSignUp request. In your function code in Lambda, you can process the ClientMetadata value to enhance your workflow for your specific needs.

    For more information, see Customizing user pool Workflows with Lambda Triggers in the Amazon Cognito Developer Guide .

    Note

    When you use the ClientMetadata parameter, remember that Amazon Cognito won't do the following:

    • Store the ClientMetadata value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration doesn't include triggers, the ClientMetadata parameter serves no purpose.
    • Validate the ClientMetadata value.
    • Encrypt the ClientMetadata value. Don't use Amazon Cognito to provide sensitive information.
    • (string) --
      • (string) --
Return type

dict

Returns

Response Syntax

{}

Response Structure

  • (dict) --

    Represents the response from the server for the request to confirm registration.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.UnexpectedLambdaException
  • CognitoIdentityProvider.Client.exceptions.UserLambdaValidationException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.TooManyFailedAttemptsException
  • CognitoIdentityProvider.Client.exceptions.InvalidLambdaResponseException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.LimitExceededException
  • CognitoIdentityProvider.Client.exceptions.UserNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
admin_create_user(**kwargs)

Creates a new user in the specified user pool.

If MessageAction isn't set, the default is to send a welcome message via email or phone (SMS).

Note

This action might generate an SMS text message. Starting June 1, 2021, US telecom carriers require you to register an origination phone number before you can send SMS messages to US phone numbers. If you use SMS text messages in Amazon Cognito, you must register a phone number with Amazon Pinpoint . Amazon Cognito uses the registered number automatically. Otherwise, Amazon Cognito users who must receive SMS messages might not be able to sign up, activate their accounts, or sign in.

If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Service, Amazon Simple Notification Service might place your account in the SMS sandbox. In * sandbox mode * , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see SMS message settings for Amazon Cognito user pools in the Amazon Cognito Developer Guide .

This message is based on a template that you configured in your call to create or update a user pool. This template includes your custom sign-up instructions and placeholders for user name and temporary password.

Alternatively, you can call AdminCreateUser with SUPPRESS for the MessageAction parameter, and Amazon Cognito won't send any email.

In either case, the user will be in the FORCE_CHANGE_PASSWORD state until they sign in and change their password.

AdminCreateUser requires developer credentials.

See also: AWS API Documentation

Request Syntax

response = client.admin_create_user(
    UserPoolId='string',
    Username='string',
    UserAttributes=[
        {
            'Name': 'string',
            'Value': 'string'
        },
    ],
    ValidationData=[
        {
            'Name': 'string',
            'Value': 'string'
        },
    ],
    TemporaryPassword='string',
    ForceAliasCreation=True|False,
    MessageAction='RESEND'|'SUPPRESS',
    DesiredDeliveryMediums=[
        'SMS'|'EMAIL',
    ],
    ClientMetadata={
        'string': 'string'
    }
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool where the user will be created.

  • Username (string) --

    [REQUIRED]

    The username for the user. Must be unique within the user pool. Must be a UTF-8 string between 1 and 128 characters. After the user is created, the username can't be changed.

  • UserAttributes (list) --

    An array of name-value pairs that contain user attributes and attribute values to be set for the user to be created. You can create a user without specifying any attributes other than Username . However, any attributes that you specify as required (when creating a user pool or in the Attributes tab of the console) either you should supply (in your call to AdminCreateUser ) or the user should supply (when they sign up in response to your welcome message).

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

    To send a message inviting the user to sign up, you must specify the user's email address or phone number. You can do this in your call to AdminCreateUser or in the Users tab of the Amazon Cognito console for managing your user pools.

    In your call to AdminCreateUser , you can set the email_verified attribute to True , and you can set the phone_number_verified attribute to True . You can also do this by calling AdminUpdateUserAttributes .

    • email : The email address of the user to whom the message that contains the code and username will be sent. Required if the email_verified attribute is set to True , or if "EMAIL" is specified in the DesiredDeliveryMediums parameter.
    • phone_number : The phone number of the user to whom the message that contains the code and username will be sent. Required if the phone_number_verified attribute is set to True , or if "SMS" is specified in the DesiredDeliveryMediums parameter.
    • (dict) --

      Specifies whether the attribute is standard or custom.

      • Name (string) -- [REQUIRED]

        The name of the attribute.

      • Value (string) --

        The value of the attribute.

  • ValidationData (list) --

    The user's validation data. This is an array of name-value pairs that contain user attributes and attribute values that you can use for custom validation, such as restricting the types of user accounts that can be registered. For example, you might choose to allow or disallow user sign-up based on the user's domain.

    To configure custom validation, you must create a Pre Sign-up Lambda trigger for the user pool as described in the Amazon Cognito Developer Guide. The Lambda trigger receives the validation data and uses it in the validation process.

    The user's validation data isn't persisted.

    • (dict) --

      Specifies whether the attribute is standard or custom.

      • Name (string) -- [REQUIRED]

        The name of the attribute.

      • Value (string) --

        The value of the attribute.

  • TemporaryPassword (string) --

    The user's temporary password. This password must conform to the password policy that you specified when you created the user pool.

    The temporary password is valid only once. To complete the Admin Create User flow, the user must enter the temporary password in the sign-in page, along with a new password to be used in all future sign-ins.

    This parameter isn't required. If you don't specify a value, Amazon Cognito generates one for you.

    The temporary password can only be used until the user account expiration limit that you specified when you created the user pool. To reset the account after that time limit, you must call AdminCreateUser again, specifying "RESEND" for the MessageAction parameter.

  • ForceAliasCreation (boolean) --

    This parameter is used only if the phone_number_verified or email_verified attribute is set to True . Otherwise, it is ignored.

    If this parameter is set to True and the phone number or email address specified in the UserAttributes parameter already exists as an alias with a different user, the API call will migrate the alias from the previous user to the newly created user. The previous user will no longer be able to log in using that alias.

    If this parameter is set to False , the API throws an AliasExistsException error if the alias already exists. The default value is False .

  • MessageAction (string) -- Set to RESEND to resend the invitation message to a user that already exists and reset the expiration limit on the user's account. Set to SUPPRESS to suppress sending the message. You can specify only one value.
  • DesiredDeliveryMediums (list) --

    Specify "EMAIL" if email will be used to send the welcome message. Specify "SMS" if the phone number will be used. The default value is "SMS" . You can specify more than one value.

    • (string) --
  • ClientMetadata (dict) --

    A map of custom key-value pairs that you can provide as input for any custom workflows that this action triggers.

    You create custom workflows by assigning Lambda functions to user pool triggers. When you use the AdminCreateUser API action, Amazon Cognito invokes the function that is assigned to the pre sign-up trigger. When Amazon Cognito invokes this function, it passes a JSON payload, which the function receives as input. This payload contains a clientMetadata attribute, which provides the data that you assigned to the ClientMetadata parameter in your AdminCreateUser request. In your function code in Lambda, you can process the clientMetadata value to enhance your workflow for your specific needs.

    For more information, see Customizing user pool Workflows with Lambda Triggers in the Amazon Cognito Developer Guide .

    Note

    When you use the ClientMetadata parameter, remember that Amazon Cognito won't do the following:

    • Store the ClientMetadata value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration doesn't include triggers, the ClientMetadata parameter serves no purpose.
    • Validate the ClientMetadata value.
    • Encrypt the ClientMetadata value. Don't use Amazon Cognito to provide sensitive information.
    • (string) --
      • (string) --
Return type

dict

Returns

Response Syntax

{
    'User': {
        'Username': 'string',
        'Attributes': [
            {
                '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'
            },
        ]
    }
}

Response Structure

  • (dict) --

    Represents the response from the server to the request to create the user.

    • User (dict) --

      The newly created user.

      • Username (string) --

        The user name of the user you want to describe.

      • Attributes (list) --

        A container with information about the user type 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 creation date of the user.

      • UserLastModifiedDate (datetime) --

        The last modified date of the user.

      • Enabled (boolean) --

        Specifies whether the user is enabled.

      • UserStatus (string) --

        The user status. This can be one of the following:

        • UNCONFIRMED - User has been created but not confirmed.
        • CONFIRMED - User has been confirmed.
        • EXTERNAL_PROVIDER - User signed in with a third-party IdP.
        • ARCHIVED - User is no longer active.
        • 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) --

        The MFA options for the user.

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

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.UserNotFoundException
  • CognitoIdentityProvider.Client.exceptions.UsernameExistsException
  • CognitoIdentityProvider.Client.exceptions.InvalidPasswordException
  • CognitoIdentityProvider.Client.exceptions.CodeDeliveryFailureException
  • CognitoIdentityProvider.Client.exceptions.UnexpectedLambdaException
  • CognitoIdentityProvider.Client.exceptions.UserLambdaValidationException
  • CognitoIdentityProvider.Client.exceptions.InvalidLambdaResponseException
  • CognitoIdentityProvider.Client.exceptions.PreconditionNotMetException
  • CognitoIdentityProvider.Client.exceptions.InvalidSmsRoleAccessPolicyException
  • CognitoIdentityProvider.Client.exceptions.InvalidSmsRoleTrustRelationshipException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.UnsupportedUserStateException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
admin_delete_user(**kwargs)

Deletes a user as an administrator. Works on any user.

Calling this action requires developer credentials.

See also: AWS API Documentation

Request Syntax

response = client.admin_delete_user(
    UserPoolId='string',
    Username='string'
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool where you want to delete the user.

  • Username (string) --

    [REQUIRED]

    The user name of the user you want to delete.

Returns

None

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
admin_delete_user_attributes(**kwargs)

Deletes the user attributes in a user pool as an administrator. Works on any user.

Calling this action requires developer credentials.

See also: AWS API Documentation

Request Syntax

response = client.admin_delete_user_attributes(
    UserPoolId='string',
    Username='string',
    UserAttributeNames=[
        'string',
    ]
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool where you want to delete user attributes.

  • Username (string) --

    [REQUIRED]

    The user name of the user from which you would like to delete attributes.

  • UserAttributeNames (list) --

    [REQUIRED]

    An array of strings representing the user attribute names you want to delete.

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

    • (string) --
Return type

dict

Returns

Response Syntax

{}

Response Structure

  • (dict) --

    Represents the response received from the server for a request to delete user attributes.

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
admin_disable_provider_for_user(**kwargs)

Prevents the user from signing in with the specified external (SAML or social) identity provider (IdP). If the user that you want to deactivate is a Amazon Cognito user pools native username + password user, they can't use their password to sign in. If the user to deactivate is a linked external IdP user, any link between that user and an existing user is removed. When the external user signs in again, and the user is no longer attached to the previously linked DestinationUser , the user must create a new user account. See AdminLinkProviderForUser .

This action is enabled only for admin access and requires developer credentials.

The ProviderName must match the value specified when creating an IdP for the pool.

To deactivate a native username + password user, the ProviderName value must be Cognito and the ProviderAttributeName must be Cognito_Subject . The ProviderAttributeValue must be the name that is used in the user pool for the user.

The ProviderAttributeName must always be Cognito_Subject for social IdPs. The ProviderAttributeValue must always be the exact subject that was used when the user was originally linked as a source user.

For de-linking a SAML identity, there are two scenarios. If the linked identity has not yet been used to sign in, the ProviderAttributeName and ProviderAttributeValue must be the same values that were used for the SourceUser when the identities were originally linked using AdminLinkProviderForUser call. (If the linking was done with ProviderAttributeName set to Cognito_Subject , the same applies here). However, if the user has already signed in, the ProviderAttributeName must be Cognito_Subject and ProviderAttributeValue must be the subject of the SAML assertion.

See also: AWS API Documentation

Request Syntax

response = client.admin_disable_provider_for_user(
    UserPoolId='string',
    User={
        'ProviderName': 'string',
        'ProviderAttributeName': 'string',
        'ProviderAttributeValue': 'string'
    }
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool.

  • User (dict) --

    [REQUIRED]

    The user to be disabled.

    • ProviderName (string) --

      The name of the provider, such as Facebook, Google, or Login with Amazon.

    • ProviderAttributeName (string) --

      The name of the provider attribute to link to, such as NameID .

    • ProviderAttributeValue (string) --

      The value of the provider attribute to link to, such as xxxxx_account .

Return type

dict

Returns

Response Syntax

{}

Response Structure

  • (dict) --

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.UserNotFoundException
  • CognitoIdentityProvider.Client.exceptions.AliasExistsException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
admin_disable_user(**kwargs)

Disables the specified user.

Calling this action requires developer credentials.

See also: AWS API Documentation

Request Syntax

response = client.admin_disable_user(
    UserPoolId='string',
    Username='string'
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool where you want to disable the user.

  • Username (string) --

    [REQUIRED]

    The user name of the user you want to disable.

Return type

dict

Returns

Response Syntax

{}

Response Structure

  • (dict) --

    Represents the response received from the server to disable the user as an administrator.

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
admin_enable_user(**kwargs)

Enables the specified user as an administrator. Works on any user.

Calling this action requires developer credentials.

See also: AWS API Documentation

Request Syntax

response = client.admin_enable_user(
    UserPoolId='string',
    Username='string'
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool where you want to enable the user.

  • Username (string) --

    [REQUIRED]

    The user name of the user you want to enable.

Return type

dict

Returns

Response Syntax

{}

Response Structure

  • (dict) --

    Represents the response from the server for the request to enable a user as an administrator.

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
admin_forget_device(**kwargs)

Forgets the device, as an administrator.

Calling this action requires developer credentials.

See also: AWS API Documentation

Request Syntax

response = client.admin_forget_device(
    UserPoolId='string',
    Username='string',
    DeviceKey='string'
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID.

  • Username (string) --

    [REQUIRED]

    The user name.

  • DeviceKey (string) --

    [REQUIRED]

    The device key.

Returns

None

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.InvalidUserPoolConfigurationException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.UserNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
admin_get_device(**kwargs)

Gets the device, as an administrator.

Calling this action requires developer credentials.

See also: AWS API Documentation

Request Syntax

response = client.admin_get_device(
    DeviceKey='string',
    UserPoolId='string',
    Username='string'
)
Parameters
  • DeviceKey (string) --

    [REQUIRED]

    The device key.

  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID.

  • Username (string) --

    [REQUIRED]

    The user name.

Return type

dict

Returns

Response Syntax

{
    'Device': {
        'DeviceKey': 'string',
        'DeviceAttributes': [
            {
                'Name': 'string',
                'Value': 'string'
            },
        ],
        'DeviceCreateDate': datetime(2015, 1, 1),
        'DeviceLastModifiedDate': datetime(2015, 1, 1),
        'DeviceLastAuthenticatedDate': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) --

    Gets the device response, as an administrator.

    • Device (dict) --

      The device.

      • DeviceKey (string) --

        The device key.

      • DeviceAttributes (list) --

        The device attributes.

        • (dict) --

          Specifies whether the attribute is standard or custom.

          • Name (string) --

            The name of the attribute.

          • Value (string) --

            The value of the attribute.

      • DeviceCreateDate (datetime) --

        The creation date of the device.

      • DeviceLastModifiedDate (datetime) --

        The last modified date of the device.

      • DeviceLastAuthenticatedDate (datetime) --

        The date when the device was last authenticated.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.InvalidUserPoolConfigurationException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
admin_get_user(**kwargs)

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

Calling this action requires developer credentials.

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 user name of the user about whom you're receiving information.

    • 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 the user was last 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.
      • ARCHIVED - User is no longer active.
      • 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
admin_initiate_auth(**kwargs)

Initiates the authentication flow, as an administrator.

Note

This action might generate an SMS text message. Starting June 1, 2021, US telecom carriers require you to register an origination phone number before you can send SMS messages to US phone numbers. If you use SMS text messages in Amazon Cognito, you must register a phone number with Amazon Pinpoint . Amazon Cognito uses the registered number automatically. Otherwise, Amazon Cognito users who must receive SMS messages might not be able to sign up, activate their accounts, or sign in.

If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Service, Amazon Simple Notification Service might place your account in the SMS sandbox. In * sandbox mode * , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see SMS message settings for Amazon Cognito user pools in the Amazon Cognito Developer Guide .

Calling this action requires developer credentials.

See also: AWS API Documentation

Request Syntax

response = client.admin_initiate_auth(
    UserPoolId='string',
    ClientId='string',
    AuthFlow='USER_SRP_AUTH'|'REFRESH_TOKEN_AUTH'|'REFRESH_TOKEN'|'CUSTOM_AUTH'|'ADMIN_NO_SRP_AUTH'|'USER_PASSWORD_AUTH'|'ADMIN_USER_PASSWORD_AUTH',
    AuthParameters={
        'string': 'string'
    },
    ClientMetadata={
        'string': 'string'
    },
    AnalyticsMetadata={
        'AnalyticsEndpointId': 'string'
    },
    ContextData={
        'IpAddress': 'string',
        'ServerName': 'string',
        'ServerPath': 'string',
        'HttpHeaders': [
            {
                'headerName': 'string',
                'headerValue': 'string'
            },
        ],
        'EncodedData': 'string'
    }
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The ID of the Amazon Cognito user pool.

  • ClientId (string) --

    [REQUIRED]

    The app client ID.

  • AuthFlow (string) --

    [REQUIRED]

    The authentication flow for this call to run. The API action will depend on this value. For example:

    • REFRESH_TOKEN_AUTH will take in a valid refresh token and return new tokens.
    • USER_SRP_AUTH will take in USERNAME and SRP_A and return the Secure Remote Password (SRP) protocol variables to be used for next challenge execution.
    • ADMIN_USER_PASSWORD_AUTH will take in USERNAME and PASSWORD and return the next challenge or tokens.

    Valid values include:

    • USER_SRP_AUTH : Authentication flow for the Secure Remote Password (SRP) protocol.
    • REFRESH_TOKEN_AUTH /REFRESH_TOKEN : Authentication flow for refreshing the access token and ID token by supplying a valid refresh token.
    • CUSTOM_AUTH : Custom authentication flow.
    • ADMIN_NO_SRP_AUTH : Non-SRP authentication flow; you can pass in the USERNAME and PASSWORD directly if the flow is enabled for calling the app client.
    • ADMIN_USER_PASSWORD_AUTH : Admin-based user password authentication. This replaces the ADMIN_NO_SRP_AUTH authentication flow. In this flow, Amazon Cognito receives the password in the request instead of using the SRP process to verify passwords.
  • AuthParameters (dict) --

    The authentication parameters. These are inputs corresponding to the AuthFlow that you're invoking. The required values depend on the value of AuthFlow :

    • For USER_SRP_AUTH : USERNAME (required), SRP_A (required), SECRET_HASH (required if the app client is configured with a client secret), DEVICE_KEY .
    • For REFRESH_TOKEN_AUTH/REFRESH_TOKEN : REFRESH_TOKEN (required), SECRET_HASH (required if the app client is configured with a client secret), DEVICE_KEY .
    • For ADMIN_NO_SRP_AUTH : USERNAME (required), SECRET_HASH (if app client is configured with client secret), PASSWORD (required), DEVICE_KEY .
    • For CUSTOM_AUTH : USERNAME (required), SECRET_HASH (if app client is configured with client secret), DEVICE_KEY . To start the authentication flow with password verification, include ChallengeName: SRP_A and SRP_A: (The SRP_A Value) .
    • (string) --
      • (string) --
  • ClientMetadata (dict) --

    A map of custom key-value pairs that you can provide as input for certain custom workflows that this action triggers.

    You create custom workflows by assigning Lambda functions to user pool triggers. When you use the AdminInitiateAuth API action, Amazon Cognito invokes the Lambda functions that are specified for various triggers. The ClientMetadata value is passed as input to the functions for only the following triggers:

    • Pre signup
    • Pre authentication
    • User migration

    When Amazon Cognito invokes the functions for these triggers, it passes a JSON payload, which the function receives as input. This payload contains a validationData attribute, which provides the data that you assigned to the ClientMetadata parameter in your AdminInitiateAuth request. In your function code in Lambda, you can process the validationData value to enhance your workflow for your specific needs.

    When you use the AdminInitiateAuth API action, Amazon Cognito also invokes the functions for the following triggers, but it doesn't provide the ClientMetadata value as input:

    • Post authentication
    • Custom message
    • Pre token generation
    • Create auth challenge
    • Define auth challenge
    • Verify auth challenge

    For more information, see Customizing user pool Workflows with Lambda Triggers in the Amazon Cognito Developer Guide .

    Note

    When you use the ClientMetadata parameter, remember that Amazon Cognito won't do the following:

    • Store the ClientMetadata value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration doesn't include triggers, the ClientMetadata parameter serves no purpose.
    • Validate the ClientMetadata value.
    • Encrypt the ClientMetadata value. Don't use Amazon Cognito to provide sensitive information.
    • (string) --
      • (string) --
  • AnalyticsMetadata (dict) --

    The analytics metadata for collecting Amazon Pinpoint metrics for AdminInitiateAuth calls.

    • AnalyticsEndpointId (string) --

      The endpoint ID.

  • ContextData (dict) --

    Contextual data about your user session, such as the device fingerprint, IP address, or location. Amazon Cognito advanced security evaluates the risk of an authentication event based on the context that your app generates and passes to Amazon Cognito when it makes API requests.

    • IpAddress (string) -- [REQUIRED]

      The source IP address of your user's device.

    • ServerName (string) -- [REQUIRED]

      Your server endpoint where this API is invoked.

    • ServerPath (string) -- [REQUIRED]

      Your server path where this API is invoked.

    • HttpHeaders (list) -- [REQUIRED]

      HttpHeaders received on your server in same order.

      • (dict) --

        The HTTP header.

        • headerName (string) --

          The header name.

        • headerValue (string) --

          The header value.

    • EncodedData (string) --

      Encoded device-fingerprint details that your app collected with the Amazon Cognito context data collection library. For more information, see Adding user device and session data to API requests .

Return type

dict

Returns

Response Syntax

{
    'ChallengeName': 'SMS_MFA'|'SOFTWARE_TOKEN_MFA'|'SELECT_MFA_TYPE'|'MFA_SETUP'|'PASSWORD_VERIFIER'|'CUSTOM_CHALLENGE'|'DEVICE_SRP_AUTH'|'DEVICE_PASSWORD_VERIFIER'|'ADMIN_NO_SRP_AUTH'|'NEW_PASSWORD_REQUIRED',
    'Session': 'string',
    'ChallengeParameters': {
        'string': 'string'
    },
    'AuthenticationResult': {
        'AccessToken': 'string',
        'ExpiresIn': 123,
        'TokenType': 'string',
        'RefreshToken': 'string',
        'IdToken': 'string',
        'NewDeviceMetadata': {
            'DeviceKey': 'string',
            'DeviceGroupKey': 'string'
        }
    }
}

Response Structure

  • (dict) --

    Initiates the authentication response, as an administrator.

    • ChallengeName (string) --

      The name of the challenge that you're responding to with this call. This is returned in the AdminInitiateAuth response if you must pass another challenge.

      • MFA_SETUP : If MFA is required, users who don't have at least one of the MFA methods set up are presented with an MFA_SETUP challenge. The user must set up at least one MFA type to continue to authenticate.
      • SELECT_MFA_TYPE : Selects the MFA type. Valid MFA options are SMS_MFA for text SMS MFA, and SOFTWARE_TOKEN_MFA for time-based one-time password (TOTP) software token MFA.
      • SMS_MFA : Next challenge is to supply an SMS_MFA_CODE , delivered via SMS.
      • PASSWORD_VERIFIER : Next challenge is to supply PASSWORD_CLAIM_SIGNATURE , PASSWORD_CLAIM_SECRET_BLOCK , and TIMESTAMP after the client-side SRP calculations.
      • CUSTOM_CHALLENGE : This is returned if your custom authentication flow determines that the user should pass another challenge before tokens are issued.
      • DEVICE_SRP_AUTH : If device tracking was activated in your user pool and the previous challenges were passed, this challenge is returned so that Amazon Cognito can start tracking this device.
      • DEVICE_PASSWORD_VERIFIER : Similar to PASSWORD_VERIFIER , but for devices only.
      • ADMIN_NO_SRP_AUTH : This is returned if you must authenticate with USERNAME and PASSWORD directly. An app client must be enabled to use this flow.
      • NEW_PASSWORD_REQUIRED : For users who are required to change their passwords after successful first login. Respond to this challenge with NEW_PASSWORD and any required attributes that Amazon Cognito returned in the requiredAttributes parameter. You can also set values for attributes that aren't required by your user pool and that your app client can write. For more information, see AdminRespondToAuthChallenge .

      Note

      In a NEW_PASSWORD_REQUIRED challenge response, you can't modify a required attribute that already has a value. In AdminRespondToAuthChallenge , set a value for any keys that Amazon Cognito returned in the requiredAttributes parameter, then use the AdminUpdateUserAttributes API operation to modify the value of any additional attributes.

      • MFA_SETUP : For users who are required to set up an MFA factor before they can sign in. The MFA types activated for the user pool will be listed in the challenge parameters MFA_CAN_SETUP value. To set up software token MFA, use the session returned here from InitiateAuth as an input to AssociateSoftwareToken , and use the session returned by VerifySoftwareToken as an input to RespondToAuthChallenge with challenge name MFA_SETUP to complete sign-in. To set up SMS MFA, users will need help from an administrator to add a phone number to their account and then call InitiateAuth again to restart sign-in.
    • Session (string) --

      The session that should be passed both ways in challenge-response calls to the service. If AdminInitiateAuth or AdminRespondToAuthChallenge API call determines that the caller must pass another challenge, they return a session with other challenge parameters. This session should be passed as it is to the next AdminRespondToAuthChallenge API call.

    • ChallengeParameters (dict) --

      The challenge parameters. These are returned to you in the AdminInitiateAuth response if you must pass another challenge. The responses in this parameter should be used to compute inputs to the next call (AdminRespondToAuthChallenge ).

      All challenges require USERNAME and SECRET_HASH (if applicable).

      The value of the USER_ID_FOR_SRP attribute is the user's actual username, not an alias (such as email address or phone number), even if you specified an alias in your call to AdminInitiateAuth . This happens because, in the AdminRespondToAuthChallenge API ChallengeResponses , the USERNAME attribute can't be an alias.

      • (string) --
        • (string) --
    • AuthenticationResult (dict) --

      The result of the authentication response. This is only returned if the caller doesn't need to pass another challenge. If the caller does need to pass another challenge before it gets tokens, ChallengeName , ChallengeParameters , and Session are returned.

      • AccessToken (string) --

        A valid access token that Amazon Cognito issued to the user who you want to authenticate.

      • ExpiresIn (integer) --

        The expiration period of the authentication result in seconds.

      • TokenType (string) --

        The token type.

      • RefreshToken (string) --

        The refresh token.

      • IdToken (string) --

        The ID token.

      • NewDeviceMetadata (dict) --

        The new device metadata from an authentication result.

        • DeviceKey (string) --

          The device key.

        • DeviceGroupKey (string) --

          The device group key.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
  • CognitoIdentityProvider.Client.exceptions.UnexpectedLambdaException
  • CognitoIdentityProvider.Client.exceptions.InvalidUserPoolConfigurationException
  • CognitoIdentityProvider.Client.exceptions.UserLambdaValidationException
  • CognitoIdentityProvider.Client.exceptions.InvalidLambdaResponseException
  • CognitoIdentityProvider.Client.exceptions.MFAMethodNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidSmsRoleAccessPolicyException
  • CognitoIdentityProvider.Client.exceptions.InvalidSmsRoleTrustRelationshipException
  • CognitoIdentityProvider.Client.exceptions.PasswordResetRequiredException
  • CognitoIdentityProvider.Client.exceptions.UserNotFoundException
  • CognitoIdentityProvider.Client.exceptions.UserNotConfirmedException

Links an existing user account in a user pool (DestinationUser ) to an identity from an external IdP (SourceUser ) based on a specified attribute name and value from the external IdP. This allows you to create a link from the existing user account to an external federated user identity that has not yet been used to sign in. You can then use the federated user identity to sign in as the existing user account.

For example, if there is an existing user with a username and password, this API links that user to a federated user identity. When the user signs in with a federated user identity, they sign in as the existing user account.

Note

The maximum number of federated identities linked to a user is five.

Warning

Because this API allows a user with an external federated identity to sign in as an existing user in the user pool, it is critical that it only be used with external IdPs and provider attributes that have been trusted by the application owner.

This action is administrative and requires developer credentials.

See also: AWS API Documentation

Request Syntax

response = client.admin_link_provider_for_user(
    UserPoolId='string',
    DestinationUser={
        'ProviderName': 'string',
        'ProviderAttributeName': 'string',
        'ProviderAttributeValue': 'string'
    },
    SourceUser={
        'ProviderName': 'string',
        'ProviderAttributeName': 'string',
        'ProviderAttributeValue': 'string'
    }
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool.

  • DestinationUser (dict) --

    [REQUIRED]

    The existing user in the user pool that you want to assign to the external IdP user account. This user can be a native (Username + Password) Amazon Cognito user pools user or a federated user (for example, a SAML or Facebook user). If the user doesn't exist, Amazon Cognito generates an exception. Amazon Cognito returns this user when the new user (with the linked IdP attribute) signs in.

    For a native username + password user, the ProviderAttributeValue for the DestinationUser should be the username in the user pool. For a federated user, it should be the provider-specific user_id .

    The ProviderAttributeName of the DestinationUser is ignored.

    The ProviderName should be set to Cognito for users in Cognito user pools.

    Warning

    All attributes in the DestinationUser profile must be mutable. If you have assigned the user any immutable custom attributes, the operation won't succeed.

    • ProviderName (string) --

      The name of the provider, such as Facebook, Google, or Login with Amazon.

    • ProviderAttributeName (string) --

      The name of the provider attribute to link to, such as NameID .

    • ProviderAttributeValue (string) --

      The value of the provider attribute to link to, such as xxxxx_account .

  • SourceUser (dict) --

    [REQUIRED]

    An external IdP account for a user who doesn't exist yet in the user pool. This user must be a federated user (for example, a SAML or Facebook user), not another native user.

    If the SourceUser is using a federated social IdP, such as Facebook, Google, or Login with Amazon, you must set the ProviderAttributeName to Cognito_Subject . For social IdPs, the ProviderName will be Facebook , Google , or LoginWithAmazon , and Amazon Cognito will automatically parse the Facebook, Google, and Login with Amazon tokens for id , sub , and user_id , respectively. The ProviderAttributeValue for the user must be the same value as the id , sub , or user_id value found in the social IdP token.

    For SAML, the ProviderAttributeName can be any value that matches a claim in the SAML assertion. If you want to link SAML users based on the subject of the SAML assertion, you should map the subject to a claim through the SAML IdP and submit that claim name as the ProviderAttributeName . If you set ProviderAttributeName to Cognito_Subject , Amazon Cognito will automatically parse the default unique identifier found in the subject from the SAML token.

    • ProviderName (string) --

      The name of the provider, such as Facebook, Google, or Login with Amazon.

    • ProviderAttributeName (string) --

      The name of the provider attribute to link to, such as NameID .

    • ProviderAttributeValue (string) --

      The value of the provider attribute to link to, such as xxxxx_account .

Return type

dict

Returns

Response Syntax

{}

Response Structure

  • (dict) --

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.UserNotFoundException
  • CognitoIdentityProvider.Client.exceptions.AliasExistsException
  • CognitoIdentityProvider.Client.exceptions.LimitExceededException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
admin_list_devices(**kwargs)

Lists devices, as an administrator.

Calling this action requires developer credentials.

See also: AWS API Documentation

Request Syntax

response = client.admin_list_devices(
    UserPoolId='string',
    Username='string',
    Limit=123,
    PaginationToken='string'
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID.

  • Username (string) --

    [REQUIRED]

    The user name.

  • Limit (integer) -- The limit of the devices request.
  • PaginationToken (string) -- The pagination token.
Return type

dict

Returns

Response Syntax

{
    'Devices': [
        {
            'DeviceKey': 'string',
            'DeviceAttributes': [
                {
                    'Name': 'string',
                    'Value': 'string'
                },
            ],
            'DeviceCreateDate': datetime(2015, 1, 1),
            'DeviceLastModifiedDate': datetime(2015, 1, 1),
            'DeviceLastAuthenticatedDate': datetime(2015, 1, 1)
        },
    ],
    'PaginationToken': 'string'
}

Response Structure

  • (dict) --

    Lists the device's response, as an administrator.

    • Devices (list) --

      The devices in the list of devices response.

      • (dict) --

        The device type.

        • DeviceKey (string) --

          The device key.

        • DeviceAttributes (list) --

          The device attributes.

          • (dict) --

            Specifies whether the attribute is standard or custom.

            • Name (string) --

              The name of the attribute.

            • Value (string) --

              The value of the attribute.

        • DeviceCreateDate (datetime) --

          The creation date of the device.

        • DeviceLastModifiedDate (datetime) --

          The last modified date of the device.

        • DeviceLastAuthenticatedDate (datetime) --

          The date when the device was last authenticated.

    • PaginationToken (string) --

      The pagination token.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidUserPoolConfigurationException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
admin_list_groups_for_user(**kwargs)

Lists the groups that the user belongs to.

Calling this action requires developer credentials.

See also: AWS API Documentation

Request Syntax

response = client.admin_list_groups_for_user(
    Username='string',
    UserPoolId='string',
    Limit=123,
    NextToken='string'
)
Parameters
  • Username (string) --

    [REQUIRED]

    The username for the user.

  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool.

  • Limit (integer) -- The limit of the request to list groups.
  • NextToken (string) -- An identifier that was returned from the previous call to this operation, which can be used to return the next set of items in the list.
Return type

dict

Returns

Response Syntax

{
    'Groups': [
        {
            'GroupName': 'string',
            'UserPoolId': 'string',
            'Description': 'string',
            'RoleArn': 'string',
            'Precedence': 123,
            'LastModifiedDate': datetime(2015, 1, 1),
            'CreationDate': datetime(2015, 1, 1)
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • Groups (list) --

      The groups that the user belongs to.

      • (dict) --

        The group type.

        • GroupName (string) --

          The name of the group.

        • UserPoolId (string) --

          The user pool ID for the user pool.

        • Description (string) --

          A string containing the description of the group.

        • RoleArn (string) --

          The role Amazon Resource Name (ARN) for the group.

        • Precedence (integer) --

          A non-negative integer value that specifies the precedence of this group relative to the other groups that a user can belong to in the user pool. Zero is the highest precedence value. Groups with lower Precedence values take precedence over groups with higher ornull Precedence values. If a user belongs to two or more groups, it is the group with the lowest precedence value whose role ARN is given in the user's tokens for the cognito:roles and cognito:preferred_role claims.

          Two groups can have the same Precedence value. If this happens, neither group takes precedence over the other. If two groups with the same Precedence have the same role ARN, that role is used in the cognito:preferred_role claim in tokens for users in each group. If the two groups have different role ARNs, the cognito:preferred_role claim isn't set in users' tokens.

          The default Precedence value is null.

        • LastModifiedDate (datetime) --

          The date the group was last modified.

        • CreationDate (datetime) --

          The date the group was created.

    • NextToken (string) --

      An identifier that was returned from the previous call to this operation, which can be used to return the next set of items in the list.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.UserNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
admin_list_user_auth_events(**kwargs)

A history of user activity and any risks detected as part of Amazon Cognito advanced security.

See also: AWS API Documentation

Request Syntax

response = client.admin_list_user_auth_events(
    UserPoolId='string',
    Username='string',
    MaxResults=123,
    NextToken='string'
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID.

  • Username (string) --

    [REQUIRED]

    The user pool username or an alias.

  • MaxResults (integer) -- The maximum number of authentication events to return.
  • NextToken (string) -- A pagination token.
Return type

dict

Returns

Response Syntax

{
    'AuthEvents': [
        {
            'EventId': 'string',
            'EventType': 'SignIn'|'SignUp'|'ForgotPassword'|'PasswordChange'|'ResendCode',
            'CreationDate': datetime(2015, 1, 1),
            'EventResponse': 'Pass'|'Fail'|'InProgress',
            'EventRisk': {
                'RiskDecision': 'NoRisk'|'AccountTakeover'|'Block',
                'RiskLevel': 'Low'|'Medium'|'High',
                'CompromisedCredentialsDetected': True|False
            },
            'ChallengeResponses': [
                {
                    'ChallengeName': 'Password'|'Mfa',
                    'ChallengeResponse': 'Success'|'Failure'
                },
            ],
            'EventContextData': {
                'IpAddress': 'string',
                'DeviceName': 'string',
                'Timezone': 'string',
                'City': 'string',
                'Country': 'string'
            },
            'EventFeedback': {
                'FeedbackValue': 'Valid'|'Invalid',
                'Provider': 'string',
                'FeedbackDate': datetime(2015, 1, 1)
            }
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • AuthEvents (list) --

      The response object. It includes the EventID , EventType , CreationDate , EventRisk , and EventResponse .

      • (dict) --

        The authentication event type.

        • EventId (string) --

          The event ID.

        • EventType (string) --

          The event type.

        • CreationDate (datetime) --

          The creation date

        • EventResponse (string) --

          The event response.

        • EventRisk (dict) --

          The event risk.

          • RiskDecision (string) --

            The risk decision.

          • RiskLevel (string) --

            The risk level.

          • CompromisedCredentialsDetected (boolean) --

            Indicates whether compromised credentials were detected during an authentication event.

        • ChallengeResponses (list) --

          The challenge responses.

          • (dict) --

            The challenge response type.

            • ChallengeName (string) --

              The challenge name.

            • ChallengeResponse (string) --

              The challenge response.

        • EventContextData (dict) --

          The user context data captured at the time of an event request. This value provides additional information about the client from which event the request is received.

          • IpAddress (string) --

            The source IP address of your user's device.

          • DeviceName (string) --

            The user's device name.

          • Timezone (string) --

            The user's time zone.

          • City (string) --

            The user's city.

          • Country (string) --

            The user's country.

        • EventFeedback (dict) --

          A flag specifying the user feedback captured at the time of an event request is good or bad.

          • FeedbackValue (string) --

            The event feedback value.

          • Provider (string) --

            The provider.

          • FeedbackDate (datetime) --

            The event feedback date.

    • NextToken (string) --

      A pagination token.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.UserNotFoundException
  • CognitoIdentityProvider.Client.exceptions.UserPoolAddOnNotEnabledException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
admin_remove_user_from_group(**kwargs)

Removes the specified user from the specified group.

Calling this action requires developer credentials.

See also: AWS API Documentation

Request Syntax

response = client.admin_remove_user_from_group(
    UserPoolId='string',
    Username='string',
    GroupName='string'
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool.

  • Username (string) --

    [REQUIRED]

    The username for the user.

  • GroupName (string) --

    [REQUIRED]

    The group name.

Returns

None

Exceptions

  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.UserNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
admin_reset_user_password(**kwargs)

Resets the specified user's password in a user pool as an administrator. Works on any user.

When a developer calls this API, the current password is invalidated, so it must be changed. If a user tries to sign in after the API is called, the app will get a PasswordResetRequiredException exception back and should direct the user down the flow to reset the password, which is the same as the forgot password flow. In addition, if the user pool has phone verification selected and a verified phone number exists for the user, or if email verification is selected and a verified email exists for the user, calling this API will also result in sending a message to the end user with the code to change their password.

Note

This action might generate an SMS text message. Starting June 1, 2021, US telecom carriers require you to register an origination phone number before you can send SMS messages to US phone numbers. If you use SMS text messages in Amazon Cognito, you must register a phone number with Amazon Pinpoint . Amazon Cognito uses the registered number automatically. Otherwise, Amazon Cognito users who must receive SMS messages might not be able to sign up, activate their accounts, or sign in.

If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Service, Amazon Simple Notification Service might place your account in the SMS sandbox. In * sandbox mode * , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see SMS message settings for Amazon Cognito user pools in the Amazon Cognito Developer Guide .

Calling this action requires developer credentials.

See also: AWS API Documentation

Request Syntax

response = client.admin_reset_user_password(
    UserPoolId='string',
    Username='string',
    ClientMetadata={
        'string': 'string'
    }
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool where you want to reset the user's password.

  • Username (string) --

    [REQUIRED]

    The user name of the user whose password you want to reset.

  • ClientMetadata (dict) --

    A map of custom key-value pairs that you can provide as input for any custom workflows that this action triggers.

    You create custom workflows by assigning Lambda functions to user pool triggers. When you use the AdminResetUserPassword API action, Amazon Cognito invokes the function that is assigned to the custom message trigger. When Amazon Cognito invokes this function, it passes a JSON payload, which the function receives as input. This payload contains a clientMetadata attribute, which provides the data that you assigned to the ClientMetadata parameter in your AdminResetUserPassword request. In your function code in Lambda, you can process the clientMetadata value to enhance your workflow for your specific needs.

    For more information, see Customizing user pool Workflows with Lambda Triggers in the Amazon Cognito Developer Guide .

    Note

    When you use the ClientMetadata parameter, remember that Amazon Cognito won't do the following:

    • Store the ClientMetadata value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration doesn't include triggers, the ClientMetadata parameter serves no purpose.
    • Validate the ClientMetadata value.
    • Encrypt the ClientMetadata value. Don't use Amazon Cognito to provide sensitive information.
    • (string) --
      • (string) --
Return type

dict

Returns

Response Syntax

{}

Response Structure

  • (dict) --

    Represents the response from the server to reset a user password as an administrator.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.UnexpectedLambdaException
  • CognitoIdentityProvider.Client.exceptions.UserLambdaValidationException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.InvalidLambdaResponseException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.LimitExceededException
  • CognitoIdentityProvider.Client.exceptions.UserNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidSmsRoleAccessPolicyException
  • CognitoIdentityProvider.Client.exceptions.InvalidEmailRoleAccessPolicyException
  • CognitoIdentityProvider.Client.exceptions.InvalidSmsRoleTrustRelationshipException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
admin_respond_to_auth_challenge(**kwargs)

Responds to an authentication challenge, as an administrator.

Note

This action might generate an SMS text message. Starting June 1, 2021, US telecom carriers require you to register an origination phone number before you can send SMS messages to US phone numbers. If you use SMS text messages in Amazon Cognito, you must register a phone number with Amazon Pinpoint . Amazon Cognito uses the registered number automatically. Otherwise, Amazon Cognito users who must receive SMS messages might not be able to sign up, activate their accounts, or sign in.

If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Service, Amazon Simple Notification Service might place your account in the SMS sandbox. In * sandbox mode * , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see SMS message settings for Amazon Cognito user pools in the Amazon Cognito Developer Guide .

Calling this action requires developer credentials.

See also: AWS API Documentation

Request Syntax

response = client.admin_respond_to_auth_challenge(
    UserPoolId='string',
    ClientId='string',
    ChallengeName='SMS_MFA'|'SOFTWARE_TOKEN_MFA'|'SELECT_MFA_TYPE'|'MFA_SETUP'|'PASSWORD_VERIFIER'|'CUSTOM_CHALLENGE'|'DEVICE_SRP_AUTH'|'DEVICE_PASSWORD_VERIFIER'|'ADMIN_NO_SRP_AUTH'|'NEW_PASSWORD_REQUIRED',
    ChallengeResponses={
        'string': 'string'
    },
    Session='string',
    AnalyticsMetadata={
        'AnalyticsEndpointId': 'string'
    },
    ContextData={
        'IpAddress': 'string',
        'ServerName': 'string',
        'ServerPath': 'string',
        'HttpHeaders': [
            {
                'headerName': 'string',
                'headerValue': 'string'
            },
        ],
        'EncodedData': 'string'
    },
    ClientMetadata={
        'string': 'string'
    }
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The ID of the Amazon Cognito user pool.

  • ClientId (string) --

    [REQUIRED]

    The app client ID.

  • ChallengeName (string) --

    [REQUIRED]

    The challenge name. For more information, see AdminInitiateAuth .

  • ChallengeResponses (dict) --

    The challenge responses. These are inputs corresponding to the value of ChallengeName , for example:

    • SMS_MFA : SMS_MFA_CODE , USERNAME , SECRET_HASH (if app client is configured with client secret).
    • PASSWORD_VERIFIER : PASSWORD_CLAIM_SIGNATURE , PASSWORD_CLAIM_SECRET_BLOCK , TIMESTAMP , USERNAME , SECRET_HASH (if app client is configured with client secret).

    Note

    PASSWORD_VERIFIER requires DEVICE_KEY when signing in with a remembered device.

    • ADMIN_NO_SRP_AUTH : PASSWORD , USERNAME , SECRET_HASH (if app client is configured with client secret).
    • NEW_PASSWORD_REQUIRED : NEW_PASSWORD , USERNAME , SECRET_HASH (if app client is configured with client secret). To set any required attributes that Amazon Cognito returned as requiredAttributes in the AdminInitiateAuth response, add a ``userAttributes.*attributename* `` parameter. This parameter can also set values for writable attributes that aren't required by your user pool.

    Note

    In a NEW_PASSWORD_REQUIRED challenge response, you can't modify a required attribute that already has a value. In AdminRespondToAuthChallenge , set a value for any keys that Amazon Cognito returned in the requiredAttributes parameter, then use the AdminUpdateUserAttributes API operation to modify the value of any additional attributes.

    • MFA_SETUP requires USERNAME , plus you must use the session value returned by VerifySoftwareToken in the Session parameter.

    The value of the USERNAME attribute must be the user's actual username, not an alias (such as an email address or phone number). To make this simpler, the AdminInitiateAuth response includes the actual username value in the USERNAMEUSER_ID_FOR_SRP attribute. This happens even if you specified an alias in your call to AdminInitiateAuth .

    • (string) --
      • (string) --
  • Session (string) -- The session that should be passed both ways in challenge-response calls to the service. If an InitiateAuth or RespondToAuthChallenge API call determines that the caller must pass another challenge, it returns a session with other challenge parameters. This session should be passed as it is to the next RespondToAuthChallenge API call.
  • AnalyticsMetadata (dict) --

    The analytics metadata for collecting Amazon Pinpoint metrics for AdminRespondToAuthChallenge calls.

    • AnalyticsEndpointId (string) --

      The endpoint ID.

  • ContextData (dict) --

    Contextual data about your user session, such as the device fingerprint, IP address, or location. Amazon Cognito advanced security evaluates the risk of an authentication event based on the context that your app generates and passes to Amazon Cognito when it makes API requests.

    • IpAddress (string) -- [REQUIRED]

      The source IP address of your user's device.

    • ServerName (string) -- [REQUIRED]

      Your server endpoint where this API is invoked.

    • ServerPath (string) -- [REQUIRED]

      Your server path where this API is invoked.

    • HttpHeaders (list) -- [REQUIRED]

      HttpHeaders received on your server in same order.

      • (dict) --

        The HTTP header.

        • headerName (string) --

          The header name.

        • headerValue (string) --

          The header value.

    • EncodedData (string) --

      Encoded device-fingerprint details that your app collected with the Amazon Cognito context data collection library. For more information, see Adding user device and session data to API requests .

  • ClientMetadata (dict) --

    A map of custom key-value pairs that you can provide as input for any custom workflows that this action triggers.

    You create custom workflows by assigning Lambda functions to user pool triggers. When you use the AdminRespondToAuthChallenge API action, Amazon Cognito invokes any functions that you have assigned to the following triggers:

    • pre sign-up
    • custom message
    • post authentication
    • user migration
    • pre token generation
    • define auth challenge
    • create auth challenge
    • verify auth challenge response

    When Amazon Cognito invokes any of these functions, it passes a JSON payload, which the function receives as input. This payload contains a clientMetadata attribute that provides the data that you assigned to the ClientMetadata parameter in your AdminRespondToAuthChallenge request. In your function code in Lambda, you can process the clientMetadata value to enhance your workflow for your specific needs.

    For more information, see Customizing user pool Workflows with Lambda Triggers in the Amazon Cognito Developer Guide .

    Note

    When you use the ClientMetadata parameter, remember that Amazon Cognito won't do the following:

    • Store the ClientMetadata value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration doesn't include triggers, the ClientMetadata parameter serves no purpose.
    • Validate the ClientMetadata value.
    • Encrypt the ClientMetadata value. Don't use Amazon Cognito to provide sensitive information.
    • (string) --
      • (string) --
Return type

dict

Returns

Response Syntax

{
    'ChallengeName': 'SMS_MFA'|'SOFTWARE_TOKEN_MFA'|'SELECT_MFA_TYPE'|'MFA_SETUP'|'PASSWORD_VERIFIER'|'CUSTOM_CHALLENGE'|'DEVICE_SRP_AUTH'|'DEVICE_PASSWORD_VERIFIER'|'ADMIN_NO_SRP_AUTH'|'NEW_PASSWORD_REQUIRED',
    'Session': 'string',
    'ChallengeParameters': {
        'string': 'string'
    },
    'AuthenticationResult': {
        'AccessToken': 'string',
        'ExpiresIn': 123,
        'TokenType': 'string',
        'RefreshToken': 'string',
        'IdToken': 'string',
        'NewDeviceMetadata': {
            'DeviceKey': 'string',
            'DeviceGroupKey': 'string'
        }
    }
}

Response Structure

  • (dict) --

    Responds to the authentication challenge, as an administrator.

    • ChallengeName (string) --

      The name of the challenge. For more information, see AdminInitiateAuth .

    • Session (string) --

      The session that should be passed both ways in challenge-response calls to the service. If the caller must pass another challenge, they return a session with other challenge parameters. This session should be passed as it is to the next RespondToAuthChallenge API call.

    • ChallengeParameters (dict) --

      The challenge parameters. For more information, see AdminInitiateAuth .

      • (string) --
        • (string) --
    • AuthenticationResult (dict) --

      The result returned by the server in response to the authentication request.

      • AccessToken (string) --

        A valid access token that Amazon Cognito issued to the user who you want to authenticate.

      • ExpiresIn (integer) --

        The expiration period of the authentication result in seconds.

      • TokenType (string) --

        The token type.

      • RefreshToken (string) --

        The refresh token.

      • IdToken (string) --

        The ID token.

      • NewDeviceMetadata (dict) --

        The new device metadata from an authentication result.

        • DeviceKey (string) --

          The device key.

        • DeviceGroupKey (string) --

          The device group key.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.CodeMismatchException
  • CognitoIdentityProvider.Client.exceptions.ExpiredCodeException
  • CognitoIdentityProvider.Client.exceptions.UnexpectedLambdaException
  • CognitoIdentityProvider.Client.exceptions.InvalidPasswordException
  • CognitoIdentityProvider.Client.exceptions.UserLambdaValidationException
  • CognitoIdentityProvider.Client.exceptions.InvalidLambdaResponseException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.InvalidUserPoolConfigurationException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
  • CognitoIdentityProvider.Client.exceptions.MFAMethodNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidSmsRoleAccessPolicyException
  • CognitoIdentityProvider.Client.exceptions.InvalidSmsRoleTrustRelationshipException
  • CognitoIdentityProvider.Client.exceptions.AliasExistsException
  • CognitoIdentityProvider.Client.exceptions.PasswordResetRequiredException
  • CognitoIdentityProvider.Client.exceptions.UserNotFoundException
  • CognitoIdentityProvider.Client.exceptions.UserNotConfirmedException
  • CognitoIdentityProvider.Client.exceptions.SoftwareTokenMFANotFoundException
admin_set_user_mfa_preference(**kwargs)

The user's multi-factor authentication (MFA) preference, including which MFA options are activated, and if any are preferred. Only one factor can be set as preferred. The preferred MFA factor will be used to authenticate a user if multiple factors are activated. If multiple options are activated and no preference is set, a challenge to choose an MFA option will be returned during sign-in.

See also: AWS API Documentation

Request Syntax

response = client.admin_set_user_mfa_preference(
    SMSMfaSettings={
        'Enabled': True|False,
        'PreferredMfa': True|False
    },
    SoftwareTokenMfaSettings={
        'Enabled': True|False,
        'PreferredMfa': True|False
    },
    Username='string',
    UserPoolId='string'
)
Parameters
  • SMSMfaSettings (dict) --

    The SMS text message MFA settings.

    • Enabled (boolean) --

      Specifies whether SMS text message MFA is activated. If an MFA type is activated for a user, the user will be prompted for MFA during all sign-in attempts, unless device tracking is turned on and the device has been trusted.

    • PreferredMfa (boolean) --

      Specifies whether SMS is the preferred MFA method.

  • SoftwareTokenMfaSettings (dict) --

    The time-based one-time password software token MFA settings.

    • Enabled (boolean) --

      Specifies whether software token MFA is activated. If an MFA type is activated for a user, the user will be prompted for MFA during all sign-in attempts, unless device tracking is turned on and the device has been trusted.

    • PreferredMfa (boolean) --

      Specifies whether software token MFA is the preferred MFA method.

  • Username (string) --

    [REQUIRED]

    The user pool username or alias.

  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID.

Return type

dict

Returns

Response Syntax

{}

Response Structure

  • (dict) --

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.PasswordResetRequiredException
  • CognitoIdentityProvider.Client.exceptions.UserNotFoundException
  • CognitoIdentityProvider.Client.exceptions.UserNotConfirmedException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
admin_set_user_password(**kwargs)

Sets the specified user's password in a user pool as an administrator. Works on any user.

The password can be temporary or permanent. If it is temporary, the user status enters the FORCE_CHANGE_PASSWORD state. When the user next tries to sign in, the InitiateAuth/AdminInitiateAuth response will contain the NEW_PASSWORD_REQUIRED challenge. If the user doesn't sign in before it expires, the user won't be able to sign in, and an administrator must reset their password.

Once the user has set a new password, or the password is permanent, the user status is set to Confirmed .

See also: AWS API Documentation

Request Syntax

response = client.admin_set_user_password(
    UserPoolId='string',
    Username='string',
    Password='string',
    Permanent=True|False
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool where you want to set the user's password.

  • Username (string) --

    [REQUIRED]

    The user name of the user whose password you want to set.

  • Password (string) --

    [REQUIRED]

    The password for the user.

  • Permanent (boolean) -- True if the password is permanent, False if it is temporary.
Return type

dict

Returns

Response Syntax

{}

Response Structure

  • (dict) --

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.UserNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.InvalidPasswordException
admin_set_user_settings(**kwargs)
This action is no longer supported. You can use it to configure only SMS MFA. You can't use it to configure time-based one-time password (TOTP) software token MFA. To configure either type of MFA, use AdminSetUserMFAPreference instead.

See also: AWS API Documentation

Request Syntax

response = client.admin_set_user_settings(
    UserPoolId='string',
    Username='string',
    MFAOptions=[
        {
            'DeliveryMedium': 'SMS'|'EMAIL',
            'AttributeName': 'string'
        },
    ]
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The ID of the user pool that contains the user whose options you're setting.

  • Username (string) --

    [REQUIRED]

    The user name of the user whose options you're setting.

  • MFAOptions (list) --

    [REQUIRED]

    You can use this parameter only to set an SMS configuration that uses SMS for delivery.

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

Return type

dict

Returns

Response Syntax

{}

Response Structure

  • (dict) --

    Represents the response from the server to set user settings as an administrator.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.UserNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
admin_update_auth_event_feedback(**kwargs)

Provides feedback for an authentication event indicating if it was from a valid user. This feedback is used for improving the risk evaluation decision for the user pool as part of Amazon Cognito advanced security.

See also: AWS API Documentation

Request Syntax

response = client.admin_update_auth_event_feedback(
    UserPoolId='string',
    Username='string',
    EventId='string',
    FeedbackValue='Valid'|'Invalid'
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID.

  • Username (string) --

    [REQUIRED]

    The user pool username.

  • EventId (string) --

    [REQUIRED]

    The authentication event ID.

  • FeedbackValue (string) --

    [REQUIRED]

    The authentication event feedback value.

Return type

dict

Returns

Response Syntax

{}

Response Structure

  • (dict) --

Exceptions

  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.UserNotFoundException
  • CognitoIdentityProvider.Client.exceptions.UserPoolAddOnNotEnabledException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
admin_update_device_status(**kwargs)

Updates the device status as an administrator.

Calling this action requires developer credentials.

See also: AWS API Documentation

Request Syntax

response = client.admin_update_device_status(
    UserPoolId='string',
    Username='string',
    DeviceKey='string',
    DeviceRememberedStatus='remembered'|'not_remembered'
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID.

  • Username (string) --

    [REQUIRED]

    The user name.

  • DeviceKey (string) --

    [REQUIRED]

    The device key.

  • DeviceRememberedStatus (string) -- The status indicating whether a device has been remembered or not.
Return type

dict

Returns

Response Syntax

{}

Response Structure

  • (dict) --

    The status response to the request to update the device, as an administrator.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidUserPoolConfigurationException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.UserNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
admin_update_user_attributes(**kwargs)

Updates the specified user's attributes, including developer attributes, as an administrator. Works on any user.

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

In addition to updating user attributes, this API can also be used to mark phone and email as verified.

Note

This action might generate an SMS text message. Starting June 1, 2021, US telecom carriers require you to register an origination phone number before you can send SMS messages to US phone numbers. If you use SMS text messages in Amazon Cognito, you must register a phone number with Amazon Pinpoint . Amazon Cognito uses the registered number automatically. Otherwise, Amazon Cognito users who must receive SMS messages might not be able to sign up, activate their accounts, or sign in.

If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Service, Amazon Simple Notification Service might place your account in the SMS sandbox. In * sandbox mode * , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see SMS message settings for Amazon Cognito user pools in the Amazon Cognito Developer Guide .

Calling this action requires developer credentials.

See also: AWS API Documentation

Request Syntax

response = client.admin_update_user_attributes(
    UserPoolId='string',
    Username='string',
    UserAttributes=[
        {
            'Name': 'string',
            'Value': 'string'
        },
    ],
    ClientMetadata={
        'string': 'string'
    }
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool where you want to update user attributes.

  • Username (string) --

    [REQUIRED]

    The user name of the user for whom you want to update user attributes.

  • UserAttributes (list) --

    [REQUIRED]

    An array of name-value pairs representing user attributes.

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

    If your user pool requires verification before Amazon Cognito updates an attribute value that you specify in this request, Amazon Cognito doesn’t immediately update the value of that attribute. After your user receives and responds to a verification message to verify the new value, Amazon Cognito updates the attribute value. Your user can sign in and receive messages with the original attribute value until they verify the new value.

    To update the value of an attribute that requires verification in the same API request, include the email_verified or phone_number_verified attribute, with a value of true . If you set the email_verified or phone_number_verified value for an email or phone_number attribute that requires verification to true , Amazon Cognito doesn’t send a verification message to your user.

    • (dict) --

      Specifies whether the attribute is standard or custom.

      • Name (string) -- [REQUIRED]

        The name of the attribute.

      • Value (string) --

        The value of the attribute.

  • ClientMetadata (dict) --

    A map of custom key-value pairs that you can provide as input for any custom workflows that this action triggers.

    You create custom workflows by assigning Lambda functions to user pool triggers. When you use the AdminUpdateUserAttributes API action, Amazon Cognito invokes the function that is assigned to the custom message trigger. When Amazon Cognito invokes this function, it passes a JSON payload, which the function receives as input. This payload contains a clientMetadata attribute, which provides the data that you assigned to the ClientMetadata parameter in your AdminUpdateUserAttributes request. In your function code in Lambda, you can process the clientMetadata value to enhance your workflow for your specific needs.

    For more information, see Customizing user pool Workflows with Lambda Triggers in the Amazon Cognito Developer Guide .

    Note

    When you use the ClientMetadata parameter, remember that Amazon Cognito won't do the following:

    • Store the ClientMetadata value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration doesn't include triggers, the ClientMetadata parameter serves no purpose.
    • Validate the ClientMetadata value.
    • Encrypt the ClientMetadata value. Don't use Amazon Cognito to provide sensitive information.
    • (string) --
      • (string) --
Return type

dict

Returns

Response Syntax

{}

Response Structure

  • (dict) --

    Represents the response from the server for the request to update user attributes as an administrator.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.UnexpectedLambdaException
  • CognitoIdentityProvider.Client.exceptions.UserLambdaValidationException
  • CognitoIdentityProvider.Client.exceptions.InvalidLambdaResponseException
  • CognitoIdentityProvider.Client.exceptions.AliasExistsException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.UserNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
  • CognitoIdentityProvider.Client.exceptions.InvalidSmsRoleAccessPolicyException
  • CognitoIdentityProvider.Client.exceptions.InvalidEmailRoleAccessPolicyException
  • CognitoIdentityProvider.Client.exceptions.InvalidSmsRoleTrustRelationshipException
admin_user_global_sign_out(**kwargs)

Signs out a user from all devices. You must sign AdminUserGlobalSignOut requests with Amazon Web Services credentials. It also invalidates all refresh tokens that Amazon Cognito has issued to a user. The user's current access and ID tokens remain valid until they expire. By default, access and ID tokens expire one hour after they're issued. A user can still use a hosted UI cookie to retrieve new tokens for the duration of the cookie validity period of 1 hour.

Calling this action requires developer credentials.

See also: AWS API Documentation

Request Syntax

response = client.admin_user_global_sign_out(
    UserPoolId='string',
    Username='string'
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID.

  • Username (string) --

    [REQUIRED]

    The user name.

Return type

dict

Returns

Response Syntax

{}

Response Structure

  • (dict) --

    The global sign-out response, as an administrator.

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
associate_software_token(**kwargs)

Begins setup of time-based one-time password (TOTP) multi-factor authentication (MFA) for a user, with a unique private key that Amazon Cognito generates and returns in the API response. You can authorize an AssociateSoftwareToken request with either the user's access token, or a session string from a challenge response that you received from Amazon Cognito.

Note

Amazon Cognito disassociates an existing software token when you verify the new token in a VerifySoftwareToken API request. If you don't verify the software token and your user pool doesn't require MFA, the user can then authenticate with user name and password credentials alone. If your user pool requires TOTP MFA, Amazon Cognito generates an MFA_SETUP or SOFTWARE_TOKEN_SETUP challenge each time your user signs. Complete setup with AssociateSoftwareToken and VerifySoftwareToken .

After you set up software token MFA for your user, Amazon Cognito generates a SOFTWARE_TOKEN_MFA challenge when they authenticate. Respond to this challenge with your user's TOTP.

See also: AWS API Documentation

Request Syntax

response = client.associate_software_token(
    AccessToken='string',
    Session='string'
)
Parameters
  • AccessToken (string) -- A valid access token that Amazon Cognito issued to the user whose software token you want to generate.
  • Session (string) -- The session that should be passed both ways in challenge-response calls to the service. This allows authentication of the user as part of the MFA setup process.
Return type

dict

Returns

Response Syntax

{
    'SecretCode': 'string',
    'Session': 'string'
}

Response Structure

  • (dict) --

    • SecretCode (string) --

      A unique generated shared secret code that is used in the TOTP algorithm to generate a one-time code.

    • Session (string) --

      The session that should be passed both ways in challenge-response calls to the service. This allows authentication of the user as part of the MFA setup process.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ConcurrentModificationException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
  • CognitoIdentityProvider.Client.exceptions.SoftwareTokenMFANotFoundException
  • CognitoIdentityProvider.Client.exceptions.ForbiddenException
can_paginate(operation_name)

Check if an operation can be paginated.

Parameters
operation_name (string) -- The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator("create_foo").
Returns
True if the operation can be paginated, False otherwise.
change_password(**kwargs)

Changes the password for a specified user in a user pool.

See also: AWS API Documentation

Request Syntax

response = client.change_password(
    PreviousPassword='string',
    ProposedPassword='string',
    AccessToken='string'
)
Parameters
  • PreviousPassword (string) --

    [REQUIRED]

    The old password.

  • ProposedPassword (string) --

    [REQUIRED]

    The new password.

  • AccessToken (string) --

    [REQUIRED]

    A valid access token that Amazon Cognito issued to the user whose password you want to change.

Return type

dict

Returns

Response Syntax

{}

Response Structure

  • (dict) --

    The response from the server to the change password request.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.InvalidPasswordException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.LimitExceededException
  • CognitoIdentityProvider.Client.exceptions.PasswordResetRequiredException
  • CognitoIdentityProvider.Client.exceptions.UserNotFoundException
  • CognitoIdentityProvider.Client.exceptions.UserNotConfirmedException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
  • CognitoIdentityProvider.Client.exceptions.ForbiddenException
close()

Closes underlying endpoint connections.

confirm_device(**kwargs)

Confirms tracking of the device. This API call is the call that begins device tracking.

See also: AWS API Documentation

Request Syntax

response = client.confirm_device(
    AccessToken='string',
    DeviceKey='string',
    DeviceSecretVerifierConfig={
        'PasswordVerifier': 'string',
        'Salt': 'string'
    },
    DeviceName='string'
)
Parameters
  • AccessToken (string) --

    [REQUIRED]

    A valid access token that Amazon Cognito issued to the user whose device you want to confirm.

  • DeviceKey (string) --

    [REQUIRED]

    The device key.

  • DeviceSecretVerifierConfig (dict) --

    The configuration of the device secret verifier.

    • PasswordVerifier (string) --

      The password verifier.

    • Salt (string) --

      The salt

  • DeviceName (string) -- The device name.
Return type

dict

Returns

Response Syntax

{
    'UserConfirmationNecessary': True|False
}

Response Structure

  • (dict) --

    Confirms the device response.

    • UserConfirmationNecessary (boolean) --

      Indicates whether the user confirmation must confirm the device response.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.InvalidPasswordException
  • CognitoIdentityProvider.Client.exceptions.InvalidLambdaResponseException
  • CognitoIdentityProvider.Client.exceptions.UsernameExistsException
  • CognitoIdentityProvider.Client.exceptions.InvalidUserPoolConfigurationException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.PasswordResetRequiredException
  • CognitoIdentityProvider.Client.exceptions.UserNotFoundException
  • CognitoIdentityProvider.Client.exceptions.UserNotConfirmedException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
  • CognitoIdentityProvider.Client.exceptions.ForbiddenException
confirm_forgot_password(**kwargs)

Allows a user to enter a confirmation code to reset a forgotten password.

See also: AWS API Documentation

Request Syntax

response = client.confirm_forgot_password(
    ClientId='string',
    SecretHash='string',
    Username='string',
    ConfirmationCode='string',
    Password='string',
    AnalyticsMetadata={
        'AnalyticsEndpointId': 'string'
    },
    UserContextData={
        'IpAddress': 'string',
        'EncodedData': 'string'
    },
    ClientMetadata={
        'string': 'string'
    }
)
Parameters
  • ClientId (string) --

    [REQUIRED]

    The app client ID of the app associated with the user pool.

  • SecretHash (string) -- A keyed-hash message authentication code (HMAC) calculated using the secret key of a user pool client and username plus the client ID in the message.
  • Username (string) --

    [REQUIRED]

    The user name of the user for whom you want to enter a code to retrieve a forgotten password.

  • ConfirmationCode (string) --

    [REQUIRED]

    The confirmation code from your user's request to reset their password. For more information, see ForgotPassword .

  • Password (string) --

    [REQUIRED]

    The new password that your user wants to set.

  • AnalyticsMetadata (dict) --

    The Amazon Pinpoint analytics metadata for collecting metrics for ConfirmForgotPassword calls.

    • AnalyticsEndpointId (string) --

      The endpoint ID.

  • UserContextData (dict) --

    Contextual data about your user session, such as the device fingerprint, IP address, or location. Amazon Cognito advanced security evaluates the risk of an authentication event based on the context that your app generates and passes to Amazon Cognito when it makes API requests.

    • IpAddress (string) --

      The source IP address of your user's device.

    • EncodedData (string) --

      Encoded device-fingerprint details that your app collected with the Amazon Cognito context data collection library. For more information, see Adding user device and session data to API requests .

  • ClientMetadata (dict) --

    A map of custom key-value pairs that you can provide as input for any custom workflows that this action triggers.

    You create custom workflows by assigning Lambda functions to user pool triggers. When you use the ConfirmForgotPassword API action, Amazon Cognito invokes the function that is assigned to the post confirmation trigger. When Amazon Cognito invokes this function, it passes a JSON payload, which the function receives as input. This payload contains a clientMetadata attribute, which provides the data that you assigned to the ClientMetadata parameter in your ConfirmForgotPassword request. In your function code in Lambda, you can process the clientMetadata value to enhance your workflow for your specific needs.

    For more information, see Customizing user pool Workflows with Lambda Triggers in the Amazon Cognito Developer Guide .

    Note

    When you use the ClientMetadata parameter, remember that Amazon Cognito won't do the following:

    • Store the ClientMetadata value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration doesn't include triggers, the ClientMetadata parameter serves no purpose.
    • Validate the ClientMetadata value.
    • Encrypt the ClientMetadata value. Don't use Amazon Cognito to provide sensitive information.
    • (string) --
      • (string) --
Return type

dict

Returns

Response Syntax

{}

Response Structure

  • (dict) --

    The response from the server that results from a user's request to retrieve a forgotten password.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.UnexpectedLambdaException
  • CognitoIdentityProvider.Client.exceptions.UserLambdaValidationException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.InvalidPasswordException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.CodeMismatchException
  • CognitoIdentityProvider.Client.exceptions.ExpiredCodeException
  • CognitoIdentityProvider.Client.exceptions.TooManyFailedAttemptsException
  • CognitoIdentityProvider.Client.exceptions.InvalidLambdaResponseException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.LimitExceededException
  • CognitoIdentityProvider.Client.exceptions.UserNotFoundException
  • CognitoIdentityProvider.Client.exceptions.UserNotConfirmedException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
  • CognitoIdentityProvider.Client.exceptions.ForbiddenException
confirm_sign_up(**kwargs)

Confirms registration of a new user.

See also: AWS API Documentation

Request Syntax

response = client.confirm_sign_up(
    ClientId='string',
    SecretHash='string',
    Username='string',
    ConfirmationCode='string',
    ForceAliasCreation=True|False,
    AnalyticsMetadata={
        'AnalyticsEndpointId': 'string'
    },
    UserContextData={
        'IpAddress': 'string',
        'EncodedData': 'string'
    },
    ClientMetadata={
        'string': 'string'
    }
)
Parameters
  • ClientId (string) --

    [REQUIRED]

    The ID of the app client associated with the user pool.

  • SecretHash (string) -- A keyed-hash message authentication code (HMAC) calculated using the secret key of a user pool client and username plus the client ID in the message.
  • Username (string) --

    [REQUIRED]

    The user name of the user whose registration you want to confirm.

  • ConfirmationCode (string) --

    [REQUIRED]

    The confirmation code sent by a user's request to confirm registration.

  • ForceAliasCreation (boolean) -- Boolean to be specified to force user confirmation irrespective of existing alias. By default set to False . If this parameter is set to True and the phone number/email used for sign up confirmation already exists as an alias with a different user, the API call will migrate the alias from the previous user to the newly created user being confirmed. If set to False , the API will throw an AliasExistsException error.
  • AnalyticsMetadata (dict) --

    The Amazon Pinpoint analytics metadata for collecting metrics for ConfirmSignUp calls.

    • AnalyticsEndpointId (string) --

      The endpoint ID.

  • UserContextData (dict) --

    Contextual data about your user session, such as the device fingerprint, IP address, or location. Amazon Cognito advanced security evaluates the risk of an authentication event based on the context that your app generates and passes to Amazon Cognito when it makes API requests.

    • IpAddress (string) --

      The source IP address of your user's device.

    • EncodedData (string) --

      Encoded device-fingerprint details that your app collected with the Amazon Cognito context data collection library. For more information, see Adding user device and session data to API requests .

  • ClientMetadata (dict) --

    A map of custom key-value pairs that you can provide as input for any custom workflows that this action triggers.

    You create custom workflows by assigning Lambda functions to user pool triggers. When you use the ConfirmSignUp API action, Amazon Cognito invokes the function that is assigned to the post confirmation trigger. When Amazon Cognito invokes this function, it passes a JSON payload, which the function receives as input. This payload contains a clientMetadata attribute, which provides the data that you assigned to the ClientMetadata parameter in your ConfirmSignUp request. In your function code in Lambda, you can process the clientMetadata value to enhance your workflow for your specific needs.

    For more information, see Customizing user pool Workflows with Lambda Triggers in the Amazon Cognito Developer Guide .

    Note

    When you use the ClientMetadata parameter, remember that Amazon Cognito won't do the following:

    • Store the ClientMetadata value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration doesn't include triggers, the ClientMetadata parameter serves no purpose.
    • Validate the ClientMetadata value.
    • Encrypt the ClientMetadata value. Don't use Amazon Cognito to provide sensitive information.
    • (string) --
      • (string) --
Return type

dict

Returns

Response Syntax

{}

Response Structure

  • (dict) --

    Represents the response from the server for the registration confirmation.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.UnexpectedLambdaException
  • CognitoIdentityProvider.Client.exceptions.UserLambdaValidationException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.TooManyFailedAttemptsException
  • CognitoIdentityProvider.Client.exceptions.CodeMismatchException
  • CognitoIdentityProvider.Client.exceptions.ExpiredCodeException
  • CognitoIdentityProvider.Client.exceptions.InvalidLambdaResponseException
  • CognitoIdentityProvider.Client.exceptions.AliasExistsException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.LimitExceededException
  • CognitoIdentityProvider.Client.exceptions.UserNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
  • CognitoIdentityProvider.Client.exceptions.ForbiddenException
create_group(**kwargs)

Creates a new group in the specified user pool.

Calling this action requires developer credentials.

See also: AWS API Documentation

Request Syntax

response = client.create_group(
    GroupName='string',
    UserPoolId='string',
    Description='string',
    RoleArn='string',
    Precedence=123
)
Parameters
  • GroupName (string) --

    [REQUIRED]

    The name of the group. Must be unique.

  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool.

  • Description (string) -- A string containing the description of the group.
  • RoleArn (string) -- The role Amazon Resource Name (ARN) for the group.
  • Precedence (integer) --

    A non-negative integer value that specifies the precedence of this group relative to the other groups that a user can belong to in the user pool. Zero is the highest precedence value. Groups with lower Precedence values take precedence over groups with higher or null Precedence values. If a user belongs to two or more groups, it is the group with the lowest precedence value whose role ARN is given in the user's tokens for the cognito:roles and cognito:preferred_role claims.

    Two groups can have the same Precedence value. If this happens, neither group takes precedence over the other. If two groups with the same Precedence have the same role ARN, that role is used in the cognito:preferred_role claim in tokens for users in each group. If the two groups have different role ARNs, the cognito:preferred_role claim isn't set in users' tokens.

    The default Precedence value is null. The maximum Precedence value is 2^31-1 .

Return type

dict

Returns

Response Syntax

{
    'Group': {
        'GroupName': 'string',
        'UserPoolId': 'string',
        'Description': 'string',
        'RoleArn': 'string',
        'Precedence': 123,
        'LastModifiedDate': datetime(2015, 1, 1),
        'CreationDate': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) --

    • Group (dict) --

      The group object for the group.

      • GroupName (string) --

        The name of the group.

      • UserPoolId (string) --

        The user pool ID for the user pool.

      • Description (string) --

        A string containing the description of the group.

      • RoleArn (string) --

        The role Amazon Resource Name (ARN) for the group.

      • Precedence (integer) --

        A non-negative integer value that specifies the precedence of this group relative to the other groups that a user can belong to in the user pool. Zero is the highest precedence value. Groups with lower Precedence values take precedence over groups with higher ornull Precedence values. If a user belongs to two or more groups, it is the group with the lowest precedence value whose role ARN is given in the user's tokens for the cognito:roles and cognito:preferred_role claims.

        Two groups can have the same Precedence value. If this happens, neither group takes precedence over the other. If two groups with the same Precedence have the same role ARN, that role is used in the cognito:preferred_role claim in tokens for users in each group. If the two groups have different role ARNs, the cognito:preferred_role claim isn't set in users' tokens.

        The default Precedence value is null.

      • LastModifiedDate (datetime) --

        The date the group was last modified.

      • CreationDate (datetime) --

        The date the group was created.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.GroupExistsException
  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.LimitExceededException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
create_identity_provider(**kwargs)

Creates an IdP for a user pool.

See also: AWS API Documentation

Request Syntax

response = client.create_identity_provider(
    UserPoolId='string',
    ProviderName='string',
    ProviderType='SAML'|'Facebook'|'Google'|'LoginWithAmazon'|'SignInWithApple'|'OIDC',
    ProviderDetails={
        'string': 'string'
    },
    AttributeMapping={
        'string': 'string'
    },
    IdpIdentifiers=[
        'string',
    ]
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID.

  • ProviderName (string) --

    [REQUIRED]

    The IdP name.

  • ProviderType (string) --

    [REQUIRED]

    The IdP type.

  • ProviderDetails (dict) --

    [REQUIRED]

    The IdP details. The following list describes the provider detail keys for each IdP type.

    • For Google and Login with Amazon:
      • client_id
      • client_secret
      • authorize_scopes
    • For Facebook:
      • client_id
      • client_secret
      • authorize_scopes
      • api_version
    • For Sign in with Apple:
      • client_id
      • team_id
      • key_id
      • private_key
      • authorize_scopes
    • For OpenID Connect (OIDC) providers:
      • client_id
      • client_secret
      • attributes_request_method
      • oidc_issuer
      • authorize_scopes
      • The following keys are only present if Amazon Cognito didn't discover them at the oidc_issuer URL.
        • authorize_url
        • token_url
        • attributes_url
        • jwks_uri
      • Amazon Cognito sets the value of the following keys automatically. They are read-only.
        • attributes_url_add_attributes
    • For SAML providers:
      • MetadataFile or MetadataURL
      • IDPSignout optional
    • (string) --
      • (string) --
  • AttributeMapping (dict) --

    A mapping of IdP attributes to standard and custom user pool attributes.

    • (string) --
      • (string) --
  • IdpIdentifiers (list) --

    A list of IdP identifiers.

    • (string) --
Return type

dict

Returns

Response Syntax

{
    'IdentityProvider': {
        'UserPoolId': 'string',
        'ProviderName': 'string',
        'ProviderType': 'SAML'|'Facebook'|'Google'|'LoginWithAmazon'|'SignInWithApple'|'OIDC',
        'ProviderDetails': {
            'string': 'string'
        },
        'AttributeMapping': {
            'string': 'string'
        },
        'IdpIdentifiers': [
            'string',
        ],
        'LastModifiedDate': datetime(2015, 1, 1),
        'CreationDate': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) --

    • IdentityProvider (dict) --

      The newly created IdP object.

      • UserPoolId (string) --

        The user pool ID.

      • ProviderName (string) --

        The IdP name.

      • ProviderType (string) --

        The IdP type.

      • ProviderDetails (dict) --

        The IdP details. The following list describes the provider detail keys for each IdP type.

        • For Google and Login with Amazon:
          • client_id
          • client_secret
          • authorize_scopes
        • For Facebook:
          • client_id
          • client_secret
          • authorize_scopes
          • api_version
        • For Sign in with Apple:
          • client_id
          • team_id
          • key_id
          • private_key You can submit a private_key when you add or update an IdP. Describe operations don't return the private key.
          • authorize_scopes
        • For OIDC providers:
          • client_id
          • client_secret
          • attributes_request_method
          • oidc_issuer
          • authorize_scopes
          • The following keys are only present if Amazon Cognito didn't discover them at the oidc_issuer URL.
            • authorize_url
            • token_url
            • attributes_url
            • jwks_uri
          • Amazon Cognito sets the value of the following keys automatically. They are read-only.
            • attributes_url_add_attributes
        • For SAML providers:
          • MetadataFile or MetadataURL
          • IDPSignout optional
        • (string) --
          • (string) --
      • AttributeMapping (dict) --

        A mapping of IdP attributes to standard and custom user pool attributes.

        • (string) --
          • (string) --
      • IdpIdentifiers (list) --

        A list of IdP identifiers.

        • (string) --
      • LastModifiedDate (datetime) --

        The date the IdP was last modified.

      • CreationDate (datetime) --

        The date the IdP was created.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.DuplicateProviderException
  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.LimitExceededException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
create_resource_server(**kwargs)

Creates a new OAuth2.0 resource server and defines custom scopes within it.

See also: AWS API Documentation

Request Syntax

response = client.create_resource_server(
    UserPoolId='string',
    Identifier='string',
    Name='string',
    Scopes=[
        {
            'ScopeName': 'string',
            'ScopeDescription': 'string'
        },
    ]
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool.

  • Identifier (string) --

    [REQUIRED]

    A unique resource server identifier for the resource server. This could be an HTTPS endpoint where the resource server is located, such as https://my-weather-api.example.com .

  • Name (string) --

    [REQUIRED]

    A friendly name for the resource server.

  • Scopes (list) --

    A list of scopes. Each scope is a key-value map with the keys name and description .

    • (dict) --

      A resource server scope.

      • ScopeName (string) -- [REQUIRED]

        The name of the scope.

      • ScopeDescription (string) -- [REQUIRED]

        A description of the scope.

Return type

dict

Returns

Response Syntax

{
    'ResourceServer': {
        'UserPoolId': 'string',
        'Identifier': 'string',
        'Name': 'string',
        'Scopes': [
            {
                'ScopeName': 'string',
                'ScopeDescription': 'string'
            },
        ]
    }
}

Response Structure

  • (dict) --

    • ResourceServer (dict) --

      The newly created resource server.

      • UserPoolId (string) --

        The user pool ID for the user pool that hosts the resource server.

      • Identifier (string) --

        The identifier for the resource server.

      • Name (string) --

        The name of the resource server.

      • Scopes (list) --

        A list of scopes that are defined for the resource server.

        • (dict) --

          A resource server scope.

          • ScopeName (string) --

            The name of the scope.

          • ScopeDescription (string) --

            A description of the scope.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.LimitExceededException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
create_user_import_job(**kwargs)

Creates the user import job.

See also: AWS API Documentation

Request Syntax

response = client.create_user_import_job(
    JobName='string',
    UserPoolId='string',
    CloudWatchLogsRoleArn='string'
)
Parameters
  • JobName (string) --

    [REQUIRED]

    The job name for the user import job.

  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool that the users are being imported into.

  • CloudWatchLogsRoleArn (string) --

    [REQUIRED]

    The role ARN for the Amazon CloudWatch Logs Logging role for the user import job.

Return type

dict

Returns

Response Syntax

{
    'UserImportJob': {
        'JobName': 'string',
        'JobId': 'string',
        'UserPoolId': 'string',
        'PreSignedUrl': 'string',
        'CreationDate': datetime(2015, 1, 1),
        'StartDate': datetime(2015, 1, 1),
        'CompletionDate': datetime(2015, 1, 1),
        'Status': 'Created'|'Pending'|'InProgress'|'Stopping'|'Expired'|'Stopped'|'Failed'|'Succeeded',
        'CloudWatchLogsRoleArn': 'string',
        'ImportedUsers': 123,
        'SkippedUsers': 123,
        'FailedUsers': 123,
        'CompletionMessage': 'string'
    }
}

Response Structure

  • (dict) --

    Represents the response from the server to the request to create the user import job.

    • UserImportJob (dict) --

      The job object that represents the user import job.

      • JobName (string) --

        The job name for the user import job.

      • JobId (string) --

        The job ID for the user import job.

      • UserPoolId (string) --

        The user pool ID for the user pool that the users are being imported into.

      • PreSignedUrl (string) --

        The pre-signed URL to be used to upload the .csv file.

      • CreationDate (datetime) --

        The date the user import job was created.

      • StartDate (datetime) --

        The date when the user import job was started.

      • CompletionDate (datetime) --

        The date when the user import job was completed.

      • Status (string) --

        The status of the user import job. One of the following:

        • Created - The job was created but not started.
        • Pending - A transition state. You have started the job, but it has not begun importing users yet.
        • InProgress - The job has started, and users are being imported.
        • Stopping - You have stopped the job, but the job has not stopped importing users yet.
        • Stopped - You have stopped the job, and the job has stopped importing users.
        • Succeeded - The job has completed successfully.
        • Failed - The job has stopped due to an error.
        • Expired - You created a job, but did not start the job within 24-48 hours. All data associated with the job was deleted, and the job can't be started.
      • CloudWatchLogsRoleArn (string) --

        The role Amazon Resource Name (ARN) for the Amazon CloudWatch Logging role for the user import job. For more information, see "Creating the CloudWatch Logs IAM Role" in the Amazon Cognito Developer Guide.

      • ImportedUsers (integer) --

        The number of users that were successfully imported.

      • SkippedUsers (integer) --

        The number of users that were skipped.

      • FailedUsers (integer) --

        The number of users that couldn't be imported.

      • CompletionMessage (string) --

        The message returned when the user import job is completed.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.PreconditionNotMetException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.LimitExceededException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
create_user_pool(**kwargs)

Creates a new Amazon Cognito user pool and sets the password policy for the pool.

Note

This action might generate an SMS text message. Starting June 1, 2021, US telecom carriers require you to register an origination phone number before you can send SMS messages to US phone numbers. If you use SMS text messages in Amazon Cognito, you must register a phone number with Amazon Pinpoint . Amazon Cognito uses the registered number automatically. Otherwise, Amazon Cognito users who must receive SMS messages might not be able to sign up, activate their accounts, or sign in.

If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Service, Amazon Simple Notification Service might place your account in the SMS sandbox. In * sandbox mode * , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see SMS message settings for Amazon Cognito user pools in the Amazon Cognito Developer Guide .

See also: AWS API Documentation

Request Syntax

response = client.create_user_pool(
    PoolName='string',
    Policies={
        'PasswordPolicy': {
            'MinimumLength': 123,
            'RequireUppercase': True|False,
            'RequireLowercase': True|False,
            'RequireNumbers': True|False,
            'RequireSymbols': True|False,
            'TemporaryPasswordValidityDays': 123
        }
    },
    LambdaConfig={
        'PreSignUp': 'string',
        'CustomMessage': 'string',
        'PostConfirmation': 'string',
        'PreAuthentication': 'string',
        'PostAuthentication': 'string',
        'DefineAuthChallenge': 'string',
        'CreateAuthChallenge': 'string',
        'VerifyAuthChallengeResponse': 'string',
        'PreTokenGeneration': 'string',
        'UserMigration': 'string',
        'CustomSMSSender': {
            'LambdaVersion': 'V1_0',
            'LambdaArn': 'string'
        },
        'CustomEmailSender': {
            'LambdaVersion': 'V1_0',
            'LambdaArn': 'string'
        },
        'KMSKeyID': 'string'
    },
    AutoVerifiedAttributes=[
        'phone_number'|'email',
    ],
    AliasAttributes=[
        'phone_number'|'email'|'preferred_username',
    ],
    UsernameAttributes=[
        'phone_number'|'email',
    ],
    SmsVerificationMessage='string',
    EmailVerificationMessage='string',
    EmailVerificationSubject='string',
    VerificationMessageTemplate={
        'SmsMessage': 'string',
        'EmailMessage': 'string',
        'EmailSubject': 'string',
        'EmailMessageByLink': 'string',
        'EmailSubjectByLink': 'string',
        'DefaultEmailOption': 'CONFIRM_WITH_LINK'|'CONFIRM_WITH_CODE'
    },
    SmsAuthenticationMessage='string',
    MfaConfiguration='OFF'|'ON'|'OPTIONAL',
    UserAttributeUpdateSettings={
        'AttributesRequireVerificationBeforeUpdate': [
            'phone_number'|'email',
        ]
    },
    DeviceConfiguration={
        'ChallengeRequiredOnNewDevice': True|False,
        'DeviceOnlyRememberedOnUserPrompt': True|False
    },
    EmailConfiguration={
        'SourceArn': 'string',
        'ReplyToEmailAddress': 'string',
        'EmailSendingAccount': 'COGNITO_DEFAULT'|'DEVELOPER',
        'From': 'string',
        'ConfigurationSet': 'string'
    },
    SmsConfiguration={
        'SnsCallerArn': 'string',
        'ExternalId': 'string',
        'SnsRegion': 'string'
    },
    UserPoolTags={
        'string': 'string'
    },
    AdminCreateUserConfig={
        'AllowAdminCreateUserOnly': True|False,
        'UnusedAccountValidityDays': 123,
        'InviteMessageTemplate': {
            'SMSMessage': 'string',
            'EmailMessage': 'string',
            'EmailSubject': 'string'
        }
    },
    Schema=[
        {
            'Name': 'string',
            'AttributeDataType': 'String'|'Number'|'DateTime'|'Boolean',
            'DeveloperOnlyAttribute': True|False,
            'Mutable': True|False,
            'Required': True|False,
            'NumberAttributeConstraints': {
                'MinValue': 'string',
                'MaxValue': 'string'
            },
            'StringAttributeConstraints': {
                'MinLength': 'string',
                'MaxLength': 'string'
            }
        },
    ],
    UserPoolAddOns={
        'AdvancedSecurityMode': 'OFF'|'AUDIT'|'ENFORCED'
    },
    UsernameConfiguration={
        'CaseSensitive': True|False
    },
    AccountRecoverySetting={
        'RecoveryMechanisms': [
            {
                'Priority': 123,
                'Name': 'verified_email'|'verified_phone_number'|'admin_only'
            },
        ]
    }
)
Parameters
  • PoolName (string) --

    [REQUIRED]

    A string used to name the user pool.

  • Policies (dict) --

    The policies associated with the new user pool.

    • PasswordPolicy (dict) --

      The password policy.

      • MinimumLength (integer) --

        The minimum length of the password in the policy that you have set. This value can't be less than 6.

      • RequireUppercase (boolean) --

        In the password policy that you have set, refers to whether you have required users to use at least one uppercase letter in their password.

      • RequireLowercase (boolean) --

        In the password policy that you have set, refers to whether you have required users to use at least one lowercase letter in their password.

      • RequireNumbers (boolean) --

        In the password policy that you have set, refers to whether you have required users to use at least one number in their password.

      • RequireSymbols (boolean) --

        In the password policy that you have set, refers to whether you have required users to use at least one symbol in their password.

      • TemporaryPasswordValidityDays (integer) --

        The number of days a temporary password is valid in the password policy. If the user doesn't sign in during this time, an administrator must reset their password.

        Note

        When you set TemporaryPasswordValidityDays for a user pool, you can no longer set a value for the legacy UnusedAccountValidityDays parameter in that user pool.

  • LambdaConfig (dict) --

    The Lambda trigger configuration information for the new user pool.

    Note

    In a push model, event sources (such as Amazon S3 and custom applications) need permission to invoke a function. So you must make an extra call to add permission for these event sources to invoke your Lambda function.

    For more information on using the Lambda API to add permission, see`AddPermission <https://docs.aws.amazon.com/lambda/latest/dg/API_AddPermission.html>`__ .

    For adding permission using the CLI, see`add-permission <https://docs.aws.amazon.com/cli/latest/reference/lambda/add-permission.html>`__ .

    • PreSignUp (string) --

      A pre-registration Lambda trigger.

    • CustomMessage (string) --

      A custom Message Lambda trigger.

    • PostConfirmation (string) --

      A post-confirmation Lambda trigger.

    • PreAuthentication (string) --

      A pre-authentication Lambda trigger.

    • PostAuthentication (string) --

      A post-authentication Lambda trigger.

    • DefineAuthChallenge (string) --

      Defines the authentication challenge.

    • CreateAuthChallenge (string) --

      Creates an authentication challenge.

    • VerifyAuthChallengeResponse (string) --

      Verifies the authentication challenge response.

    • PreTokenGeneration (string) --

      A Lambda trigger that is invoked before token generation.

    • UserMigration (string) --

      The user migration Lambda config type.

    • CustomSMSSender (dict) --

      A custom SMS sender Lambda trigger.

      • LambdaVersion (string) -- [REQUIRED]

        Signature of the "request" attribute in the "event" information that Amazon Cognito passes to your custom SMS Lambda function. The only supported value is V1_0 .

      • LambdaArn (string) -- [REQUIRED]

        The Amazon Resource Name (ARN) of the Lambda function that Amazon Cognito activates to send SMS notifications to users.

    • CustomEmailSender (dict) --

      A custom email sender Lambda trigger.

      • LambdaVersion (string) -- [REQUIRED]

        Signature of the "request" attribute in the "event" information Amazon Cognito passes to your custom email Lambda function. The only supported value is V1_0 .

      • LambdaArn (string) -- [REQUIRED]

        The Amazon Resource Name (ARN) of the Lambda function that Amazon Cognito activates to send email notifications to users.

    • KMSKeyID (string) --

      The Amazon Resource Name (ARN) of an KMS key . Amazon Cognito uses the key to encrypt codes and temporary passwords sent to CustomEmailSender and CustomSMSSender .

  • AutoVerifiedAttributes (list) --

    The attributes to be auto-verified. Possible values: email , phone_number .

    • (string) --
  • AliasAttributes (list) --

    Attributes supported as an alias for this user pool. Possible values: phone_number , email , or preferred_username .

    • (string) --
  • UsernameAttributes (list) --

    Specifies whether a user can use an email address or phone number as a username when they sign up.

    • (string) --
  • SmsVerificationMessage (string) -- This parameter is no longer used. See VerificationMessageTemplateType .
  • EmailVerificationMessage (string) -- This parameter is no longer used. See VerificationMessageTemplateType .
  • EmailVerificationSubject (string) -- This parameter is no longer used. See VerificationMessageTemplateType .
  • VerificationMessageTemplate (dict) --

    The template for the verification message that the user sees when the app requests permission to access the user's information.

    • SmsMessage (string) --

      The template for SMS messages that Amazon Cognito sends to your users.

    • EmailMessage (string) --

      The template for email messages that Amazon Cognito sends to your users. You can set an EmailMessage template only if the value of EmailSendingAccount is DEVELOPER . When your EmailSendingAccount is DEVELOPER , your user pool sends email messages with your own Amazon SES configuration.

    • EmailSubject (string) --

      The subject line for the email message template. You can set an EmailSubject template only if the value of EmailSendingAccount is DEVELOPER . When your EmailSendingAccount is DEVELOPER , your user pool sends email messages with your own Amazon SES configuration.

    • EmailMessageByLink (string) --

      The email message template for sending a confirmation link to the user. You can set an EmailMessageByLink template only if the value of EmailSendingAccount is DEVELOPER . When your EmailSendingAccount is DEVELOPER , your user pool sends email messages with your own Amazon SES configuration.

    • EmailSubjectByLink (string) --

      The subject line for the email message template for sending a confirmation link to the user. You can set an EmailSubjectByLink template only if the value of EmailSendingAccount is DEVELOPER . When your EmailSendingAccount is DEVELOPER , your user pool sends email messages with your own Amazon SES configuration.

    • DefaultEmailOption (string) --

      The default email option.

  • SmsAuthenticationMessage (string) -- A string representing the SMS authentication message.
  • MfaConfiguration (string) -- Specifies MFA configuration details.
  • UserAttributeUpdateSettings (dict) --

    The settings for updates to user attributes. These settings include the property AttributesRequireVerificationBeforeUpdate , a user-pool setting that tells Amazon Cognito how to handle changes to the value of your users' email address and phone number attributes. For more information, see Verifying updates to email addresses and phone numbers .

    • AttributesRequireVerificationBeforeUpdate (list) --

      Requires that your user verifies their email address, phone number, or both before Amazon Cognito updates the value of that attribute. When you update a user attribute that has this option activated, Amazon Cognito sends a verification message to the new phone number or email address. Amazon Cognito doesn’t change the value of the attribute until your user responds to the verification message and confirms the new value.

      You can verify an updated email address or phone number with a VerifyUserAttribute API request. You can also call the UpdateUserAttributes or AdminUpdateUserAttributes API and set email_verified or phone_number_verified to true.

      When AttributesRequireVerificationBeforeUpdate is false, your user pool doesn't require that your users verify attribute changes before Amazon Cognito updates them. In a user pool where AttributesRequireVerificationBeforeUpdate is false, API operations that change attribute values can immediately update a user’s email or phone_number attribute.

      • (string) --
  • DeviceConfiguration (dict) --

    The device-remembering configuration for a user pool. A null value indicates that you have deactivated device remembering in your user pool.

    Note

    When you provide a value for any DeviceConfiguration field, you activate the Amazon Cognito device-remembering feature.

    • ChallengeRequiredOnNewDevice (boolean) --

      When true, a remembered device can sign in with device authentication instead of SMS and time-based one-time password (TOTP) factors for multi-factor authentication (MFA).

      Note

      Whether or not ChallengeRequiredOnNewDevice is true, users who sign in with devices that have not been confirmed or remembered must still provide a second factor in a user pool that requires MFA.

    • DeviceOnlyRememberedOnUserPrompt (boolean) --

      When true, Amazon Cognito doesn't automatically remember a user's device when your app sends a ConfirmDevice API request. In your app, create a prompt for your user to choose whether they want to remember their device. Return the user's choice in an UpdateDeviceStatus API request.

      When DeviceOnlyRememberedOnUserPrompt is false , Amazon Cognito immediately remembers devices that you register in a ConfirmDevice API request.

  • EmailConfiguration (dict) --

    The email configuration of your user pool. The email configuration type sets your preferred sending method, Amazon Web Services Region, and sender for messages from your user pool.

    • SourceArn (string) --

      The ARN of a verified email address in Amazon SES. Amazon Cognito uses this email address in one of the following ways, depending on the value that you specify for the EmailSendingAccount parameter:

      • If you specify COGNITO_DEFAULT , Amazon Cognito uses this address as the custom FROM address when it emails your users using its built-in email account.
      • If you specify DEVELOPER , Amazon Cognito emails your users with this address by calling Amazon SES on your behalf.

      The Region value of the SourceArn parameter must indicate a supported Amazon Web Services Region of your user pool. Typically, the Region in the SourceArn and the user pool Region are the same. For more information, see Amazon SES email configuration regions in the Amazon Cognito Developer Guide .

    • ReplyToEmailAddress (string) --

      The destination to which the receiver of the email should reply.

    • EmailSendingAccount (string) --

      Specifies whether Amazon Cognito uses its built-in functionality to send your users email messages, or uses your Amazon Simple Email Service email configuration. Specify one of the following values:

      COGNITO_DEFAULT

      When Amazon Cognito emails your users, it uses its built-in email functionality. When you use the default option, Amazon Cognito allows only a limited number of emails each day for your user pool. For typical production environments, the default email limit is less than the required delivery volume. To achieve a higher delivery volume, specify DEVELOPER to use your Amazon SES email configuration.

      To look up the email delivery limit for the default option, see Limits in in the Developer Guide .

      The default FROM address is no-reply@verificationemail.com . To customize the FROM address, provide the Amazon Resource Name (ARN) of an Amazon SES verified email address for the SourceArn parameter.

      DEVELOPER

      When Amazon Cognito emails your users, it uses your Amazon SES configuration. Amazon Cognito calls Amazon SES on your behalf to send email from your verified email address. When you use this option, the email delivery limits are the same limits that apply to your Amazon SES verified email address in your Amazon Web Services account.

      If you use this option, provide the ARN of an Amazon SES verified email address for the SourceArn parameter.

      Before Amazon Cognito can email your users, it requires additional permissions to call Amazon SES on your behalf. When you update your user pool with this option, Amazon Cognito creates a service-linked role , which is a type of role, in your Amazon Web Services account. This role contains the permissions that allow to access Amazon SES and send email messages with your address. For more information about the service-linked role that Amazon Cognito creates, see Using Service-Linked Roles for Amazon Cognito in the Amazon Cognito Developer Guide .

    • From (string) --

      Either the sender’s email address or the sender’s name with their email address. For example, testuser@example.com or Test User <testuser@example.com> . This address appears before the body of the email.

    • ConfigurationSet (string) --

      The set of configuration rules that can be applied to emails sent using Amazon Simple Email Service. A configuration set is applied to an email by including a reference to the configuration set in the headers of the email. Once applied, all of the rules in that configuration set are applied to the email. Configuration sets can be used to apply the following types of rules to emails:

      Event publishing

      Amazon Simple Email Service can track the number of send, delivery, open, click, bounce, and complaint events for each email sent. Use event publishing to send information about these events to other Amazon Web Services services such as and Amazon CloudWatch

      IP pool management

      When leasing dedicated IP addresses with Amazon Simple Email Service, you can create groups of IP addresses, called dedicated IP pools. You can then associate the dedicated IP pools with configuration sets.

  • SmsConfiguration (dict) --

    The SMS configuration with the settings that your Amazon Cognito user pool must use to send an SMS message from your Amazon Web Services account through Amazon Simple Notification Service. To send SMS messages with Amazon SNS in the Amazon Web Services Region that you want, the Amazon Cognito user pool uses an Identity and Access Management (IAM) role in your Amazon Web Services account.

    • SnsCallerArn (string) -- [REQUIRED]

      The Amazon Resource Name (ARN) of the Amazon SNS caller. This is the ARN of the IAM role in your Amazon Web Services account that Amazon Cognito will use to send SMS messages. SMS messages are subject to a spending limit .

    • ExternalId (string) --

      The external ID provides additional security for your IAM role. You can use an ExternalId with the IAM role that you use with Amazon SNS to send SMS messages for your user pool. If you provide an ExternalId , your Amazon Cognito user pool includes it in the request to assume your IAM role. You can configure the role trust policy to require that Amazon Cognito, and any principal, provide the ExternalID . If you use the Amazon Cognito Management Console to create a role for SMS multi-factor authentication (MFA), Amazon Cognito creates a role with the required permissions and a trust policy that demonstrates use of the ExternalId .

      For more information about the ExternalId of a role, see How to use an external ID when granting access to your Amazon Web Services resources to a third party

    • SnsRegion (string) --

      The Amazon Web Services Region to use with Amazon SNS integration. You can choose the same Region as your user pool, or a supported Legacy Amazon SNS alternate Region .

      Amazon Cognito resources in the Asia Pacific (Seoul) Amazon Web Services Region must use your Amazon SNS configuration in the Asia Pacific (Tokyo) Region. For more information, see SMS message settings for Amazon Cognito user pools .

  • UserPoolTags (dict) --

    The tag keys and values to assign to the user pool. A tag is a label that you can use to categorize and manage user pools in different ways, such as by purpose, owner, environment, or other criteria.

    • (string) --
      • (string) --
  • AdminCreateUserConfig (dict) --

    The configuration for AdminCreateUser requests.

    • AllowAdminCreateUserOnly (boolean) --

      Set to True if only the administrator is allowed to create user profiles. Set to False if users can sign themselves up via an app.

    • UnusedAccountValidityDays (integer) --

      The user account expiration limit, in days, after which a new account that hasn't signed in is no longer usable. To reset the account after that time limit, you must call AdminCreateUser again, specifying "RESEND" for the MessageAction parameter. The default value for this parameter is 7.

      Note

      If you set a value for TemporaryPasswordValidityDays in PasswordPolicy , that value will be used, and UnusedAccountValidityDays will be no longer be an available parameter for that user pool.

    • InviteMessageTemplate (dict) --

      The message template to be used for the welcome message to new users.

      See also Customizing User Invitation Messages .

      • SMSMessage (string) --

        The message template for SMS messages.

      • EmailMessage (string) --

        The message template for email messages. EmailMessage is allowed only if EmailSendingAccount is DEVELOPER.

      • EmailSubject (string) --

        The subject line for email messages. EmailSubject is allowed only if EmailSendingAccount is DEVELOPER.

  • Schema (list) --

    An array of schema attributes for the new user pool. These attributes can be standard or custom attributes.

    • (dict) --

      Contains information about the schema attribute.

      • Name (string) --

        A schema attribute of the name type.

      • AttributeDataType (string) --

        The attribute data type.

      • DeveloperOnlyAttribute (boolean) --

        Note

        You should use WriteAttributes in the user pool client to control how attributes can be mutated for new use cases instead of using DeveloperOnlyAttribute .

        Specifies whether the attribute type is developer only. This attribute can only be modified by an administrator. Users won't be able to modify this attribute using their access token. For example, DeveloperOnlyAttribute can be modified using AdminUpdateUserAttributes but can't be updated using UpdateUserAttributes.

      • Mutable (boolean) --

        Specifies whether the value of the attribute can be changed.

        For any user pool attribute that is mapped to an IdP attribute, you must set this parameter to true . Amazon Cognito updates mapped attributes when users sign in to your application through an IdP. If an attribute is immutable, Amazon Cognito throws an error when it attempts to update the attribute. For more information, see Specifying Identity Provider Attribute Mappings for Your User Pool .

      • Required (boolean) --

        Specifies whether a user pool attribute is required. If the attribute is required and the user doesn't provide a value, registration or sign-in will fail.

      • NumberAttributeConstraints (dict) --

        Specifies the constraints for an attribute of the number type.

        • MinValue (string) --

          The minimum value of an attribute that is of the number data type.

        • MaxValue (string) --

          The maximum value of an attribute that is of the number data type.

      • StringAttributeConstraints (dict) --

        Specifies the constraints for an attribute of the string type.

        • MinLength (string) --

          The minimum length.

        • MaxLength (string) --

          The maximum length.

  • UserPoolAddOns (dict) --

    Enables advanced security risk detection. Set the key AdvancedSecurityMode to the value "AUDIT".

    • AdvancedSecurityMode (string) -- [REQUIRED]

      The advanced security mode.

  • UsernameConfiguration (dict) --

    Case sensitivity on the username input for the selected sign-in option. For example, when case sensitivity is set to False , users can sign in using either "username" or "Username". This configuration is immutable once it has been set. For more information, see UsernameConfigurationType .

    • CaseSensitive (boolean) -- [REQUIRED]

      Specifies whether user name case sensitivity will be applied for all users in the user pool through Amazon Cognito APIs.

      Valid values include:

      True

      Enables case sensitivity for all username input. When this option is set to True , users must sign in using the exact capitalization of their given username, such as “UserName”. This is the default value.

      False

      Enables case insensitivity for all username input. For example, when this option is set to False , users can sign in using either "username" or "Username". This option also enables both preferred_username and email alias to be case insensitive, in addition to the username attribute.

  • AccountRecoverySetting (dict) --

    The available verified method a user can use to recover their password when they call ForgotPassword . You can use this setting to define a preferred method when a user has more than one method available. With this setting, SMS doesn't qualify for a valid password recovery mechanism if the user also has SMS multi-factor authentication (MFA) activated. In the absence of this setting, Amazon Cognito uses the legacy behavior to determine the recovery method where SMS is preferred through email.

    • RecoveryMechanisms (list) --

      The list of RecoveryOptionTypes .

      • (dict) --

        A map containing a priority as a key, and recovery method name as a value.

        • Priority (integer) -- [REQUIRED]

          A positive integer specifying priority of a method with 1 being the highest priority.

        • Name (string) -- [REQUIRED]

          The recovery method for a user.

Return type

dict

Returns

Response Syntax

{
    'UserPool': {
        'Id': 'string',
        'Name': 'string',
        'Policies': {
            'PasswordPolicy': {
                'MinimumLength': 123,
                'RequireUppercase': True|False,
                'RequireLowercase': True|False,
                'RequireNumbers': True|False,
                'RequireSymbols': True|False,
                'TemporaryPasswordValidityDays': 123
            }
        },
        'LambdaConfig': {
            'PreSignUp': 'string',
            'CustomMessage': 'string',
            'PostConfirmation': 'string',
            'PreAuthentication': 'string',
            'PostAuthentication': 'string',
            'DefineAuthChallenge': 'string',
            'CreateAuthChallenge': 'string',
            'VerifyAuthChallengeResponse': 'string',
            'PreTokenGeneration': 'string',
            'UserMigration': 'string',
            'CustomSMSSender': {
                'LambdaVersion': 'V1_0',
                'LambdaArn': 'string'
            },
            'CustomEmailSender': {
                'LambdaVersion': 'V1_0',
                'LambdaArn': 'string'
            },
            'KMSKeyID': 'string'
        },
        'Status': 'Enabled'|'Disabled',
        'LastModifiedDate': datetime(2015, 1, 1),
        'CreationDate': datetime(2015, 1, 1),
        'SchemaAttributes': [
            {
                'Name': 'string',
                'AttributeDataType': 'String'|'Number'|'DateTime'|'Boolean',
                'DeveloperOnlyAttribute': True|False,
                'Mutable': True|False,
                'Required': True|False,
                'NumberAttributeConstraints': {
                    'MinValue': 'string',
                    'MaxValue': 'string'
                },
                'StringAttributeConstraints': {
                    'MinLength': 'string',
                    'MaxLength': 'string'
                }
            },
        ],
        'AutoVerifiedAttributes': [
            'phone_number'|'email',
        ],
        'AliasAttributes': [
            'phone_number'|'email'|'preferred_username',
        ],
        'UsernameAttributes': [
            'phone_number'|'email',
        ],
        'SmsVerificationMessage': 'string',
        'EmailVerificationMessage': 'string',
        'EmailVerificationSubject': 'string',
        'VerificationMessageTemplate': {
            'SmsMessage': 'string',
            'EmailMessage': 'string',
            'EmailSubject': 'string',
            'EmailMessageByLink': 'string',
            'EmailSubjectByLink': 'string',
            'DefaultEmailOption': 'CONFIRM_WITH_LINK'|'CONFIRM_WITH_CODE'
        },
        'SmsAuthenticationMessage': 'string',
        'UserAttributeUpdateSettings': {
            'AttributesRequireVerificationBeforeUpdate': [
                'phone_number'|'email',
            ]
        },
        'MfaConfiguration': 'OFF'|'ON'|'OPTIONAL',
        'DeviceConfiguration': {
            'ChallengeRequiredOnNewDevice': True|False,
            'DeviceOnlyRememberedOnUserPrompt': True|False
        },
        'EstimatedNumberOfUsers': 123,
        'EmailConfiguration': {
            'SourceArn': 'string',
            'ReplyToEmailAddress': 'string',
            'EmailSendingAccount': 'COGNITO_DEFAULT'|'DEVELOPER',
            'From': 'string',
            'ConfigurationSet': 'string'
        },
        'SmsConfiguration': {
            'SnsCallerArn': 'string',
            'ExternalId': 'string',
            'SnsRegion': 'string'
        },
        'UserPoolTags': {
            'string': 'string'
        },
        'SmsConfigurationFailure': 'string',
        'EmailConfigurationFailure': 'string',
        'Domain': 'string',
        'CustomDomain': 'string',
        'AdminCreateUserConfig': {
            'AllowAdminCreateUserOnly': True|False,
            'UnusedAccountValidityDays': 123,
            'InviteMessageTemplate': {
                'SMSMessage': 'string',
                'EmailMessage': 'string',
                'EmailSubject': 'string'
            }
        },
        'UserPoolAddOns': {
            'AdvancedSecurityMode': 'OFF'|'AUDIT'|'ENFORCED'
        },
        'UsernameConfiguration': {
            'CaseSensitive': True|False
        },
        'Arn': 'string',
        'AccountRecoverySetting': {
            'RecoveryMechanisms': [
                {
                    'Priority': 123,
                    'Name': 'verified_email'|'verified_phone_number'|'admin_only'
                },
            ]
        }
    }
}

Response Structure

  • (dict) --

    Represents the response from the server for the request to create a user pool.

    • UserPool (dict) --

      A container for the user pool details.

      • Id (string) --

        The ID of the user pool.

      • Name (string) --

        The name of the user pool.

      • Policies (dict) --

        The policies associated with the user pool.

        • PasswordPolicy (dict) --

          The password policy.

          • MinimumLength (integer) --

            The minimum length of the password in the policy that you have set. This value can't be less than 6.

          • RequireUppercase (boolean) --

            In the password policy that you have set, refers to whether you have required users to use at least one uppercase letter in their password.

          • RequireLowercase (boolean) --

            In the password policy that you have set, refers to whether you have required users to use at least one lowercase letter in their password.

          • RequireNumbers (boolean) --

            In the password policy that you have set, refers to whether you have required users to use at least one number in their password.

          • RequireSymbols (boolean) --

            In the password policy that you have set, refers to whether you have required users to use at least one symbol in their password.

          • TemporaryPasswordValidityDays (integer) --

            The number of days a temporary password is valid in the password policy. If the user doesn't sign in during this time, an administrator must reset their password.

            Note

            When you set TemporaryPasswordValidityDays for a user pool, you can no longer set a value for the legacy UnusedAccountValidityDays parameter in that user pool.

      • LambdaConfig (dict) --

        The Lambda triggers associated with the user pool.

        • PreSignUp (string) --

          A pre-registration Lambda trigger.

        • CustomMessage (string) --

          A custom Message Lambda trigger.

        • PostConfirmation (string) --

          A post-confirmation Lambda trigger.

        • PreAuthentication (string) --

          A pre-authentication Lambda trigger.

        • PostAuthentication (string) --

          A post-authentication Lambda trigger.

        • DefineAuthChallenge (string) --

          Defines the authentication challenge.

        • CreateAuthChallenge (string) --

          Creates an authentication challenge.

        • VerifyAuthChallengeResponse (string) --

          Verifies the authentication challenge response.

        • PreTokenGeneration (string) --

          A Lambda trigger that is invoked before token generation.

        • UserMigration (string) --

          The user migration Lambda config type.

        • CustomSMSSender (dict) --

          A custom SMS sender Lambda trigger.

          • LambdaVersion (string) --

            Signature of the "request" attribute in the "event" information that Amazon Cognito passes to your custom SMS Lambda function. The only supported value is V1_0 .

          • LambdaArn (string) --

            The Amazon Resource Name (ARN) of the Lambda function that Amazon Cognito activates to send SMS notifications to users.

        • CustomEmailSender (dict) --

          A custom email sender Lambda trigger.

          • LambdaVersion (string) --

            Signature of the "request" attribute in the "event" information Amazon Cognito passes to your custom email Lambda function. The only supported value is V1_0 .

          • LambdaArn (string) --

            The Amazon Resource Name (ARN) of the Lambda function that Amazon Cognito activates to send email notifications to users.

        • KMSKeyID (string) --

          The Amazon Resource Name (ARN) of an KMS key . Amazon Cognito uses the key to encrypt codes and temporary passwords sent to CustomEmailSender and CustomSMSSender .

      • Status (string) --

        The status of a user pool.

      • LastModifiedDate (datetime) --

        The date the user pool was last modified.

      • CreationDate (datetime) --

        The date the user pool was created.

      • SchemaAttributes (list) --

        A container with the schema attributes of a user pool.

        • (dict) --

          Contains information about the schema attribute.

          • Name (string) --

            A schema attribute of the name type.

          • AttributeDataType (string) --

            The attribute data type.

          • DeveloperOnlyAttribute (boolean) --

            Note

            You should use WriteAttributes in the user pool client to control how attributes can be mutated for new use cases instead of using DeveloperOnlyAttribute .

            Specifies whether the attribute type is developer only. This attribute can only be modified by an administrator. Users won't be able to modify this attribute using their access token. For example, DeveloperOnlyAttribute can be modified using AdminUpdateUserAttributes but can't be updated using UpdateUserAttributes.

          • Mutable (boolean) --

            Specifies whether the value of the attribute can be changed.

            For any user pool attribute that is mapped to an IdP attribute, you must set this parameter to true . Amazon Cognito updates mapped attributes when users sign in to your application through an IdP. If an attribute is immutable, Amazon Cognito throws an error when it attempts to update the attribute. For more information, see Specifying Identity Provider Attribute Mappings for Your User Pool .

          • Required (boolean) --

            Specifies whether a user pool attribute is required. If the attribute is required and the user doesn't provide a value, registration or sign-in will fail.

          • NumberAttributeConstraints (dict) --

            Specifies the constraints for an attribute of the number type.

            • MinValue (string) --

              The minimum value of an attribute that is of the number data type.

            • MaxValue (string) --

              The maximum value of an attribute that is of the number data type.

          • StringAttributeConstraints (dict) --

            Specifies the constraints for an attribute of the string type.

            • MinLength (string) --

              The minimum length.

            • MaxLength (string) --

              The maximum length.

      • AutoVerifiedAttributes (list) --

        The attributes that are auto-verified in a user pool.

        • (string) --
      • AliasAttributes (list) --

        The attributes that are aliased in a user pool.

        • (string) --
      • UsernameAttributes (list) --

        Specifies whether a user can use an email address or phone number as a username when they sign up.

        • (string) --
      • SmsVerificationMessage (string) --

        This parameter is no longer used. See VerificationMessageTemplateType .

      • EmailVerificationMessage (string) --

        This parameter is no longer used. See VerificationMessageTemplateType .

      • EmailVerificationSubject (string) --

        This parameter is no longer used. See VerificationMessageTemplateType .

      • VerificationMessageTemplate (dict) --

        The template for verification messages.

        • SmsMessage (string) --

          The template for SMS messages that Amazon Cognito sends to your users.

        • EmailMessage (string) --

          The template for email messages that Amazon Cognito sends to your users. You can set an EmailMessage template only if the value of EmailSendingAccount is DEVELOPER . When your EmailSendingAccount is DEVELOPER , your user pool sends email messages with your own Amazon SES configuration.

        • EmailSubject (string) --

          The subject line for the email message template. You can set an EmailSubject template only if the value of EmailSendingAccount is DEVELOPER . When your EmailSendingAccount is DEVELOPER , your user pool sends email messages with your own Amazon SES configuration.

        • EmailMessageByLink (string) --

          The email message template for sending a confirmation link to the user. You can set an EmailMessageByLink template only if the value of EmailSendingAccount is DEVELOPER . When your EmailSendingAccount is DEVELOPER , your user pool sends email messages with your own Amazon SES configuration.

        • EmailSubjectByLink (string) --

          The subject line for the email message template for sending a confirmation link to the user. You can set an EmailSubjectByLink template only if the value of EmailSendingAccount is DEVELOPER . When your EmailSendingAccount is DEVELOPER , your user pool sends email messages with your own Amazon SES configuration.

        • DefaultEmailOption (string) --

          The default email option.

      • SmsAuthenticationMessage (string) --

        The contents of the SMS authentication message.

      • UserAttributeUpdateSettings (dict) --

        The settings for updates to user attributes. These settings include the property AttributesRequireVerificationBeforeUpdate , a user-pool setting that tells Amazon Cognito how to handle changes to the value of your users' email address and phone number attributes. For more information, see Verifying updates to email addresses and phone numbers .

        • AttributesRequireVerificationBeforeUpdate (list) --

          Requires that your user verifies their email address, phone number, or both before Amazon Cognito updates the value of that attribute. When you update a user attribute that has this option activated, Amazon Cognito sends a verification message to the new phone number or email address. Amazon Cognito doesn’t change the value of the attribute until your user responds to the verification message and confirms the new value.

          You can verify an updated email address or phone number with a VerifyUserAttribute API request. You can also call the UpdateUserAttributes or AdminUpdateUserAttributes API and set email_verified or phone_number_verified to true.

          When AttributesRequireVerificationBeforeUpdate is false, your user pool doesn't require that your users verify attribute changes before Amazon Cognito updates them. In a user pool where AttributesRequireVerificationBeforeUpdate is false, API operations that change attribute values can immediately update a user’s email or phone_number attribute.

          • (string) --
      • MfaConfiguration (string) --

        Can be one of the following values:

        • OFF - MFA tokens aren't required and can't be specified during user registration.
        • ON - MFA tokens are required for all user registrations. You can only specify required when you're initially creating a user pool.
        • OPTIONAL - Users have the option when registering to create an MFA token.
      • DeviceConfiguration (dict) --

        The device-remembering configuration for a user pool. A null value indicates that you have deactivated device remembering in your user pool.

        Note

        When you provide a value for any DeviceConfiguration field, you activate the Amazon Cognito device-remembering feature.

        • ChallengeRequiredOnNewDevice (boolean) --

          When true, a remembered device can sign in with device authentication instead of SMS and time-based one-time password (TOTP) factors for multi-factor authentication (MFA).

          Note

          Whether or not ChallengeRequiredOnNewDevice is true, users who sign in with devices that have not been confirmed or remembered must still provide a second factor in a user pool that requires MFA.

        • DeviceOnlyRememberedOnUserPrompt (boolean) --

          When true, Amazon Cognito doesn't automatically remember a user's device when your app sends a ConfirmDevice API request. In your app, create a prompt for your user to choose whether they want to remember their device. Return the user's choice in an UpdateDeviceStatus API request.

          When DeviceOnlyRememberedOnUserPrompt is false , Amazon Cognito immediately remembers devices that you register in a ConfirmDevice API request.

      • EstimatedNumberOfUsers (integer) --

        A number estimating the size of the user pool.

      • EmailConfiguration (dict) --

        The email configuration of your user pool. The email configuration type sets your preferred sending method, Amazon Web Services Region, and sender for messages tfrom your user pool.

        • SourceArn (string) --

          The ARN of a verified email address in Amazon SES. Amazon Cognito uses this email address in one of the following ways, depending on the value that you specify for the EmailSendingAccount parameter:

          • If you specify COGNITO_DEFAULT , Amazon Cognito uses this address as the custom FROM address when it emails your users using its built-in email account.
          • If you specify DEVELOPER , Amazon Cognito emails your users with this address by calling Amazon SES on your behalf.

          The Region value of the SourceArn parameter must indicate a supported Amazon Web Services Region of your user pool. Typically, the Region in the SourceArn and the user pool Region are the same. For more information, see Amazon SES email configuration regions in the Amazon Cognito Developer Guide .

        • ReplyToEmailAddress (string) --

          The destination to which the receiver of the email should reply.

        • EmailSendingAccount (string) --

          Specifies whether Amazon Cognito uses its built-in functionality to send your users email messages, or uses your Amazon Simple Email Service email configuration. Specify one of the following values:

          COGNITO_DEFAULT

          When Amazon Cognito emails your users, it uses its built-in email functionality. When you use the default option, Amazon Cognito allows only a limited number of emails each day for your user pool. For typical production environments, the default email limit is less than the required delivery volume. To achieve a higher delivery volume, specify DEVELOPER to use your Amazon SES email configuration.

          To look up the email delivery limit for the default option, see Limits in in the Developer Guide .

          The default FROM address is no-reply@verificationemail.com . To customize the FROM address, provide the Amazon Resource Name (ARN) of an Amazon SES verified email address for the SourceArn parameter.

          DEVELOPER

          When Amazon Cognito emails your users, it uses your Amazon SES configuration. Amazon Cognito calls Amazon SES on your behalf to send email from your verified email address. When you use this option, the email delivery limits are the same limits that apply to your Amazon SES verified email address in your Amazon Web Services account.

          If you use this option, provide the ARN of an Amazon SES verified email address for the SourceArn parameter.

          Before Amazon Cognito can email your users, it requires additional permissions to call Amazon SES on your behalf. When you update your user pool with this option, Amazon Cognito creates a service-linked role , which is a type of role, in your Amazon Web Services account. This role contains the permissions that allow to access Amazon SES and send email messages with your address. For more information about the service-linked role that Amazon Cognito creates, see Using Service-Linked Roles for Amazon Cognito in the Amazon Cognito Developer Guide .

        • From (string) --

          Either the sender’s email address or the sender’s name with their email address. For example, testuser@example.com or Test User <testuser@example.com> . This address appears before the body of the email.

        • ConfigurationSet (string) --

          The set of configuration rules that can be applied to emails sent using Amazon Simple Email Service. A configuration set is applied to an email by including a reference to the configuration set in the headers of the email. Once applied, all of the rules in that configuration set are applied to the email. Configuration sets can be used to apply the following types of rules to emails:

          Event publishing

          Amazon Simple Email Service can track the number of send, delivery, open, click, bounce, and complaint events for each email sent. Use event publishing to send information about these events to other Amazon Web Services services such as and Amazon CloudWatch

          IP pool management

          When leasing dedicated IP addresses with Amazon Simple Email Service, you can create groups of IP addresses, called dedicated IP pools. You can then associate the dedicated IP pools with configuration sets.

      • SmsConfiguration (dict) --

        The SMS configuration with the settings that your Amazon Cognito user pool must use to send an SMS message from your Amazon Web Services account through Amazon Simple Notification Service. To send SMS messages with Amazon SNS in the Amazon Web Services Region that you want, the Amazon Cognito user pool uses an Identity and Access Management (IAM) role in your Amazon Web Services account.

        • SnsCallerArn (string) --

          The Amazon Resource Name (ARN) of the Amazon SNS caller. This is the ARN of the IAM role in your Amazon Web Services account that Amazon Cognito will use to send SMS messages. SMS messages are subject to a spending limit .

        • ExternalId (string) --

          The external ID provides additional security for your IAM role. You can use an ExternalId with the IAM role that you use with Amazon SNS to send SMS messages for your user pool. If you provide an ExternalId , your Amazon Cognito user pool includes it in the request to assume your IAM role. You can configure the role trust policy to require that Amazon Cognito, and any principal, provide the ExternalID . If you use the Amazon Cognito Management Console to create a role for SMS multi-factor authentication (MFA), Amazon Cognito creates a role with the required permissions and a trust policy that demonstrates use of the ExternalId .

          For more information about the ExternalId of a role, see How to use an external ID when granting access to your Amazon Web Services resources to a third party

        • SnsRegion (string) --

          The Amazon Web Services Region to use with Amazon SNS integration. You can choose the same Region as your user pool, or a supported Legacy Amazon SNS alternate Region .

          Amazon Cognito resources in the Asia Pacific (Seoul) Amazon Web Services Region must use your Amazon SNS configuration in the Asia Pacific (Tokyo) Region. For more information, see SMS message settings for Amazon Cognito user pools .

      • UserPoolTags (dict) --

        The tags that are assigned to the user pool. A tag is a label that you can apply to user pools to categorize and manage them in different ways, such as by purpose, owner, environment, or other criteria.

        • (string) --
          • (string) --
      • SmsConfigurationFailure (string) --

        The reason why the SMS configuration can't send the messages to your users.

        This message might include comma-separated values to describe why your SMS configuration can't send messages to user pool end users.

        InvalidSmsRoleAccessPolicyException

        The Identity and Access Management role that Amazon Cognito uses to send SMS messages isn't properly configured. For more information, see SmsConfigurationType .

        SNSSandbox

        The Amazon Web Services account is in the SNS SMS Sandbox and messages will only reach verified end users. This parameter won’t get populated with SNSSandbox if the IAM user creating the user pool doesn’t have SNS permissions. To learn how to move your Amazon Web Services account out of the sandbox, see Moving out of the SMS sandbox .

      • EmailConfigurationFailure (string) --

        Deprecated. Review error codes from API requests with EventSource:cognito-idp.amazonaws.com in CloudTrail for information about problems with user pool email configuration.

      • Domain (string) --

        The domain prefix, if the user pool has a domain associated with it.

      • CustomDomain (string) --

        A custom domain name that you provide to Amazon Cognito. This parameter applies only if you use a custom domain to host the sign-up and sign-in pages for your application. An example of a custom domain name might be auth.example.com .

        For more information about adding a custom domain to your user pool, see Using Your Own Domain for the Hosted UI .

      • AdminCreateUserConfig (dict) --

        The configuration for AdminCreateUser requests.

        • AllowAdminCreateUserOnly (boolean) --

          Set to True if only the administrator is allowed to create user profiles. Set to False if users can sign themselves up via an app.

        • UnusedAccountValidityDays (integer) --

          The user account expiration limit, in days, after which a new account that hasn't signed in is no longer usable. To reset the account after that time limit, you must call AdminCreateUser again, specifying "RESEND" for the MessageAction parameter. The default value for this parameter is 7.

          Note

          If you set a value for TemporaryPasswordValidityDays in PasswordPolicy , that value will be used, and UnusedAccountValidityDays will be no longer be an available parameter for that user pool.

        • InviteMessageTemplate (dict) --

          The message template to be used for the welcome message to new users.

          See also Customizing User Invitation Messages .

          • SMSMessage (string) --

            The message template for SMS messages.

          • EmailMessage (string) --

            The message template for email messages. EmailMessage is allowed only if EmailSendingAccount is DEVELOPER.

          • EmailSubject (string) --

            The subject line for email messages. EmailSubject is allowed only if EmailSendingAccount is DEVELOPER.

      • UserPoolAddOns (dict) --

        The user pool add-ons.

        • AdvancedSecurityMode (string) --

          The advanced security mode.

      • UsernameConfiguration (dict) --

        Case sensitivity of the username input for the selected sign-in option. For example, when case sensitivity is set to False , users can sign in using either "username" or "Username". This configuration is immutable once it has been set. For more information, see UsernameConfigurationType .

        • CaseSensitive (boolean) --

          Specifies whether user name case sensitivity will be applied for all users in the user pool through Amazon Cognito APIs.

          Valid values include:

          True

          Enables case sensitivity for all username input. When this option is set to True , users must sign in using the exact capitalization of their given username, such as “UserName”. This is the default value.

          False

          Enables case insensitivity for all username input. For example, when this option is set to False , users can sign in using either "username" or "Username". This option also enables both preferred_username and email alias to be case insensitive, in addition to the username attribute.

      • Arn (string) --

        The Amazon Resource Name (ARN) for the user pool.

      • AccountRecoverySetting (dict) --

        The available verified method a user can use to recover their password when they call ForgotPassword . You can use this setting to define a preferred method when a user has more than one method available. With this setting, SMS doesn't qualify for a valid password recovery mechanism if the user also has SMS multi-factor authentication (MFA) activated. In the absence of this setting, Amazon Cognito uses the legacy behavior to determine the recovery method where SMS is preferred through email.

        • RecoveryMechanisms (list) --

          The list of RecoveryOptionTypes .

          • (dict) --

            A map containing a priority as a key, and recovery method name as a value.

            • Priority (integer) --

              A positive integer specifying priority of a method with 1 being the highest priority.

            • Name (string) --

              The recovery method for a user.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.LimitExceededException
  • CognitoIdentityProvider.Client.exceptions.InvalidSmsRoleAccessPolicyException
  • CognitoIdentityProvider.Client.exceptions.InvalidSmsRoleTrustRelationshipException
  • CognitoIdentityProvider.Client.exceptions.InvalidEmailRoleAccessPolicyException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.UserPoolTaggingException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
create_user_pool_client(**kwargs)

Creates the user pool client.

When you create a new user pool client, token revocation is automatically activated. For more information about revoking tokens, see RevokeToken .

See also: AWS API Documentation

Request Syntax

response = client.create_user_pool_client(
    UserPoolId='string',
    ClientName='string',
    GenerateSecret=True|False,
    RefreshTokenValidity=123,
    AccessTokenValidity=123,
    IdTokenValidity=123,
    TokenValidityUnits={
        'AccessToken': 'seconds'|'minutes'|'hours'|'days',
        'IdToken': 'seconds'|'minutes'|'hours'|'days',
        'RefreshToken': 'seconds'|'minutes'|'hours'|'days'
    },
    ReadAttributes=[
        'string',
    ],
    WriteAttributes=[
        'string',
    ],
    ExplicitAuthFlows=[
        'ADMIN_NO_SRP_AUTH'|'CUSTOM_AUTH_FLOW_ONLY'|'USER_PASSWORD_AUTH'|'ALLOW_ADMIN_USER_PASSWORD_AUTH'|'ALLOW_CUSTOM_AUTH'|'ALLOW_USER_PASSWORD_AUTH'|'ALLOW_USER_SRP_AUTH'|'ALLOW_REFRESH_TOKEN_AUTH',
    ],
    SupportedIdentityProviders=[
        'string',
    ],
    CallbackURLs=[
        'string',
    ],
    LogoutURLs=[
        'string',
    ],
    DefaultRedirectURI='string',
    AllowedOAuthFlows=[
        'code'|'implicit'|'client_credentials',
    ],
    AllowedOAuthScopes=[
        'string',
    ],
    AllowedOAuthFlowsUserPoolClient=True|False,
    AnalyticsConfiguration={
        'ApplicationId': 'string',
        'ApplicationArn': 'string',
        'RoleArn': 'string',
        'ExternalId': 'string',
        'UserDataShared': True|False
    },
    PreventUserExistenceErrors='LEGACY'|'ENABLED',
    EnableTokenRevocation=True|False,
    EnablePropagateAdditionalUserContextData=True|False,
    AuthSessionValidity=123
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool where you want to create a user pool client.

  • ClientName (string) --

    [REQUIRED]

    The client name for the user pool client you would like to create.

  • GenerateSecret (boolean) -- Boolean to specify whether you want to generate a secret for the user pool client being created.
  • RefreshTokenValidity (integer) --

    The refresh token time limit. After this limit expires, your user can't use their refresh token. To specify the time unit for RefreshTokenValidity as seconds , minutes , hours , or days , set a TokenValidityUnits value in your API request.

    For example, when you set RefreshTokenValidity as 10 and TokenValidityUnits as days , your user can refresh their session and retrieve new access and ID tokens for 10 days.

    The default time unit for RefreshTokenValidity in an API request is days. You can't set RefreshTokenValidity to 0. If you do, Amazon Cognito overrides the value with the default value of 30 days. Valid range is displayed below in seconds.

  • AccessTokenValidity (integer) --

    The access token time limit. After this limit expires, your user can't use their access token. To specify the time unit for AccessTokenValidity as seconds , minutes , hours , or days , set a TokenValidityUnits value in your API request.

    For example, when you set AccessTokenValidity to 10 and TokenValidityUnits to hours , your user can authorize access with their access token for 10 hours.

    The default time unit for AccessTokenValidity in an API request is hours. Valid range is displayed below in seconds.

  • IdTokenValidity (integer) --

    The ID token time limit. After this limit expires, your user can't use their ID token. To specify the time unit for IdTokenValidity as seconds , minutes , hours , or days , set a TokenValidityUnits value in your API request.

    For example, when you set IdTokenValidity as 10 and TokenValidityUnits as hours , your user can authenticate their session with their ID token for 10 hours.

    The default time unit for AccessTokenValidity in an API request is hours. Valid range is displayed below in seconds.

  • TokenValidityUnits (dict) --

    The units in which the validity times are represented. The default unit for RefreshToken is days, and default for ID and access tokens are hours.

    • AccessToken (string) --

      A time unit of seconds , minutes , hours , or days for the value that you set in the AccessTokenValidity parameter. The default AccessTokenValidity time unit is hours.

    • IdToken (string) --

      A time unit of seconds , minutes , hours , or days for the value that you set in the IdTokenValidity parameter. The default IdTokenValidity time unit is hours.

    • RefreshToken (string) --

      A time unit of seconds , minutes , hours , or days for the value that you set in the RefreshTokenValidity parameter. The default RefreshTokenValidity time unit is days.

  • ReadAttributes (list) --

    The read attributes.

    • (string) --
  • WriteAttributes (list) --

    The user pool attributes that the app client can write to.

    If your app client allows users to sign in through an IdP, this array must include all attributes that you have mapped to IdP attributes. Amazon Cognito updates mapped attributes when users sign in to your application through an IdP. If your app client does not have write access to a mapped attribute, Amazon Cognito throws an error when it tries to update the attribute. For more information, see Specifying IdP Attribute Mappings for Your user pool .

    • (string) --
  • ExplicitAuthFlows (list) --

    The authentication flows that are supported by the user pool clients. Flow names without the ALLOW_ prefix are no longer supported, in favor of new names with the ALLOW_ prefix.

    Note

    Values with ALLOW_ prefix must be used only along with the ALLOW_ prefix.

    Valid values include:

    ALLOW_ADMIN_USER_PASSWORD_AUTH

    Enable admin based user password authentication flow ADMIN_USER_PASSWORD_AUTH . This setting replaces the ADMIN_NO_SRP_AUTH setting. With this authentication flow, Amazon Cognito receives the password in the request instead of using the Secure Remote Password (SRP) protocol to verify passwords.

    ALLOW_CUSTOM_AUTH

    Enable Lambda trigger based authentication.

    ALLOW_USER_PASSWORD_AUTH

    Enable user password-based authentication. In this flow, Amazon Cognito receives the password in the request instead of using the SRP protocol to verify passwords.

    ALLOW_USER_SRP_AUTH

    Enable SRP-based authentication.

    ALLOW_REFRESH_TOKEN_AUTH

    Enable the authflow that refreshes tokens.

    If you don't specify a value for ExplicitAuthFlows , your user client supports ALLOW_USER_SRP_AUTH and ALLOW_CUSTOM_AUTH .

    • (string) --
  • SupportedIdentityProviders (list) --

    A list of provider names for the identity providers (IdPs) that are supported on this client. The following are supported: COGNITO , Facebook , Google , SignInWithApple , and LoginWithAmazon . You can also specify the names that you configured for the SAML and OIDC IdPs in your user pool, for example MySAMLIdP or MyOIDCIdP .

    • (string) --
  • CallbackURLs (list) --

    A list of allowed redirect (callback) URLs for the IdPs.

    A redirect URI must:

    • Be an absolute URI.
    • Be registered with the authorization server.
    • Not include a fragment component.

    See OAuth 2.0 - Redirection Endpoint .

    Amazon Cognito requires HTTPS over HTTP except for http://localhost for testing purposes only.

    App callback URLs such as myapp://example are also supported.

    • (string) --
  • LogoutURLs (list) --

    A list of allowed logout URLs for the IdPs.

    • (string) --
  • DefaultRedirectURI (string) --

    The default redirect URI. Must be in the CallbackURLs list.

    A redirect URI must:

    • Be an absolute URI.
    • Be registered with the authorization server.
    • Not include a fragment component.

    See OAuth 2.0 - Redirection Endpoint .

    Amazon Cognito requires HTTPS over HTTP except for http://localhost for testing purposes only.

    App callback URLs such as myapp://example are also supported.

  • AllowedOAuthFlows (list) --

    The allowed OAuth flows.

    code

    Use a code grant flow, which provides an authorization code as the response. This code can be exchanged for access tokens with the /oauth2/token endpoint.

    implicit

    Issue the access token (and, optionally, ID token, based on scopes) directly to your user.

    client_credentials

    Issue the access token from the /oauth2/token endpoint directly to a non-person user using a combination of the client ID and client secret.

    • (string) --
  • AllowedOAuthScopes (list) --

    The allowed OAuth scopes. Possible values provided by OAuth are phone , email , openid , and profile . Possible values provided by Amazon Web Services are aws.cognito.signin.user.admin . Custom scopes created in Resource Servers are also supported.

    • (string) --
  • AllowedOAuthFlowsUserPoolClient (boolean) -- Set to true if the client is allowed to follow the OAuth protocol when interacting with Amazon Cognito user pools.
  • AnalyticsConfiguration (dict) --

    The user pool analytics configuration for collecting metrics and sending them to your Amazon Pinpoint campaign.

    Note

    In Amazon Web Services Regions where Amazon Pinpoint isn't available, user pools only support sending events to Amazon Pinpoint projects in Amazon Web Services Region us-east-1. In Regions where Amazon Pinpoint is available, user pools support sending events to Amazon Pinpoint projects within that same Region.

    • ApplicationId (string) --

      The application ID for an Amazon Pinpoint application.

    • ApplicationArn (string) --

      The Amazon Resource Name (ARN) of an Amazon Pinpoint project. You can use the Amazon Pinpoint project to integrate with the chosen user pool Client. Amazon Cognito publishes events to the Amazon Pinpoint project that the app ARN declares.

    • RoleArn (string) --

      The ARN of an Identity and Access Management role that authorizes Amazon Cognito to publish events to Amazon Pinpoint analytics.

    • ExternalId (string) --

      The external ID.

    • UserDataShared (boolean) --

      If UserDataShared is true , Amazon Cognito includes user data in the events that it publishes to Amazon Pinpoint analytics.

  • PreventUserExistenceErrors (string) --

    Errors and responses that you want Amazon Cognito APIs to return during authentication, account confirmation, and password recovery when the user doesn't exist in the user pool. When set to ENABLED and the user doesn't exist, authentication returns an error indicating either the username or password was incorrect. Account confirmation and password recovery return a response indicating a code was sent to a simulated destination. When set to LEGACY , those APIs return a UserNotFoundException exception if the user doesn't exist in the user pool.

    Valid values include:

    • ENABLED - This prevents user existence-related errors.
    • LEGACY - This represents the early behavior of Amazon Cognito where user existence related errors aren't prevented.
  • EnableTokenRevocation (boolean) --

    Activates or deactivates token revocation. For more information about revoking tokens, see RevokeToken .

    If you don't include this parameter, token revocation is automatically activated for the new user pool client.

  • EnablePropagateAdditionalUserContextData (boolean) -- Activates the propagation of additional user context data. For more information about propagation of user context data, see Adding advanced security to a user pool . If you don’t include this parameter, you can't send device fingerprint information, including source IP address, to Amazon Cognito advanced security. You can only activate EnablePropagateAdditionalUserContextData in an app client that has a client secret.
  • AuthSessionValidity (integer) -- Amazon Cognito creates a session token for each API request in an authentication flow. AuthSessionValidity is the duration, in minutes, of that session token. Your user pool native user must respond to each authentication challenge before the session expires.
Return type

dict

Returns

Response Syntax

{
    'UserPoolClient': {
        'UserPoolId': 'string',
        'ClientName': 'string',
        'ClientId': 'string',
        'ClientSecret': 'string',
        'LastModifiedDate': datetime(2015, 1, 1),
        'CreationDate': datetime(2015, 1, 1),
        'RefreshTokenValidity': 123,
        'AccessTokenValidity': 123,
        'IdTokenValidity': 123,
        'TokenValidityUnits': {
            'AccessToken': 'seconds'|'minutes'|'hours'|'days',
            'IdToken': 'seconds'|'minutes'|'hours'|'days',
            'RefreshToken': 'seconds'|'minutes'|'hours'|'days'
        },
        'ReadAttributes': [
            'string',
        ],
        'WriteAttributes': [
            'string',
        ],
        'ExplicitAuthFlows': [
            'ADMIN_NO_SRP_AUTH'|'CUSTOM_AUTH_FLOW_ONLY'|'USER_PASSWORD_AUTH'|'ALLOW_ADMIN_USER_PASSWORD_AUTH'|'ALLOW_CUSTOM_AUTH'|'ALLOW_USER_PASSWORD_AUTH'|'ALLOW_USER_SRP_AUTH'|'ALLOW_REFRESH_TOKEN_AUTH',
        ],
        'SupportedIdentityProviders': [
            'string',
        ],
        'CallbackURLs': [
            'string',
        ],
        'LogoutURLs': [
            'string',
        ],
        'DefaultRedirectURI': 'string',
        'AllowedOAuthFlows': [
            'code'|'implicit'|'client_credentials',
        ],
        'AllowedOAuthScopes': [
            'string',
        ],
        'AllowedOAuthFlowsUserPoolClient': True|False,
        'AnalyticsConfiguration': {
            'ApplicationId': 'string',
            'ApplicationArn': 'string',
            'RoleArn': 'string',
            'ExternalId': 'string',
            'UserDataShared': True|False
        },
        'PreventUserExistenceErrors': 'LEGACY'|'ENABLED',
        'EnableTokenRevocation': True|False,
        'EnablePropagateAdditionalUserContextData': True|False,
        'AuthSessionValidity': 123
    }
}

Response Structure

  • (dict) --

    Represents the response from the server to create a user pool client.

    • UserPoolClient (dict) --

      The user pool client that was just created.

      • UserPoolId (string) --

        The user pool ID for the user pool client.

      • ClientName (string) --

        The client name from the user pool request of the client type.

      • ClientId (string) --

        The ID of the client associated with the user pool.

      • ClientSecret (string) --

        The client secret from the user pool request of the client type.

      • LastModifiedDate (datetime) --

        The date the user pool client was last modified.

      • CreationDate (datetime) --

        The date the user pool client was created.

      • RefreshTokenValidity (integer) --

        The refresh token time limit. After this limit expires, your user can't use their refresh token. To specify the time unit for RefreshTokenValidity as seconds , minutes , hours , or days , set a TokenValidityUnits value in your API request.

        For example, when you set RefreshTokenValidity as 10 and TokenValidityUnits as days , your user can refresh their session and retrieve new access and ID tokens for 10 days.

        The default time unit for RefreshTokenValidity in an API request is days. You can't set RefreshTokenValidity to 0. If you do, Amazon Cognito overrides the value with the default value of 30 days. Valid range is displayed below in seconds.

      • AccessTokenValidity (integer) --

        The access token time limit. After this limit expires, your user can't use their access token. To specify the time unit for AccessTokenValidity as seconds , minutes , hours , or days , set a TokenValidityUnits value in your API request.

        For example, when you set AccessTokenValidity to 10 and TokenValidityUnits to hours , your user can authorize access with their access token for 10 hours.

        The default time unit for AccessTokenValidity in an API request is hours. Valid range is displayed below in seconds.

      • IdTokenValidity (integer) --

        The ID token time limit. After this limit expires, your user can't use their ID token. To specify the time unit for IdTokenValidity as seconds , minutes , hours , or days , set a TokenValidityUnits value in your API request.

        For example, when you set IdTokenValidity as 10 and TokenValidityUnits as hours , your user can authenticate their session with their ID token for 10 hours.

        The default time unit for AccessTokenValidity in an API request is hours. Valid range is displayed below in seconds.

      • TokenValidityUnits (dict) --

        The time units used to specify the token validity times of each token type: ID, access, and refresh.

        • AccessToken (string) --

          A time unit of seconds , minutes , hours , or days for the value that you set in the AccessTokenValidity parameter. The default AccessTokenValidity time unit is hours.

        • IdToken (string) --

          A time unit of seconds , minutes , hours , or days for the value that you set in the IdTokenValidity parameter. The default IdTokenValidity time unit is hours.

        • RefreshToken (string) --

          A time unit of seconds , minutes , hours , or days for the value that you set in the RefreshTokenValidity parameter. The default RefreshTokenValidity time unit is days.

      • ReadAttributes (list) --

        The Read-only attributes.

        • (string) --
      • WriteAttributes (list) --

        The writeable attributes.

        • (string) --
      • ExplicitAuthFlows (list) --

        The authentication flows that are supported by the user pool clients. Flow names without the ALLOW_ prefix are no longer supported in favor of new names with the ALLOW_ prefix. Note that values with ALLOW_ prefix must be used only along with values including the ALLOW_ prefix.

        Valid values include:

        • ALLOW_ADMIN_USER_PASSWORD_AUTH : Enable admin based user password authentication flow ADMIN_USER_PASSWORD_AUTH . This setting replaces the ADMIN_NO_SRP_AUTH setting. With this authentication flow, Amazon Cognito receives the password in the request instead of using the Secure Remote Password (SRP) protocol to verify passwords.
        • ALLOW_CUSTOM_AUTH : Enable Lambda trigger based authentication.
        • ALLOW_USER_PASSWORD_AUTH : Enable user password-based authentication. In this flow, Amazon Cognito receives the password in the request instead of using the SRP protocol to verify passwords.
        • ALLOW_USER_SRP_AUTH : Enable SRP-based authentication.
        • ALLOW_REFRESH_TOKEN_AUTH : Enable authflow to refresh tokens.
        • (string) --
      • SupportedIdentityProviders (list) --

        A list of provider names for the IdPs that this client supports. The following are supported: COGNITO , Facebook , Google , SignInWithApple , LoginWithAmazon , and the names of your own SAML and OIDC providers.

        • (string) --
      • CallbackURLs (list) --

        A list of allowed redirect (callback) URLs for the IdPs.

        A redirect URI must:

        • Be an absolute URI.
        • Be registered with the authorization server.
        • Not include a fragment component.

        See OAuth 2.0 - Redirection Endpoint .

        Amazon Cognito requires HTTPS over HTTP except for http://localhost for testing purposes only.

        App callback URLs such as myapp://example are also supported.

        • (string) --
      • LogoutURLs (list) --

        A list of allowed logout URLs for the IdPs.

        • (string) --
      • DefaultRedirectURI (string) --

        The default redirect URI. Must be in the CallbackURLs list.

        A redirect URI must:

        • Be an absolute URI.
        • Be registered with the authorization server.
        • Not include a fragment component.

        See OAuth 2.0 - Redirection Endpoint .

        Amazon Cognito requires HTTPS over HTTP except for http://localhost for testing purposes only.

        App callback URLs such as myapp://example are also supported.

      • AllowedOAuthFlows (list) --

        The allowed OAuth flows.

        code

        Use a code grant flow, which provides an authorization code as the response. This code can be exchanged for access tokens with the /oauth2/token endpoint.

        implicit

        Issue the access token (and, optionally, ID token, based on scopes) directly to your user.

        client_credentials

        Issue the access token from the /oauth2/token endpoint directly to a non-person user using a combination of the client ID and client secret.

        • (string) --
      • AllowedOAuthScopes (list) --

        The OAuth scopes that your app client supports. Possible values that OAuth provides are phone , email , openid , and profile . Possible values that Amazon Web Services provides are aws.cognito.signin.user.admin . Amazon Cognito also supports custom scopes that you create in Resource Servers.

        • (string) --
      • AllowedOAuthFlowsUserPoolClient (boolean) --

        Set to true if the client is allowed to follow the OAuth protocol when interacting with Amazon Cognito user pools.

      • AnalyticsConfiguration (dict) --

        The Amazon Pinpoint analytics configuration for the user pool client.

        Note

        Amazon Cognito user pools only support sending events to Amazon Pinpoint projects in the US East (N. Virginia) us-east-1 Region, regardless of the Region where the user pool resides.

        • ApplicationId (string) --

          The application ID for an Amazon Pinpoint application.

        • ApplicationArn (string) --

          The Amazon Resource Name (ARN) of an Amazon Pinpoint project. You can use the Amazon Pinpoint project to integrate with the chosen user pool Client. Amazon Cognito publishes events to the Amazon Pinpoint project that the app ARN declares.

        • RoleArn (string) --

          The ARN of an Identity and Access Management role that authorizes Amazon Cognito to publish events to Amazon Pinpoint analytics.

        • ExternalId (string) --

          The external ID.

        • UserDataShared (boolean) --

          If UserDataShared is true , Amazon Cognito includes user data in the events that it publishes to Amazon Pinpoint analytics.

      • PreventUserExistenceErrors (string) --

        Errors and responses that you want Amazon Cognito APIs to return during authentication, account confirmation, and password recovery when the user doesn't exist in the user pool. When set to ENABLED and the user doesn't exist, authentication returns an error indicating either the username or password was incorrect. Account confirmation and password recovery return a response indicating a code was sent to a simulated destination. When set to LEGACY , those APIs return a UserNotFoundException exception if the user doesn't exist in the user pool.

        Valid values include:

        • ENABLED - This prevents user existence-related errors.
        • LEGACY - This represents the old behavior of Amazon Cognito where user existence related errors aren't prevented.
      • EnableTokenRevocation (boolean) --

        Indicates whether token revocation is activated for the user pool client. When you create a new user pool client, token revocation is activated by default. For more information about revoking tokens, see RevokeToken .

      • EnablePropagateAdditionalUserContextData (boolean) --

        When EnablePropagateAdditionalUserContextData is true, Amazon Cognito accepts an IpAddress value that you send in the UserContextData parameter. The UserContextData parameter sends information to Amazon Cognito advanced security for risk analysis. You can send UserContextData when you sign in Amazon Cognito native users with the InitiateAuth and RespondToAuthChallenge API operations.

        When EnablePropagateAdditionalUserContextData is false, you can't send your user's source IP address to Amazon Cognito advanced security with unauthenticated API operations. EnablePropagateAdditionalUserContextData doesn't affect whether you can send a source IP address in a ContextData parameter with the authenticated API operations AdminInitiateAuth and AdminRespondToAuthChallenge .

        You can only activate EnablePropagateAdditionalUserContextData in an app client that has a client secret. For more information about propagation of user context data, see Adding user device and session data to API requests .

      • AuthSessionValidity (integer) --

        Amazon Cognito creates a session token for each API request in an authentication flow. AuthSessionValidity is the duration, in minutes, of that session token. Your user pool native user must respond to each authentication challenge before the session expires.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.LimitExceededException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.ScopeDoesNotExistException
  • CognitoIdentityProvider.Client.exceptions.InvalidOAuthFlowException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
create_user_pool_domain(**kwargs)

Creates a new domain for a user pool.

See also: AWS API Documentation

Request Syntax

response = client.create_user_pool_domain(
    Domain='string',
    UserPoolId='string',
    CustomDomainConfig={
        'CertificateArn': 'string'
    }
)
Parameters
  • Domain (string) --

    [REQUIRED]

    The domain string. For custom domains, this is the fully-qualified domain name, such as auth.example.com . For Amazon Cognito prefix domains, this is the prefix alone, such as auth .

  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID.

  • CustomDomainConfig (dict) --

    The configuration for a custom domain that hosts the sign-up and sign-in webpages for your application.

    Provide this parameter only if you want to use a custom domain for your user pool. Otherwise, you can exclude this parameter and use the Amazon Cognito hosted domain instead.

    For more information about the hosted domain and custom domains, see Configuring a User Pool Domain .

    • CertificateArn (string) -- [REQUIRED]

      The Amazon Resource Name (ARN) of an Certificate Manager SSL certificate. You use this certificate for the subdomain of your custom domain.

Return type

dict

Returns

Response Syntax

{
    'CloudFrontDomain': 'string'
}

Response Structure

  • (dict) --

    • CloudFrontDomain (string) --

      The Amazon CloudFront endpoint that you use as the target of the alias that you set up with your Domain Name Service (DNS) provider.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.LimitExceededException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
delete_group(**kwargs)

Deletes a group.

Calling this action requires developer credentials.

See also: AWS API Documentation

Request Syntax

response = client.delete_group(
    GroupName='string',
    UserPoolId='string'
)
Parameters
  • GroupName (string) --

    [REQUIRED]

    The name of the group.

  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool.

Returns

None

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
delete_identity_provider(**kwargs)

Deletes an IdP for a user pool.

See also: AWS API Documentation

Request Syntax

response = client.delete_identity_provider(
    UserPoolId='string',
    ProviderName='string'
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID.

  • ProviderName (string) --

    [REQUIRED]

    The IdP name.

Returns

None

Exceptions

  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.UnsupportedIdentityProviderException
  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
delete_resource_server(**kwargs)

Deletes a resource server.

See also: AWS API Documentation

Request Syntax

response = client.delete_resource_server(
    UserPoolId='string',
    Identifier='string'
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool that hosts the resource server.

  • Identifier (string) --

    [REQUIRED]

    The identifier for the resource server.

Returns

None

Exceptions

  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
delete_user(**kwargs)

Allows a user to delete himself or herself.

See also: AWS API Documentation

Request Syntax

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

[REQUIRED]

A valid access token that Amazon Cognito issued to the user whose user profile you want to delete.

Returns
None

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
delete_user_attributes(**kwargs)

Deletes the attributes for a user.

See also: AWS API Documentation

Request Syntax

response = client.delete_user_attributes(
    UserAttributeNames=[
        'string',
    ],
    AccessToken='string'
)
Parameters
  • UserAttributeNames (list) --

    [REQUIRED]

    An array of strings representing the user attribute names you want to delete.

    For custom attributes, you must prependattach the custom: prefix to the front of the attribute name.

    • (string) --
  • AccessToken (string) --

    [REQUIRED]

    A valid access token that Amazon Cognito issued to the user whose attributes you want to delete.

Return type

dict

Returns

Response Syntax

{}

Response Structure

  • (dict) --

    Represents the response from the server to delete user attributes.

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
delete_user_pool(**kwargs)

Deletes the specified Amazon Cognito user pool.

See also: AWS API Documentation

Request Syntax

response = client.delete_user_pool(
    UserPoolId='string'
)
Parameters
UserPoolId (string) --

[REQUIRED]

The user pool ID for the user pool you want to delete.

Returns
None

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.UserImportInProgressException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
delete_user_pool_client(**kwargs)

Allows the developer to delete the user pool client.

See also: AWS API Documentation

Request Syntax

response = client.delete_user_pool_client(
    UserPoolId='string',
    ClientId='string'
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool where you want to delete the client.

  • ClientId (string) --

    [REQUIRED]

    The app client ID of the app associated with the user pool.

Returns

None

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
delete_user_pool_domain(**kwargs)

Deletes a domain for a user pool.

See also: AWS API Documentation

Request Syntax

response = client.delete_user_pool_domain(
    Domain='string',
    UserPoolId='string'
)
Parameters
  • Domain (string) --

    [REQUIRED]

    The domain string. For custom domains, this is the fully-qualified domain name, such as auth.example.com . For Amazon Cognito prefix domains, this is the prefix alone, such as auth .

  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID.

Return type

dict

Returns

Response Syntax

{}

Response Structure

  • (dict) --

Exceptions

  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
describe_identity_provider(**kwargs)

Gets information about a specific IdP.

See also: AWS API Documentation

Request Syntax

response = client.describe_identity_provider(
    UserPoolId='string',
    ProviderName='string'
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID.

  • ProviderName (string) --

    [REQUIRED]

    The IdP name.

Return type

dict

Returns

Response Syntax

{
    'IdentityProvider': {
        'UserPoolId': 'string',
        'ProviderName': 'string',
        'ProviderType': 'SAML'|'Facebook'|'Google'|'LoginWithAmazon'|'SignInWithApple'|'OIDC',
        'ProviderDetails': {
            'string': 'string'
        },
        'AttributeMapping': {
            'string': 'string'
        },
        'IdpIdentifiers': [
            'string',
        ],
        'LastModifiedDate': datetime(2015, 1, 1),
        'CreationDate': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) --

    • IdentityProvider (dict) --

      The IdP that was deleted.

      • UserPoolId (string) --

        The user pool ID.

      • ProviderName (string) --

        The IdP name.

      • ProviderType (string) --

        The IdP type.

      • ProviderDetails (dict) --

        The IdP details. The following list describes the provider detail keys for each IdP type.

        • For Google and Login with Amazon:
          • client_id
          • client_secret
          • authorize_scopes
        • For Facebook:
          • client_id
          • client_secret
          • authorize_scopes
          • api_version
        • For Sign in with Apple:
          • client_id
          • team_id
          • key_id
          • private_key You can submit a private_key when you add or update an IdP. Describe operations don't return the private key.
          • authorize_scopes
        • For OIDC providers:
          • client_id
          • client_secret
          • attributes_request_method
          • oidc_issuer
          • authorize_scopes
          • The following keys are only present if Amazon Cognito didn't discover them at the oidc_issuer URL.
            • authorize_url
            • token_url
            • attributes_url
            • jwks_uri
          • Amazon Cognito sets the value of the following keys automatically. They are read-only.
            • attributes_url_add_attributes
        • For SAML providers:
          • MetadataFile or MetadataURL
          • IDPSignout optional
        • (string) --
          • (string) --
      • AttributeMapping (dict) --

        A mapping of IdP attributes to standard and custom user pool attributes.

        • (string) --
          • (string) --
      • IdpIdentifiers (list) --

        A list of IdP identifiers.

        • (string) --
      • LastModifiedDate (datetime) --

        The date the IdP was last modified.

      • CreationDate (datetime) --

        The date the IdP was created.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
describe_resource_server(**kwargs)

Describes a resource server.

See also: AWS API Documentation

Request Syntax

response = client.describe_resource_server(
    UserPoolId='string',
    Identifier='string'
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool that hosts the resource server.

  • Identifier (string) --

    [REQUIRED]

    The identifier for the resource server

Return type

dict

Returns

Response Syntax

{
    'ResourceServer': {
        'UserPoolId': 'string',
        'Identifier': 'string',
        'Name': 'string',
        'Scopes': [
            {
                'ScopeName': 'string',
                'ScopeDescription': 'string'
            },
        ]
    }
}

Response Structure

  • (dict) --

    • ResourceServer (dict) --

      The resource server.

      • UserPoolId (string) --

        The user pool ID for the user pool that hosts the resource server.

      • Identifier (string) --

        The identifier for the resource server.

      • Name (string) --

        The name of the resource server.

      • Scopes (list) --

        A list of scopes that are defined for the resource server.

        • (dict) --

          A resource server scope.

          • ScopeName (string) --

            The name of the scope.

          • ScopeDescription (string) --

            A description of the scope.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
describe_risk_configuration(**kwargs)

Describes the risk configuration.

See also: AWS API Documentation

Request Syntax

response = client.describe_risk_configuration(
    UserPoolId='string',
    ClientId='string'
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID.

  • ClientId (string) -- The app client ID.
Return type

dict

Returns

Response Syntax

{
    'RiskConfiguration': {
        'UserPoolId': 'string',
        'ClientId': 'string',
        'CompromisedCredentialsRiskConfiguration': {
            'EventFilter': [
                'SIGN_IN'|'PASSWORD_CHANGE'|'SIGN_UP',
            ],
            'Actions': {
                'EventAction': 'BLOCK'|'NO_ACTION'
            }
        },
        'AccountTakeoverRiskConfiguration': {
            'NotifyConfiguration': {
                'From': 'string',
                'ReplyTo': 'string',
                'SourceArn': 'string',
                'BlockEmail': {
                    'Subject': 'string',
                    'HtmlBody': 'string',
                    'TextBody': 'string'
                },
                'NoActionEmail': {
                    'Subject': 'string',
                    'HtmlBody': 'string',
                    'TextBody': 'string'
                },
                'MfaEmail': {
                    'Subject': 'string',
                    'HtmlBody': 'string',
                    'TextBody': 'string'
                }
            },
            'Actions': {
                'LowAction': {
                    'Notify': True|False,
                    'EventAction': 'BLOCK'|'MFA_IF_CONFIGURED'|'MFA_REQUIRED'|'NO_ACTION'
                },
                'MediumAction': {
                    'Notify': True|False,
                    'EventAction': 'BLOCK'|'MFA_IF_CONFIGURED'|'MFA_REQUIRED'|'NO_ACTION'
                },
                'HighAction': {
                    'Notify': True|False,
                    'EventAction': 'BLOCK'|'MFA_IF_CONFIGURED'|'MFA_REQUIRED'|'NO_ACTION'
                }
            }
        },
        'RiskExceptionConfiguration': {
            'BlockedIPRangeList': [
                'string',
            ],
            'SkippedIPRangeList': [
                'string',
            ]
        },
        'LastModifiedDate': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) --

    • RiskConfiguration (dict) --

      The risk configuration.

      • UserPoolId (string) --

        The user pool ID.

      • ClientId (string) --

        The app client ID.

      • CompromisedCredentialsRiskConfiguration (dict) --

        The compromised credentials risk configuration object, including the EventFilter and the EventAction .

        • EventFilter (list) --

          Perform the action for these events. The default is to perform all events if no event filter is specified.

          • (string) --
        • Actions (dict) --

          The compromised credentials risk configuration actions.

          • EventAction (string) --

            The event action.

      • AccountTakeoverRiskConfiguration (dict) --

        The account takeover risk configuration object, including the NotifyConfiguration object and Actions to take if there is an account takeover.

        • NotifyConfiguration (dict) --

          The notify configuration used to construct email notifications.

          • From (string) --

            The email address that is sending the email. The address must be either individually verified with Amazon Simple Email Service, or from a domain that has been verified with Amazon SES.

          • ReplyTo (string) --

            The destination to which the receiver of an email should reply to.

          • SourceArn (string) --

            The Amazon Resource Name (ARN) of the identity that is associated with the sending authorization policy. This identity permits Amazon Cognito to send for the email address specified in the From parameter.

          • BlockEmail (dict) --

            Email template used when a detected risk event is blocked.

            • Subject (string) --

              The email subject.

            • HtmlBody (string) --

              The email HTML body.

            • TextBody (string) --

              The email text body.

          • NoActionEmail (dict) --

            The email template used when a detected risk event is allowed.

            • Subject (string) --

              The email subject.

            • HtmlBody (string) --

              The email HTML body.

            • TextBody (string) --

              The email text body.

          • MfaEmail (dict) --

            The multi-factor authentication (MFA) email template used when MFA is challenged as part of a detected risk.

            • Subject (string) --

              The email subject.

            • HtmlBody (string) --

              The email HTML body.

            • TextBody (string) --

              The email text body.

        • Actions (dict) --

          Account takeover risk configuration actions.

          • LowAction (dict) --

            Action to take for a low risk.

            • Notify (boolean) --

              Flag specifying whether to send a notification.

            • EventAction (string) --

              The action to take in response to the account takeover action. Valid values are as follows:

              • BLOCK Choosing this action will block the request.
              • MFA_IF_CONFIGURED Present an MFA challenge if user has configured it, else allow the request.
              • MFA_REQUIRED Present an MFA challenge if user has configured it, else block the request.
              • NO_ACTION Allow the user to sign in.
          • MediumAction (dict) --

            Action to take for a medium risk.

            • Notify (boolean) --

              Flag specifying whether to send a notification.

            • EventAction (string) --

              The action to take in response to the account takeover action. Valid values are as follows:

              • BLOCK Choosing this action will block the request.
              • MFA_IF_CONFIGURED Present an MFA challenge if user has configured it, else allow the request.
              • MFA_REQUIRED Present an MFA challenge if user has configured it, else block the request.
              • NO_ACTION Allow the user to sign in.
          • HighAction (dict) --

            Action to take for a high risk.

            • Notify (boolean) --

              Flag specifying whether to send a notification.

            • EventAction (string) --

              The action to take in response to the account takeover action. Valid values are as follows:

              • BLOCK Choosing this action will block the request.
              • MFA_IF_CONFIGURED Present an MFA challenge if user has configured it, else allow the request.
              • MFA_REQUIRED Present an MFA challenge if user has configured it, else block the request.
              • NO_ACTION Allow the user to sign in.
      • RiskExceptionConfiguration (dict) --

        The configuration to override the risk decision.

        • BlockedIPRangeList (list) --

          Overrides the risk decision to always block the pre-authentication requests. The IP range is in CIDR notation, a compact representation of an IP address and its routing prefix.

          • (string) --
        • SkippedIPRangeList (list) --

          Risk detection isn't performed on the IP addresses in this range list. The IP range is in CIDR notation.

          • (string) --
      • LastModifiedDate (datetime) --

        The last modified date.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.UserPoolAddOnNotEnabledException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
describe_user_import_job(**kwargs)

Describes the user import job.

See also: AWS API Documentation

Request Syntax

response = client.describe_user_import_job(
    UserPoolId='string',
    JobId='string'
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool that the users are being imported into.

  • JobId (string) --

    [REQUIRED]

    The job ID for the user import job.

Return type

dict

Returns

Response Syntax

{
    'UserImportJob': {
        'JobName': 'string',
        'JobId': 'string',
        'UserPoolId': 'string',
        'PreSignedUrl': 'string',
        'CreationDate': datetime(2015, 1, 1),
        'StartDate': datetime(2015, 1, 1),
        'CompletionDate': datetime(2015, 1, 1),
        'Status': 'Created'|'Pending'|'InProgress'|'Stopping'|'Expired'|'Stopped'|'Failed'|'Succeeded',
        'CloudWatchLogsRoleArn': 'string',
        'ImportedUsers': 123,
        'SkippedUsers': 123,
        'FailedUsers': 123,
        'CompletionMessage': 'string'
    }
}

Response Structure

  • (dict) --

    Represents the response from the server to the request to describe the user import job.

    • UserImportJob (dict) --

      The job object that represents the user import job.

      • JobName (string) --

        The job name for the user import job.

      • JobId (string) --

        The job ID for the user import job.

      • UserPoolId (string) --

        The user pool ID for the user pool that the users are being imported into.

      • PreSignedUrl (string) --

        The pre-signed URL to be used to upload the .csv file.

      • CreationDate (datetime) --

        The date the user import job was created.

      • StartDate (datetime) --

        The date when the user import job was started.

      • CompletionDate (datetime) --

        The date when the user import job was completed.

      • Status (string) --

        The status of the user import job. One of the following:

        • Created - The job was created but not started.
        • Pending - A transition state. You have started the job, but it has not begun importing users yet.
        • InProgress - The job has started, and users are being imported.
        • Stopping - You have stopped the job, but the job has not stopped importing users yet.
        • Stopped - You have stopped the job, and the job has stopped importing users.
        • Succeeded - The job has completed successfully.
        • Failed - The job has stopped due to an error.
        • Expired - You created a job, but did not start the job within 24-48 hours. All data associated with the job was deleted, and the job can't be started.
      • CloudWatchLogsRoleArn (string) --

        The role Amazon Resource Name (ARN) for the Amazon CloudWatch Logging role for the user import job. For more information, see "Creating the CloudWatch Logs IAM Role" in the Amazon Cognito Developer Guide.

      • ImportedUsers (integer) --

        The number of users that were successfully imported.

      • SkippedUsers (integer) --

        The number of users that were skipped.

      • FailedUsers (integer) --

        The number of users that couldn't be imported.

      • CompletionMessage (string) --

        The message returned when the user import job is completed.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
describe_user_pool(**kwargs)

Returns the configuration information and metadata of the specified user pool.

See also: AWS API Documentation

Request Syntax

response = client.describe_user_pool(
    UserPoolId='string'
)
Parameters
UserPoolId (string) --

[REQUIRED]

The user pool ID for the user pool you want to describe.

Return type
dict
Returns
Response Syntax
{
    'UserPool': {
        'Id': 'string',
        'Name': 'string',
        'Policies': {
            'PasswordPolicy': {
                'MinimumLength': 123,
                'RequireUppercase': True|False,
                'RequireLowercase': True|False,
                'RequireNumbers': True|False,
                'RequireSymbols': True|False,
                'TemporaryPasswordValidityDays': 123
            }
        },
        'LambdaConfig': {
            'PreSignUp': 'string',
            'CustomMessage': 'string',
            'PostConfirmation': 'string',
            'PreAuthentication': 'string',
            'PostAuthentication': 'string',
            'DefineAuthChallenge': 'string',
            'CreateAuthChallenge': 'string',
            'VerifyAuthChallengeResponse': 'string',
            'PreTokenGeneration': 'string',
            'UserMigration': 'string',
            'CustomSMSSender': {
                'LambdaVersion': 'V1_0',
                'LambdaArn': 'string'
            },
            'CustomEmailSender': {
                'LambdaVersion': 'V1_0',
                'LambdaArn': 'string'
            },
            'KMSKeyID': 'string'
        },
        'Status': 'Enabled'|'Disabled',
        'LastModifiedDate': datetime(2015, 1, 1),
        'CreationDate': datetime(2015, 1, 1),
        'SchemaAttributes': [
            {
                'Name': 'string',
                'AttributeDataType': 'String'|'Number'|'DateTime'|'Boolean',
                'DeveloperOnlyAttribute': True|False,
                'Mutable': True|False,
                'Required': True|False,
                'NumberAttributeConstraints': {
                    'MinValue': 'string',
                    'MaxValue': 'string'
                },
                'StringAttributeConstraints': {
                    'MinLength': 'string',
                    'MaxLength': 'string'
                }
            },
        ],
        'AutoVerifiedAttributes': [
            'phone_number'|'email',
        ],
        'AliasAttributes': [
            'phone_number'|'email'|'preferred_username',
        ],
        'UsernameAttributes': [
            'phone_number'|'email',
        ],
        'SmsVerificationMessage': 'string',
        'EmailVerificationMessage': 'string',
        'EmailVerificationSubject': 'string',
        'VerificationMessageTemplate': {
            'SmsMessage': 'string',
            'EmailMessage': 'string',
            'EmailSubject': 'string',
            'EmailMessageByLink': 'string',
            'EmailSubjectByLink': 'string',
            'DefaultEmailOption': 'CONFIRM_WITH_LINK'|'CONFIRM_WITH_CODE'
        },
        'SmsAuthenticationMessage': 'string',
        'UserAttributeUpdateSettings': {
            'AttributesRequireVerificationBeforeUpdate': [
                'phone_number'|'email',
            ]
        },
        'MfaConfiguration': 'OFF'|'ON'|'OPTIONAL',
        'DeviceConfiguration': {
            'ChallengeRequiredOnNewDevice': True|False,
            'DeviceOnlyRememberedOnUserPrompt': True|False
        },
        'EstimatedNumberOfUsers': 123,
        'EmailConfiguration': {
            'SourceArn': 'string',
            'ReplyToEmailAddress': 'string',
            'EmailSendingAccount': 'COGNITO_DEFAULT'|'DEVELOPER',
            'From': 'string',
            'ConfigurationSet': 'string'
        },
        'SmsConfiguration': {
            'SnsCallerArn': 'string',
            'ExternalId': 'string',
            'SnsRegion': 'string'
        },
        'UserPoolTags': {
            'string': 'string'
        },
        'SmsConfigurationFailure': 'string',
        'EmailConfigurationFailure': 'string',
        'Domain': 'string',
        'CustomDomain': 'string',
        'AdminCreateUserConfig': {
            'AllowAdminCreateUserOnly': True|False,
            'UnusedAccountValidityDays': 123,
            'InviteMessageTemplate': {
                'SMSMessage': 'string',
                'EmailMessage': 'string',
                'EmailSubject': 'string'
            }
        },
        'UserPoolAddOns': {
            'AdvancedSecurityMode': 'OFF'|'AUDIT'|'ENFORCED'
        },
        'UsernameConfiguration': {
            'CaseSensitive': True|False
        },
        'Arn': 'string',
        'AccountRecoverySetting': {
            'RecoveryMechanisms': [
                {
                    'Priority': 123,
                    'Name': 'verified_email'|'verified_phone_number'|'admin_only'
                },
            ]
        }
    }
}

Response Structure

  • (dict) --

    Represents the response to describe the user pool.

    • UserPool (dict) --

      The container of metadata returned by the server to describe the pool.

      • Id (string) --

        The ID of the user pool.

      • Name (string) --

        The name of the user pool.

      • Policies (dict) --

        The policies associated with the user pool.

        • PasswordPolicy (dict) --

          The password policy.

          • MinimumLength (integer) --

            The minimum length of the password in the policy that you have set. This value can't be less than 6.

          • RequireUppercase (boolean) --

            In the password policy that you have set, refers to whether you have required users to use at least one uppercase letter in their password.

          • RequireLowercase (boolean) --

            In the password policy that you have set, refers to whether you have required users to use at least one lowercase letter in their password.

          • RequireNumbers (boolean) --

            In the password policy that you have set, refers to whether you have required users to use at least one number in their password.

          • RequireSymbols (boolean) --

            In the password policy that you have set, refers to whether you have required users to use at least one symbol in their password.

          • TemporaryPasswordValidityDays (integer) --

            The number of days a temporary password is valid in the password policy. If the user doesn't sign in during this time, an administrator must reset their password.

            Note

            When you set TemporaryPasswordValidityDays for a user pool, you can no longer set a value for the legacy UnusedAccountValidityDays parameter in that user pool.

      • LambdaConfig (dict) --

        The Lambda triggers associated with the user pool.

        • PreSignUp (string) --

          A pre-registration Lambda trigger.

        • CustomMessage (string) --

          A custom Message Lambda trigger.

        • PostConfirmation (string) --

          A post-confirmation Lambda trigger.

        • PreAuthentication (string) --

          A pre-authentication Lambda trigger.

        • PostAuthentication (string) --

          A post-authentication Lambda trigger.

        • DefineAuthChallenge (string) --

          Defines the authentication challenge.

        • CreateAuthChallenge (string) --

          Creates an authentication challenge.

        • VerifyAuthChallengeResponse (string) --

          Verifies the authentication challenge response.

        • PreTokenGeneration (string) --

          A Lambda trigger that is invoked before token generation.

        • UserMigration (string) --

          The user migration Lambda config type.

        • CustomSMSSender (dict) --

          A custom SMS sender Lambda trigger.

          • LambdaVersion (string) --

            Signature of the "request" attribute in the "event" information that Amazon Cognito passes to your custom SMS Lambda function. The only supported value is V1_0 .

          • LambdaArn (string) --

            The Amazon Resource Name (ARN) of the Lambda function that Amazon Cognito activates to send SMS notifications to users.

        • CustomEmailSender (dict) --

          A custom email sender Lambda trigger.

          • LambdaVersion (string) --

            Signature of the "request" attribute in the "event" information Amazon Cognito passes to your custom email Lambda function. The only supported value is V1_0 .

          • LambdaArn (string) --

            The Amazon Resource Name (ARN) of the Lambda function that Amazon Cognito activates to send email notifications to users.

        • KMSKeyID (string) --

          The Amazon Resource Name (ARN) of an KMS key . Amazon Cognito uses the key to encrypt codes and temporary passwords sent to CustomEmailSender and CustomSMSSender .

      • Status (string) --

        The status of a user pool.

      • LastModifiedDate (datetime) --

        The date the user pool was last modified.

      • CreationDate (datetime) --

        The date the user pool was created.

      • SchemaAttributes (list) --

        A container with the schema attributes of a user pool.

        • (dict) --

          Contains information about the schema attribute.

          • Name (string) --

            A schema attribute of the name type.

          • AttributeDataType (string) --

            The attribute data type.

          • DeveloperOnlyAttribute (boolean) --

            Note

            You should use WriteAttributes in the user pool client to control how attributes can be mutated for new use cases instead of using DeveloperOnlyAttribute .

            Specifies whether the attribute type is developer only. This attribute can only be modified by an administrator. Users won't be able to modify this attribute using their access token. For example, DeveloperOnlyAttribute can be modified using AdminUpdateUserAttributes but can't be updated using UpdateUserAttributes.

          • Mutable (boolean) --

            Specifies whether the value of the attribute can be changed.

            For any user pool attribute that is mapped to an IdP attribute, you must set this parameter to true . Amazon Cognito updates mapped attributes when users sign in to your application through an IdP. If an attribute is immutable, Amazon Cognito throws an error when it attempts to update the attribute. For more information, see Specifying Identity Provider Attribute Mappings for Your User Pool .

          • Required (boolean) --

            Specifies whether a user pool attribute is required. If the attribute is required and the user doesn't provide a value, registration or sign-in will fail.

          • NumberAttributeConstraints (dict) --

            Specifies the constraints for an attribute of the number type.

            • MinValue (string) --

              The minimum value of an attribute that is of the number data type.

            • MaxValue (string) --

              The maximum value of an attribute that is of the number data type.

          • StringAttributeConstraints (dict) --

            Specifies the constraints for an attribute of the string type.

            • MinLength (string) --

              The minimum length.

            • MaxLength (string) --

              The maximum length.

      • AutoVerifiedAttributes (list) --

        The attributes that are auto-verified in a user pool.

        • (string) --
      • AliasAttributes (list) --

        The attributes that are aliased in a user pool.

        • (string) --
      • UsernameAttributes (list) --

        Specifies whether a user can use an email address or phone number as a username when they sign up.

        • (string) --
      • SmsVerificationMessage (string) --

        This parameter is no longer used. See VerificationMessageTemplateType .

      • EmailVerificationMessage (string) --

        This parameter is no longer used. See VerificationMessageTemplateType .

      • EmailVerificationSubject (string) --

        This parameter is no longer used. See VerificationMessageTemplateType .

      • VerificationMessageTemplate (dict) --

        The template for verification messages.

        • SmsMessage (string) --

          The template for SMS messages that Amazon Cognito sends to your users.

        • EmailMessage (string) --

          The template for email messages that Amazon Cognito sends to your users. You can set an EmailMessage template only if the value of EmailSendingAccount is DEVELOPER . When your EmailSendingAccount is DEVELOPER , your user pool sends email messages with your own Amazon SES configuration.

        • EmailSubject (string) --

          The subject line for the email message template. You can set an EmailSubject template only if the value of EmailSendingAccount is DEVELOPER . When your EmailSendingAccount is DEVELOPER , your user pool sends email messages with your own Amazon SES configuration.

        • EmailMessageByLink (string) --

          The email message template for sending a confirmation link to the user. You can set an EmailMessageByLink template only if the value of EmailSendingAccount is DEVELOPER . When your EmailSendingAccount is DEVELOPER , your user pool sends email messages with your own Amazon SES configuration.

        • EmailSubjectByLink (string) --

          The subject line for the email message template for sending a confirmation link to the user. You can set an EmailSubjectByLink template only if the value of EmailSendingAccount is DEVELOPER . When your EmailSendingAccount is DEVELOPER , your user pool sends email messages with your own Amazon SES configuration.

        • DefaultEmailOption (string) --

          The default email option.

      • SmsAuthenticationMessage (string) --

        The contents of the SMS authentication message.

      • UserAttributeUpdateSettings (dict) --

        The settings for updates to user attributes. These settings include the property AttributesRequireVerificationBeforeUpdate , a user-pool setting that tells Amazon Cognito how to handle changes to the value of your users' email address and phone number attributes. For more information, see Verifying updates to email addresses and phone numbers .

        • AttributesRequireVerificationBeforeUpdate (list) --

          Requires that your user verifies their email address, phone number, or both before Amazon Cognito updates the value of that attribute. When you update a user attribute that has this option activated, Amazon Cognito sends a verification message to the new phone number or email address. Amazon Cognito doesn’t change the value of the attribute until your user responds to the verification message and confirms the new value.

          You can verify an updated email address or phone number with a VerifyUserAttribute API request. You can also call the UpdateUserAttributes or AdminUpdateUserAttributes API and set email_verified or phone_number_verified to true.

          When AttributesRequireVerificationBeforeUpdate is false, your user pool doesn't require that your users verify attribute changes before Amazon Cognito updates them. In a user pool where AttributesRequireVerificationBeforeUpdate is false, API operations that change attribute values can immediately update a user’s email or phone_number attribute.

          • (string) --
      • MfaConfiguration (string) --

        Can be one of the following values:

        • OFF - MFA tokens aren't required and can't be specified during user registration.
        • ON - MFA tokens are required for all user registrations. You can only specify required when you're initially creating a user pool.
        • OPTIONAL - Users have the option when registering to create an MFA token.
      • DeviceConfiguration (dict) --

        The device-remembering configuration for a user pool. A null value indicates that you have deactivated device remembering in your user pool.

        Note

        When you provide a value for any DeviceConfiguration field, you activate the Amazon Cognito device-remembering feature.

        • ChallengeRequiredOnNewDevice (boolean) --

          When true, a remembered device can sign in with device authentication instead of SMS and time-based one-time password (TOTP) factors for multi-factor authentication (MFA).

          Note

          Whether or not ChallengeRequiredOnNewDevice is true, users who sign in with devices that have not been confirmed or remembered must still provide a second factor in a user pool that requires MFA.

        • DeviceOnlyRememberedOnUserPrompt (boolean) --

          When true, Amazon Cognito doesn't automatically remember a user's device when your app sends a ConfirmDevice API request. In your app, create a prompt for your user to choose whether they want to remember their device. Return the user's choice in an UpdateDeviceStatus API request.

          When DeviceOnlyRememberedOnUserPrompt is false , Amazon Cognito immediately remembers devices that you register in a ConfirmDevice API request.

      • EstimatedNumberOfUsers (integer) --

        A number estimating the size of the user pool.

      • EmailConfiguration (dict) --

        The email configuration of your user pool. The email configuration type sets your preferred sending method, Amazon Web Services Region, and sender for messages tfrom your user pool.

        • SourceArn (string) --

          The ARN of a verified email address in Amazon SES. Amazon Cognito uses this email address in one of the following ways, depending on the value that you specify for the EmailSendingAccount parameter:

          • If you specify COGNITO_DEFAULT , Amazon Cognito uses this address as the custom FROM address when it emails your users using its built-in email account.
          • If you specify DEVELOPER , Amazon Cognito emails your users with this address by calling Amazon SES on your behalf.

          The Region value of the SourceArn parameter must indicate a supported Amazon Web Services Region of your user pool. Typically, the Region in the SourceArn and the user pool Region are the same. For more information, see Amazon SES email configuration regions in the Amazon Cognito Developer Guide .

        • ReplyToEmailAddress (string) --

          The destination to which the receiver of the email should reply.

        • EmailSendingAccount (string) --

          Specifies whether Amazon Cognito uses its built-in functionality to send your users email messages, or uses your Amazon Simple Email Service email configuration. Specify one of the following values:

          COGNITO_DEFAULT

          When Amazon Cognito emails your users, it uses its built-in email functionality. When you use the default option, Amazon Cognito allows only a limited number of emails each day for your user pool. For typical production environments, the default email limit is less than the required delivery volume. To achieve a higher delivery volume, specify DEVELOPER to use your Amazon SES email configuration.

          To look up the email delivery limit for the default option, see Limits in in the Developer Guide .

          The default FROM address is no-reply@verificationemail.com . To customize the FROM address, provide the Amazon Resource Name (ARN) of an Amazon SES verified email address for the SourceArn parameter.

          DEVELOPER

          When Amazon Cognito emails your users, it uses your Amazon SES configuration. Amazon Cognito calls Amazon SES on your behalf to send email from your verified email address. When you use this option, the email delivery limits are the same limits that apply to your Amazon SES verified email address in your Amazon Web Services account.

          If you use this option, provide the ARN of an Amazon SES verified email address for the SourceArn parameter.

          Before Amazon Cognito can email your users, it requires additional permissions to call Amazon SES on your behalf. When you update your user pool with this option, Amazon Cognito creates a service-linked role , which is a type of role, in your Amazon Web Services account. This role contains the permissions that allow to access Amazon SES and send email messages with your address. For more information about the service-linked role that Amazon Cognito creates, see Using Service-Linked Roles for Amazon Cognito in the Amazon Cognito Developer Guide .

        • From (string) --

          Either the sender’s email address or the sender’s name with their email address. For example, testuser@example.com or Test User <testuser@example.com> . This address appears before the body of the email.

        • ConfigurationSet (string) --

          The set of configuration rules that can be applied to emails sent using Amazon Simple Email Service. A configuration set is applied to an email by including a reference to the configuration set in the headers of the email. Once applied, all of the rules in that configuration set are applied to the email. Configuration sets can be used to apply the following types of rules to emails:

          Event publishing

          Amazon Simple Email Service can track the number of send, delivery, open, click, bounce, and complaint events for each email sent. Use event publishing to send information about these events to other Amazon Web Services services such as and Amazon CloudWatch

          IP pool management

          When leasing dedicated IP addresses with Amazon Simple Email Service, you can create groups of IP addresses, called dedicated IP pools. You can then associate the dedicated IP pools with configuration sets.

      • SmsConfiguration (dict) --

        The SMS configuration with the settings that your Amazon Cognito user pool must use to send an SMS message from your Amazon Web Services account through Amazon Simple Notification Service. To send SMS messages with Amazon SNS in the Amazon Web Services Region that you want, the Amazon Cognito user pool uses an Identity and Access Management (IAM) role in your Amazon Web Services account.

        • SnsCallerArn (string) --

          The Amazon Resource Name (ARN) of the Amazon SNS caller. This is the ARN of the IAM role in your Amazon Web Services account that Amazon Cognito will use to send SMS messages. SMS messages are subject to a spending limit .

        • ExternalId (string) --

          The external ID provides additional security for your IAM role. You can use an ExternalId with the IAM role that you use with Amazon SNS to send SMS messages for your user pool. If you provide an ExternalId , your Amazon Cognito user pool includes it in the request to assume your IAM role. You can configure the role trust policy to require that Amazon Cognito, and any principal, provide the ExternalID . If you use the Amazon Cognito Management Console to create a role for SMS multi-factor authentication (MFA), Amazon Cognito creates a role with the required permissions and a trust policy that demonstrates use of the ExternalId .

          For more information about the ExternalId of a role, see How to use an external ID when granting access to your Amazon Web Services resources to a third party

        • SnsRegion (string) --

          The Amazon Web Services Region to use with Amazon SNS integration. You can choose the same Region as your user pool, or a supported Legacy Amazon SNS alternate Region .

          Amazon Cognito resources in the Asia Pacific (Seoul) Amazon Web Services Region must use your Amazon SNS configuration in the Asia Pacific (Tokyo) Region. For more information, see SMS message settings for Amazon Cognito user pools .

      • UserPoolTags (dict) --

        The tags that are assigned to the user pool. A tag is a label that you can apply to user pools to categorize and manage them in different ways, such as by purpose, owner, environment, or other criteria.

        • (string) --
          • (string) --
      • SmsConfigurationFailure (string) --

        The reason why the SMS configuration can't send the messages to your users.

        This message might include comma-separated values to describe why your SMS configuration can't send messages to user pool end users.

        InvalidSmsRoleAccessPolicyException

        The Identity and Access Management role that Amazon Cognito uses to send SMS messages isn't properly configured. For more information, see SmsConfigurationType .

        SNSSandbox

        The Amazon Web Services account is in the SNS SMS Sandbox and messages will only reach verified end users. This parameter won’t get populated with SNSSandbox if the IAM user creating the user pool doesn’t have SNS permissions. To learn how to move your Amazon Web Services account out of the sandbox, see Moving out of the SMS sandbox .

      • EmailConfigurationFailure (string) --

        Deprecated. Review error codes from API requests with EventSource:cognito-idp.amazonaws.com in CloudTrail for information about problems with user pool email configuration.

      • Domain (string) --

        The domain prefix, if the user pool has a domain associated with it.

      • CustomDomain (string) --

        A custom domain name that you provide to Amazon Cognito. This parameter applies only if you use a custom domain to host the sign-up and sign-in pages for your application. An example of a custom domain name might be auth.example.com .

        For more information about adding a custom domain to your user pool, see Using Your Own Domain for the Hosted UI .

      • AdminCreateUserConfig (dict) --

        The configuration for AdminCreateUser requests.

        • AllowAdminCreateUserOnly (boolean) --

          Set to True if only the administrator is allowed to create user profiles. Set to False if users can sign themselves up via an app.

        • UnusedAccountValidityDays (integer) --

          The user account expiration limit, in days, after which a new account that hasn't signed in is no longer usable. To reset the account after that time limit, you must call AdminCreateUser again, specifying "RESEND" for the MessageAction parameter. The default value for this parameter is 7.

          Note

          If you set a value for TemporaryPasswordValidityDays in PasswordPolicy , that value will be used, and UnusedAccountValidityDays will be no longer be an available parameter for that user pool.

        • InviteMessageTemplate (dict) --

          The message template to be used for the welcome message to new users.

          See also Customizing User Invitation Messages .

          • SMSMessage (string) --

            The message template for SMS messages.

          • EmailMessage (string) --

            The message template for email messages. EmailMessage is allowed only if EmailSendingAccount is DEVELOPER.

          • EmailSubject (string) --

            The subject line for email messages. EmailSubject is allowed only if EmailSendingAccount is DEVELOPER.

      • UserPoolAddOns (dict) --

        The user pool add-ons.

        • AdvancedSecurityMode (string) --

          The advanced security mode.

      • UsernameConfiguration (dict) --

        Case sensitivity of the username input for the selected sign-in option. For example, when case sensitivity is set to False , users can sign in using either "username" or "Username". This configuration is immutable once it has been set. For more information, see UsernameConfigurationType .

        • CaseSensitive (boolean) --

          Specifies whether user name case sensitivity will be applied for all users in the user pool through Amazon Cognito APIs.

          Valid values include:

          True

          Enables case sensitivity for all username input. When this option is set to True , users must sign in using the exact capitalization of their given username, such as “UserName”. This is the default value.

          False

          Enables case insensitivity for all username input. For example, when this option is set to False , users can sign in using either "username" or "Username". This option also enables both preferred_username and email alias to be case insensitive, in addition to the username attribute.

      • Arn (string) --

        The Amazon Resource Name (ARN) for the user pool.

      • AccountRecoverySetting (dict) --

        The available verified method a user can use to recover their password when they call ForgotPassword . You can use this setting to define a preferred method when a user has more than one method available. With this setting, SMS doesn't qualify for a valid password recovery mechanism if the user also has SMS multi-factor authentication (MFA) activated. In the absence of this setting, Amazon Cognito uses the legacy behavior to determine the recovery method where SMS is preferred through email.

        • RecoveryMechanisms (list) --

          The list of RecoveryOptionTypes .

          • (dict) --

            A map containing a priority as a key, and recovery method name as a value.

            • Priority (integer) --

              A positive integer specifying priority of a method with 1 being the highest priority.

            • Name (string) --

              The recovery method for a user.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.UserPoolTaggingException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
describe_user_pool_client(**kwargs)

Client method for returning the configuration information and metadata of the specified user pool app client.

See also: AWS API Documentation

Request Syntax

response = client.describe_user_pool_client(
    UserPoolId='string',
    ClientId='string'
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool you want to describe.

  • ClientId (string) --

    [REQUIRED]

    The app client ID of the app associated with the user pool.

Return type

dict

Returns

Response Syntax

{
    'UserPoolClient': {
        'UserPoolId': 'string',
        'ClientName': 'string',
        'ClientId': 'string',
        'ClientSecret': 'string',
        'LastModifiedDate': datetime(2015, 1, 1),
        'CreationDate': datetime(2015, 1, 1),
        'RefreshTokenValidity': 123,
        'AccessTokenValidity': 123,
        'IdTokenValidity': 123,
        'TokenValidityUnits': {
            'AccessToken': 'seconds'|'minutes'|'hours'|'days',
            'IdToken': 'seconds'|'minutes'|'hours'|'days',
            'RefreshToken': 'seconds'|'minutes'|'hours'|'days'
        },
        'ReadAttributes': [
            'string',
        ],
        'WriteAttributes': [
            'string',
        ],
        'ExplicitAuthFlows': [
            'ADMIN_NO_SRP_AUTH'|'CUSTOM_AUTH_FLOW_ONLY'|'USER_PASSWORD_AUTH'|'ALLOW_ADMIN_USER_PASSWORD_AUTH'|'ALLOW_CUSTOM_AUTH'|'ALLOW_USER_PASSWORD_AUTH'|'ALLOW_USER_SRP_AUTH'|'ALLOW_REFRESH_TOKEN_AUTH',
        ],
        'SupportedIdentityProviders': [
            'string',
        ],
        'CallbackURLs': [
            'string',
        ],
        'LogoutURLs': [
            'string',
        ],
        'DefaultRedirectURI': 'string',
        'AllowedOAuthFlows': [
            'code'|'implicit'|'client_credentials',
        ],
        'AllowedOAuthScopes': [
            'string',
        ],
        'AllowedOAuthFlowsUserPoolClient': True|False,
        'AnalyticsConfiguration': {
            'ApplicationId': 'string',
            'ApplicationArn': 'string',
            'RoleArn': 'string',
            'ExternalId': 'string',
            'UserDataShared': True|False
        },
        'PreventUserExistenceErrors': 'LEGACY'|'ENABLED',
        'EnableTokenRevocation': True|False,
        'EnablePropagateAdditionalUserContextData': True|False,
        'AuthSessionValidity': 123
    }
}

Response Structure

  • (dict) --

    Represents the response from the server from a request to describe the user pool client.

    • UserPoolClient (dict) --

      The user pool client from a server response to describe the user pool client.

      • UserPoolId (string) --

        The user pool ID for the user pool client.

      • ClientName (string) --

        The client name from the user pool request of the client type.

      • ClientId (string) --

        The ID of the client associated with the user pool.

      • ClientSecret (string) --

        The client secret from the user pool request of the client type.

      • LastModifiedDate (datetime) --

        The date the user pool client was last modified.

      • CreationDate (datetime) --

        The date the user pool client was created.

      • RefreshTokenValidity (integer) --

        The refresh token time limit. After this limit expires, your user can't use their refresh token. To specify the time unit for RefreshTokenValidity as seconds , minutes , hours , or days , set a TokenValidityUnits value in your API request.

        For example, when you set RefreshTokenValidity as 10 and TokenValidityUnits as days , your user can refresh their session and retrieve new access and ID tokens for 10 days.

        The default time unit for RefreshTokenValidity in an API request is days. You can't set RefreshTokenValidity to 0. If you do, Amazon Cognito overrides the value with the default value of 30 days. Valid range is displayed below in seconds.

      • AccessTokenValidity (integer) --

        The access token time limit. After this limit expires, your user can't use their access token. To specify the time unit for AccessTokenValidity as seconds , minutes , hours , or days , set a TokenValidityUnits value in your API request.

        For example, when you set AccessTokenValidity to 10 and TokenValidityUnits to hours , your user can authorize access with their access token for 10 hours.

        The default time unit for AccessTokenValidity in an API request is hours. Valid range is displayed below in seconds.

      • IdTokenValidity (integer) --

        The ID token time limit. After this limit expires, your user can't use their ID token. To specify the time unit for IdTokenValidity as seconds , minutes , hours , or days , set a TokenValidityUnits value in your API request.

        For example, when you set IdTokenValidity as 10 and TokenValidityUnits as hours , your user can authenticate their session with their ID token for 10 hours.

        The default time unit for AccessTokenValidity in an API request is hours. Valid range is displayed below in seconds.

      • TokenValidityUnits (dict) --

        The time units used to specify the token validity times of each token type: ID, access, and refresh.

        • AccessToken (string) --

          A time unit of seconds , minutes , hours , or days for the value that you set in the AccessTokenValidity parameter. The default AccessTokenValidity time unit is hours.

        • IdToken (string) --

          A time unit of seconds , minutes , hours , or days for the value that you set in the IdTokenValidity parameter. The default IdTokenValidity time unit is hours.

        • RefreshToken (string) --

          A time unit of seconds , minutes , hours , or days for the value that you set in the RefreshTokenValidity parameter. The default RefreshTokenValidity time unit is days.

      • ReadAttributes (list) --

        The Read-only attributes.

        • (string) --
      • WriteAttributes (list) --

        The writeable attributes.

        • (string) --
      • ExplicitAuthFlows (list) --

        The authentication flows that are supported by the user pool clients. Flow names without the ALLOW_ prefix are no longer supported in favor of new names with the ALLOW_ prefix. Note that values with ALLOW_ prefix must be used only along with values including the ALLOW_ prefix.

        Valid values include:

        • ALLOW_ADMIN_USER_PASSWORD_AUTH : Enable admin based user password authentication flow ADMIN_USER_PASSWORD_AUTH . This setting replaces the ADMIN_NO_SRP_AUTH setting. With this authentication flow, Amazon Cognito receives the password in the request instead of using the Secure Remote Password (SRP) protocol to verify passwords.
        • ALLOW_CUSTOM_AUTH : Enable Lambda trigger based authentication.
        • ALLOW_USER_PASSWORD_AUTH : Enable user password-based authentication. In this flow, Amazon Cognito receives the password in the request instead of using the SRP protocol to verify passwords.
        • ALLOW_USER_SRP_AUTH : Enable SRP-based authentication.
        • ALLOW_REFRESH_TOKEN_AUTH : Enable authflow to refresh tokens.
        • (string) --
      • SupportedIdentityProviders (list) --

        A list of provider names for the IdPs that this client supports. The following are supported: COGNITO , Facebook , Google , SignInWithApple , LoginWithAmazon , and the names of your own SAML and OIDC providers.

        • (string) --
      • CallbackURLs (list) --

        A list of allowed redirect (callback) URLs for the IdPs.

        A redirect URI must:

        • Be an absolute URI.
        • Be registered with the authorization server.
        • Not include a fragment component.

        See OAuth 2.0 - Redirection Endpoint .

        Amazon Cognito requires HTTPS over HTTP except for http://localhost for testing purposes only.

        App callback URLs such as myapp://example are also supported.

        • (string) --
      • LogoutURLs (list) --

        A list of allowed logout URLs for the IdPs.

        • (string) --
      • DefaultRedirectURI (string) --

        The default redirect URI. Must be in the CallbackURLs list.

        A redirect URI must:

        • Be an absolute URI.
        • Be registered with the authorization server.
        • Not include a fragment component.

        See OAuth 2.0 - Redirection Endpoint .

        Amazon Cognito requires HTTPS over HTTP except for http://localhost for testing purposes only.

        App callback URLs such as myapp://example are also supported.

      • AllowedOAuthFlows (list) --

        The allowed OAuth flows.

        code

        Use a code grant flow, which provides an authorization code as the response. This code can be exchanged for access tokens with the /oauth2/token endpoint.

        implicit

        Issue the access token (and, optionally, ID token, based on scopes) directly to your user.

        client_credentials

        Issue the access token from the /oauth2/token endpoint directly to a non-person user using a combination of the client ID and client secret.

        • (string) --
      • AllowedOAuthScopes (list) --

        The OAuth scopes that your app client supports. Possible values that OAuth provides are phone , email , openid , and profile . Possible values that Amazon Web Services provides are aws.cognito.signin.user.admin . Amazon Cognito also supports custom scopes that you create in Resource Servers.

        • (string) --
      • AllowedOAuthFlowsUserPoolClient (boolean) --

        Set to true if the client is allowed to follow the OAuth protocol when interacting with Amazon Cognito user pools.

      • AnalyticsConfiguration (dict) --

        The Amazon Pinpoint analytics configuration for the user pool client.

        Note

        Amazon Cognito user pools only support sending events to Amazon Pinpoint projects in the US East (N. Virginia) us-east-1 Region, regardless of the Region where the user pool resides.

        • ApplicationId (string) --

          The application ID for an Amazon Pinpoint application.

        • ApplicationArn (string) --

          The Amazon Resource Name (ARN) of an Amazon Pinpoint project. You can use the Amazon Pinpoint project to integrate with the chosen user pool Client. Amazon Cognito publishes events to the Amazon Pinpoint project that the app ARN declares.

        • RoleArn (string) --

          The ARN of an Identity and Access Management role that authorizes Amazon Cognito to publish events to Amazon Pinpoint analytics.

        • ExternalId (string) --

          The external ID.

        • UserDataShared (boolean) --

          If UserDataShared is true , Amazon Cognito includes user data in the events that it publishes to Amazon Pinpoint analytics.

      • PreventUserExistenceErrors (string) --

        Errors and responses that you want Amazon Cognito APIs to return during authentication, account confirmation, and password recovery when the user doesn't exist in the user pool. When set to ENABLED and the user doesn't exist, authentication returns an error indicating either the username or password was incorrect. Account confirmation and password recovery return a response indicating a code was sent to a simulated destination. When set to LEGACY , those APIs return a UserNotFoundException exception if the user doesn't exist in the user pool.

        Valid values include:

        • ENABLED - This prevents user existence-related errors.
        • LEGACY - This represents the old behavior of Amazon Cognito where user existence related errors aren't prevented.
      • EnableTokenRevocation (boolean) --

        Indicates whether token revocation is activated for the user pool client. When you create a new user pool client, token revocation is activated by default. For more information about revoking tokens, see RevokeToken .

      • EnablePropagateAdditionalUserContextData (boolean) --

        When EnablePropagateAdditionalUserContextData is true, Amazon Cognito accepts an IpAddress value that you send in the UserContextData parameter. The UserContextData parameter sends information to Amazon Cognito advanced security for risk analysis. You can send UserContextData when you sign in Amazon Cognito native users with the InitiateAuth and RespondToAuthChallenge API operations.

        When EnablePropagateAdditionalUserContextData is false, you can't send your user's source IP address to Amazon Cognito advanced security with unauthenticated API operations. EnablePropagateAdditionalUserContextData doesn't affect whether you can send a source IP address in a ContextData parameter with the authenticated API operations AdminInitiateAuth and AdminRespondToAuthChallenge .

        You can only activate EnablePropagateAdditionalUserContextData in an app client that has a client secret. For more information about propagation of user context data, see Adding user device and session data to API requests .

      • AuthSessionValidity (integer) --

        Amazon Cognito creates a session token for each API request in an authentication flow. AuthSessionValidity is the duration, in minutes, of that session token. Your user pool native user must respond to each authentication challenge before the session expires.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
describe_user_pool_domain(**kwargs)

Gets information about a domain.

See also: AWS API Documentation

Request Syntax

response = client.describe_user_pool_domain(
    Domain='string'
)
Parameters
Domain (string) --

[REQUIRED]

The domain string. For custom domains, this is the fully-qualified domain name, such as auth.example.com . For Amazon Cognito prefix domains, this is the prefix alone, such as auth .

Return type
dict
Returns
Response Syntax
{
    'DomainDescription': {
        'UserPoolId': 'string',
        'AWSAccountId': 'string',
        'Domain': 'string',
        'S3Bucket': 'string',
        'CloudFrontDistribution': 'string',
        'Version': 'string',
        'Status': 'CREATING'|'DELETING'|'UPDATING'|'ACTIVE'|'FAILED',
        'CustomDomainConfig': {
            'CertificateArn': 'string'
        }
    }
}

Response Structure

  • (dict) --
    • DomainDescription (dict) --

      A domain description object containing information about the domain.

      • UserPoolId (string) --

        The user pool ID.

      • AWSAccountId (string) --

        The Amazon Web Services ID for the user pool owner.

      • Domain (string) --

        The domain string. For custom domains, this is the fully-qualified domain name, such as auth.example.com . For Amazon Cognito prefix domains, this is the prefix alone, such as auth .

      • S3Bucket (string) --

        The Amazon S3 bucket where the static files for this domain are stored.

      • CloudFrontDistribution (string) --

        The Amazon Resource Name (ARN) of the Amazon CloudFront distribution.

      • Version (string) --

        The app version.

      • Status (string) --

        The domain status.

      • CustomDomainConfig (dict) --

        The configuration for a custom domain that hosts the sign-up and sign-in webpages for your application.

        • CertificateArn (string) --

          The Amazon Resource Name (ARN) of an Certificate Manager SSL certificate. You use this certificate for the subdomain of your custom domain.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
forget_device(**kwargs)

Forgets the specified device.

See also: AWS API Documentation

Request Syntax

response = client.forget_device(
    AccessToken='string',
    DeviceKey='string'
)
Parameters
  • AccessToken (string) -- A valid access token that Amazon Cognito issued to the user whose registered device you want to forget.
  • DeviceKey (string) --

    [REQUIRED]

    The device key.

Returns

None

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.InvalidUserPoolConfigurationException
  • CognitoIdentityProvider.Client.exceptions.PasswordResetRequiredException
  • CognitoIdentityProvider.Client.exceptions.UserNotFoundException
  • CognitoIdentityProvider.Client.exceptions.UserNotConfirmedException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
  • CognitoIdentityProvider.Client.exceptions.ForbiddenException
forgot_password(**kwargs)

Calling this API causes a message to be sent to the end user with a confirmation code that is required to change the user's password. For the Username parameter, you can use the username or user alias. The method used to send the confirmation code is sent according to the specified AccountRecoverySetting. For more information, see Recovering User Accounts in the Amazon Cognito Developer Guide . If neither a verified phone number nor a verified email exists, an InvalidParameterException is thrown. To use the confirmation code for resetting the password, call ConfirmForgotPassword .

Note

This action might generate an SMS text message. Starting June 1, 2021, US telecom carriers require you to register an origination phone number before you can send SMS messages to US phone numbers. If you use SMS text messages in Amazon Cognito, you must register a phone number with Amazon Pinpoint . Amazon Cognito uses the registered number automatically. Otherwise, Amazon Cognito users who must receive SMS messages might not be able to sign up, activate their accounts, or sign in.

If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Service, Amazon Simple Notification Service might place your account in the SMS sandbox. In * sandbox mode * , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see SMS message settings for Amazon Cognito user pools in the Amazon Cognito Developer Guide .

See also: AWS API Documentation

Request Syntax

response = client.forgot_password(
    ClientId='string',
    SecretHash='string',
    UserContextData={
        'IpAddress': 'string',
        'EncodedData': 'string'
    },
    Username='string',
    AnalyticsMetadata={
        'AnalyticsEndpointId': 'string'
    },
    ClientMetadata={
        'string': 'string'
    }
)
Parameters
  • ClientId (string) --

    [REQUIRED]

    The ID of the client associated with the user pool.

  • SecretHash (string) -- A keyed-hash message authentication code (HMAC) calculated using the secret key of a user pool client and username plus the client ID in the message.
  • UserContextData (dict) --

    Contextual data about your user session, such as the device fingerprint, IP address, or location. Amazon Cognito advanced security evaluates the risk of an authentication event based on the context that your app generates and passes to Amazon Cognito when it makes API requests.

    • IpAddress (string) --

      The source IP address of your user's device.

    • EncodedData (string) --

      Encoded device-fingerprint details that your app collected with the Amazon Cognito context data collection library. For more information, see Adding user device and session data to API requests .

  • Username (string) --

    [REQUIRED]

    The user name of the user for whom you want to enter a code to reset a forgotten password.

  • AnalyticsMetadata (dict) --

    The Amazon Pinpoint analytics metadata that contributes to your metrics for ForgotPassword calls.

    • AnalyticsEndpointId (string) --

      The endpoint ID.

  • ClientMetadata (dict) --

    A map of custom key-value pairs that you can provide as input for any custom workflows that this action triggers.

    You create custom workflows by assigning Lambda functions to user pool triggers. When you use the ForgotPassword API action, Amazon Cognito invokes any functions that are assigned to the following triggers: pre sign-up , custom message , and user migration . When Amazon Cognito invokes any of these functions, it passes a JSON payload, which the function receives as input. This payload contains a clientMetadata attribute, which provides the data that you assigned to the ClientMetadata parameter in your ForgotPassword request. In your function code in Lambda, you can process the clientMetadata value to enhance your workflow for your specific needs.

    For more information, see Customizing user pool Workflows with Lambda Triggers in the Amazon Cognito Developer Guide .

    Note

    When you use the ClientMetadata parameter, remember that Amazon Cognito won't do the following:

    • Store the ClientMetadata value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration doesn't include triggers, the ClientMetadata parameter serves no purpose.
    • Validate the ClientMetadata value.
    • Encrypt the ClientMetadata value. Don't use Amazon Cognito to provide sensitive information.
    • (string) --
      • (string) --
Return type

dict

Returns

Response Syntax

{
    'CodeDeliveryDetails': {
        'Destination': 'string',
        'DeliveryMedium': 'SMS'|'EMAIL',
        'AttributeName': 'string'
    }
}

Response Structure

  • (dict) --

    The response from Amazon Cognito to a request to reset a password.

    • CodeDeliveryDetails (dict) --

      The code delivery details returned by the server in response to the request to reset a password.

      • Destination (string) --

        The email address or phone number destination where Amazon Cognito sent the code.

      • DeliveryMedium (string) --

        The method that Amazon Cognito used to send the code.

      • AttributeName (string) --

        The name of the attribute that Amazon Cognito verifies with the code.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.UnexpectedLambdaException
  • CognitoIdentityProvider.Client.exceptions.UserLambdaValidationException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.InvalidLambdaResponseException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.LimitExceededException
  • CognitoIdentityProvider.Client.exceptions.InvalidSmsRoleAccessPolicyException
  • CognitoIdentityProvider.Client.exceptions.InvalidSmsRoleTrustRelationshipException
  • CognitoIdentityProvider.Client.exceptions.InvalidEmailRoleAccessPolicyException
  • CognitoIdentityProvider.Client.exceptions.CodeDeliveryFailureException
  • CognitoIdentityProvider.Client.exceptions.UserNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
  • CognitoIdentityProvider.Client.exceptions.ForbiddenException
get_csv_header(**kwargs)

Gets the header information for the comma-separated value (CSV) file to be used as input for the user import job.

See also: AWS API Documentation

Request Syntax

response = client.get_csv_header(
    UserPoolId='string'
)
Parameters
UserPoolId (string) --

[REQUIRED]

The user pool ID for the user pool that the users are to be imported into.

Return type
dict
Returns
Response Syntax
{
    'UserPoolId': 'string',
    'CSVHeader': [
        'string',
    ]
}

Response Structure

  • (dict) --

    Represents the response from the server to the request to get the header information of the CSV file for the user import job.

    • UserPoolId (string) --

      The user pool ID for the user pool that the users are to be imported into.

    • CSVHeader (list) --

      The header information of the CSV file for the user import job.

      • (string) --

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
get_device(**kwargs)

Gets the device.

See also: AWS API Documentation

Request Syntax

response = client.get_device(
    DeviceKey='string',
    AccessToken='string'
)
Parameters
  • DeviceKey (string) --

    [REQUIRED]

    The device key.

  • AccessToken (string) -- A valid access token that Amazon Cognito issued to the user whose device information you want to request.
Return type

dict

Returns

Response Syntax

{
    'Device': {
        'DeviceKey': 'string',
        'DeviceAttributes': [
            {
                'Name': 'string',
                'Value': 'string'
            },
        ],
        'DeviceCreateDate': datetime(2015, 1, 1),
        'DeviceLastModifiedDate': datetime(2015, 1, 1),
        'DeviceLastAuthenticatedDate': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) --

    Gets the device response.

    • Device (dict) --

      The device.

      • DeviceKey (string) --

        The device key.

      • DeviceAttributes (list) --

        The device attributes.

        • (dict) --

          Specifies whether the attribute is standard or custom.

          • Name (string) --

            The name of the attribute.

          • Value (string) --

            The value of the attribute.

      • DeviceCreateDate (datetime) --

        The creation date of the device.

      • DeviceLastModifiedDate (datetime) --

        The last modified date of the device.

      • DeviceLastAuthenticatedDate (datetime) --

        The date when the device was last authenticated.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.InvalidUserPoolConfigurationException
  • 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
get_group(**kwargs)

Gets a group.

Calling this action requires developer credentials.

See also: AWS API Documentation

Request Syntax

response = client.get_group(
    GroupName='string',
    UserPoolId='string'
)
Parameters
  • GroupName (string) --

    [REQUIRED]

    The name of the group.

  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool.

Return type

dict

Returns

Response Syntax

{
    'Group': {
        'GroupName': 'string',
        'UserPoolId': 'string',
        'Description': 'string',
        'RoleArn': 'string',
        'Precedence': 123,
        'LastModifiedDate': datetime(2015, 1, 1),
        'CreationDate': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) --

    • Group (dict) --

      The group object for the group.

      • GroupName (string) --

        The name of the group.

      • UserPoolId (string) --

        The user pool ID for the user pool.

      • Description (string) --

        A string containing the description of the group.

      • RoleArn (string) --

        The role Amazon Resource Name (ARN) for the group.

      • Precedence (integer) --

        A non-negative integer value that specifies the precedence of this group relative to the other groups that a user can belong to in the user pool. Zero is the highest precedence value. Groups with lower Precedence values take precedence over groups with higher ornull Precedence values. If a user belongs to two or more groups, it is the group with the lowest precedence value whose role ARN is given in the user's tokens for the cognito:roles and cognito:preferred_role claims.

        Two groups can have the same Precedence value. If this happens, neither group takes precedence over the other. If two groups with the same Precedence have the same role ARN, that role is used in the cognito:preferred_role claim in tokens for users in each group. If the two groups have different role ARNs, the cognito:preferred_role claim isn't set in users' tokens.

        The default Precedence value is null.

      • LastModifiedDate (datetime) --

        The date the group was last modified.

      • CreationDate (datetime) --

        The date the group was created.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
get_identity_provider_by_identifier(**kwargs)

Gets the specified IdP.

See also: AWS API Documentation

Request Syntax

response = client.get_identity_provider_by_identifier(
    UserPoolId='string',
    IdpIdentifier='string'
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID.

  • IdpIdentifier (string) --

    [REQUIRED]

    The IdP identifier.

Return type

dict

Returns

Response Syntax

{
    'IdentityProvider': {
        'UserPoolId': 'string',
        'ProviderName': 'string',
        'ProviderType': 'SAML'|'Facebook'|'Google'|'LoginWithAmazon'|'SignInWithApple'|'OIDC',
        'ProviderDetails': {
            'string': 'string'
        },
        'AttributeMapping': {
            'string': 'string'
        },
        'IdpIdentifiers': [
            'string',
        ],
        'LastModifiedDate': datetime(2015, 1, 1),
        'CreationDate': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) --

    • IdentityProvider (dict) --

      The IdP object.

      • UserPoolId (string) --

        The user pool ID.

      • ProviderName (string) --

        The IdP name.

      • ProviderType (string) --

        The IdP type.

      • ProviderDetails (dict) --

        The IdP details. The following list describes the provider detail keys for each IdP type.

        • For Google and Login with Amazon:
          • client_id
          • client_secret
          • authorize_scopes
        • For Facebook:
          • client_id
          • client_secret
          • authorize_scopes
          • api_version
        • For Sign in with Apple:
          • client_id
          • team_id
          • key_id
          • private_key You can submit a private_key when you add or update an IdP. Describe operations don't return the private key.
          • authorize_scopes
        • For OIDC providers:
          • client_id
          • client_secret
          • attributes_request_method
          • oidc_issuer
          • authorize_scopes
          • The following keys are only present if Amazon Cognito didn't discover them at the oidc_issuer URL.
            • authorize_url
            • token_url
            • attributes_url
            • jwks_uri
          • Amazon Cognito sets the value of the following keys automatically. They are read-only.
            • attributes_url_add_attributes
        • For SAML providers:
          • MetadataFile or MetadataURL
          • IDPSignout optional
        • (string) --
          • (string) --
      • AttributeMapping (dict) --

        A mapping of IdP attributes to standard and custom user pool attributes.

        • (string) --
          • (string) --
      • IdpIdentifiers (list) --

        A list of IdP identifiers.

        • (string) --
      • LastModifiedDate (datetime) --

        The date the IdP was last modified.

      • CreationDate (datetime) --

        The date the IdP was created.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
get_paginator(operation_name)

Create a paginator for an operation.

Parameters
operation_name (string) -- The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator("create_foo").
Raises OperationNotPageableError
Raised if the operation is not pageable. You can use the client.can_paginate method to check if an operation is pageable.
Return type
L{botocore.paginate.Paginator}
Returns
A paginator object.
get_signing_certificate(**kwargs)

This method takes a user pool ID, and returns the signing certificate.

See also: AWS API Documentation

Request Syntax

response = client.get_signing_certificate(
    UserPoolId='string'
)
Parameters
UserPoolId (string) --

[REQUIRED]

The user pool ID.

Return type
dict
Returns
Response Syntax
{
    'Certificate': 'string'
}

Response Structure

  • (dict) --

    Response from Amazon Cognito for a signing certificate request.

    • Certificate (string) --

      The signing certificate.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
get_ui_customization(**kwargs)

Gets the user interface (UI) Customization information for a particular app client's app UI, if any such information exists for the client. If nothing is set for the particular client, but there is an existing pool level customization (the app clientId is ALL ), then that information is returned. If nothing is present, then an empty shape is returned.

See also: AWS API Documentation

Request Syntax

response = client.get_ui_customization(
    UserPoolId='string',
    ClientId='string'
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool.

  • ClientId (string) -- The client ID for the client app.
Return type

dict

Returns

Response Syntax

{
    'UICustomization': {
        'UserPoolId': 'string',
        'ClientId': 'string',
        'ImageUrl': 'string',
        'CSS': 'string',
        'CSSVersion': 'string',
        'LastModifiedDate': datetime(2015, 1, 1),
        'CreationDate': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) --

    • UICustomization (dict) --

      The UI customization information.

      • UserPoolId (string) --

        The user pool ID for the user pool.

      • ClientId (string) --

        The client ID for the client app.

      • ImageUrl (string) --

        The logo image for the UI customization.

      • CSS (string) --

        The CSS values in the UI customization.

      • CSSVersion (string) --

        The CSS version number.

      • LastModifiedDate (datetime) --

        The last-modified date for the UI customization.

      • CreationDate (datetime) --

        The creation date for the UI customization.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
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
get_user_attribute_verification_code(**kwargs)

Generates a user attribute verification code for the specified attribute name. Sends a message to a user with a code that they must return in a VerifyUserAttribute request.

Note

This action might generate an SMS text message. Starting June 1, 2021, US telecom carriers require you to register an origination phone number before you can send SMS messages to US phone numbers. If you use SMS text messages in Amazon Cognito, you must register a phone number with Amazon Pinpoint . Amazon Cognito uses the registered number automatically. Otherwise, Amazon Cognito users who must receive SMS messages might not be able to sign up, activate their accounts, or sign in.

If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Service, Amazon Simple Notification Service might place your account in the SMS sandbox. In * sandbox mode * , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see SMS message settings for Amazon Cognito user pools in the Amazon Cognito Developer Guide .

See also: AWS API Documentation

Request Syntax

response = client.get_user_attribute_verification_code(
    AccessToken='string',
    AttributeName='string',
    ClientMetadata={
        'string': 'string'
    }
)
Parameters
  • AccessToken (string) --

    [REQUIRED]

    A non-expired access token for the user whose attribute verification code you want to generate.

  • AttributeName (string) --

    [REQUIRED]

    The attribute name returned by the server response to get the user attribute verification code.

  • ClientMetadata (dict) --

    A map of custom key-value pairs that you can provide as input for any custom workflows that this action triggers.

    You create custom workflows by assigning Lambda functions to user pool triggers. When you use the GetUserAttributeVerificationCode API action, Amazon Cognito invokes the function that is assigned to the custom message trigger. When Amazon Cognito invokes this function, it passes a JSON payload, which the function receives as input. This payload contains a clientMetadata attribute, which provides the data that you assigned to the ClientMetadata parameter in your GetUserAttributeVerificationCode request. In your function code in Lambda, you can process the clientMetadata value to enhance your workflow for your specific needs.

    For more information, see Customizing user pool Workflows with Lambda Triggers in the Amazon Cognito Developer Guide .

    Note

    When you use the ClientMetadata parameter, remember that Amazon Cognito won't do the following:

    • Store the ClientMetadata value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration doesn't include triggers, the ClientMetadata parameter serves no purpose.
    • Validate the ClientMetadata value.
    • Encrypt the ClientMetadata value. Don't use Amazon Cognito to provide sensitive information.
    • (string) --
      • (string) --
Return type

dict

Returns

Response Syntax

{
    'CodeDeliveryDetails': {
        'Destination': 'string',
        'DeliveryMedium': 'SMS'|'EMAIL',
        'AttributeName': 'string'
    }
}

Response Structure

  • (dict) --

    The verification code response returned by the server response to get the user attribute verification code.

    • CodeDeliveryDetails (dict) --

      The code delivery details returned by the server in response to the request to get the user attribute verification code.

      • Destination (string) --

        The email address or phone number destination where Amazon Cognito sent the code.

      • DeliveryMedium (string) --

        The method that Amazon Cognito used to send the code.

      • AttributeName (string) --

        The name of the attribute that Amazon Cognito verifies with the code.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.UnexpectedLambdaException
  • CognitoIdentityProvider.Client.exceptions.UserLambdaValidationException
  • CognitoIdentityProvider.Client.exceptions.InvalidLambdaResponseException
  • CognitoIdentityProvider.Client.exceptions.InvalidSmsRoleAccessPolicyException
  • CognitoIdentityProvider.Client.exceptions.InvalidSmsRoleTrustRelationshipException
  • CognitoIdentityProvider.Client.exceptions.InvalidEmailRoleAccessPolicyException
  • CognitoIdentityProvider.Client.exceptions.CodeDeliveryFailureException
  • CognitoIdentityProvider.Client.exceptions.LimitExceededException
  • CognitoIdentityProvider.Client.exceptions.PasswordResetRequiredException
  • CognitoIdentityProvider.Client.exceptions.UserNotFoundException
  • CognitoIdentityProvider.Client.exceptions.UserNotConfirmedException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
  • CognitoIdentityProvider.Client.exceptions.ForbiddenException
get_user_pool_mfa_config(**kwargs)

Gets the user pool multi-factor authentication (MFA) configuration.

See also: AWS API Documentation

Request Syntax

response = client.get_user_pool_mfa_config(
    UserPoolId='string'
)
Parameters
UserPoolId (string) --

[REQUIRED]

The user pool ID.

Return type
dict
Returns
Response Syntax
{
    'SmsMfaConfiguration': {
        'SmsAuthenticationMessage': 'string',
        'SmsConfiguration': {
            'SnsCallerArn': 'string',
            'ExternalId': 'string',
            'SnsRegion': 'string'
        }
    },
    'SoftwareTokenMfaConfiguration': {
        'Enabled': True|False
    },
    'MfaConfiguration': 'OFF'|'ON'|'OPTIONAL'
}

Response Structure

  • (dict) --
    • SmsMfaConfiguration (dict) --

      The SMS text message multi-factor authentication (MFA) configuration.

      • SmsAuthenticationMessage (string) --

        The SMS authentication message that will be sent to users with the code they must sign in. The message must contain the ‘{####}’ placeholder, which is replaced with the code. If the message isn't included, and default message will be used.

      • SmsConfiguration (dict) --

        The SMS configuration with the settings that your Amazon Cognito user pool must use to send an SMS message from your Amazon Web Services account through Amazon Simple Notification Service. To request Amazon SNS in the Amazon Web Services Region that you want, the Amazon Cognito user pool uses an Identity and Access Management (IAM) role that you provide for your Amazon Web Services account.

        • SnsCallerArn (string) --

          The Amazon Resource Name (ARN) of the Amazon SNS caller. This is the ARN of the IAM role in your Amazon Web Services account that Amazon Cognito will use to send SMS messages. SMS messages are subject to a spending limit .

        • ExternalId (string) --

          The external ID provides additional security for your IAM role. You can use an ExternalId with the IAM role that you use with Amazon SNS to send SMS messages for your user pool. If you provide an ExternalId , your Amazon Cognito user pool includes it in the request to assume your IAM role. You can configure the role trust policy to require that Amazon Cognito, and any principal, provide the ExternalID . If you use the Amazon Cognito Management Console to create a role for SMS multi-factor authentication (MFA), Amazon Cognito creates a role with the required permissions and a trust policy that demonstrates use of the ExternalId .

          For more information about the ExternalId of a role, see How to use an external ID when granting access to your Amazon Web Services resources to a third party

        • SnsRegion (string) --

          The Amazon Web Services Region to use with Amazon SNS integration. You can choose the same Region as your user pool, or a supported Legacy Amazon SNS alternate Region .

          Amazon Cognito resources in the Asia Pacific (Seoul) Amazon Web Services Region must use your Amazon SNS configuration in the Asia Pacific (Tokyo) Region. For more information, see SMS message settings for Amazon Cognito user pools .

    • SoftwareTokenMfaConfiguration (dict) --

      The software token multi-factor authentication (MFA) configuration.

      • Enabled (boolean) --

        Specifies whether software token MFA is activated.

    • MfaConfiguration (string) --

      The multi-factor authentication (MFA) configuration. Valid values include:

      • OFF MFA won't be used for any users.
      • ON MFA is required for all users to sign in.
      • OPTIONAL MFA will be required only for individual users who have an MFA factor activated.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
get_waiter(waiter_name)

Returns an object that can wait for some condition.

Parameters
waiter_name (str) -- The name of the waiter to get. See the waiters section of the service docs for a list of available waiters.
Returns
The specified waiter object.
Return type
botocore.waiter.Waiter
global_sign_out(**kwargs)

Signs out users from all devices. It also invalidates all refresh tokens that Amazon Cognito has issued to a user. The user's current access and ID tokens remain valid until their expiry. By default, access and ID tokens expire one hour after Amazon Cognito issues them. A user can still use a hosted UI cookie to retrieve new tokens for the duration of the cookie validity period of 1 hour.

See also: AWS API Documentation

Request Syntax

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

[REQUIRED]

A valid access token that Amazon Cognito issued to the user who you want to sign out.

Return type
dict
Returns
Response Syntax
{}

Response Structure

  • (dict) --

    The response to the request to sign out all devices.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.PasswordResetRequiredException
  • CognitoIdentityProvider.Client.exceptions.UserNotConfirmedException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
  • CognitoIdentityProvider.Client.exceptions.ForbiddenException
initiate_auth(**kwargs)

Initiates sign-in for a user in the Amazon Cognito user directory. You can't sign in a user with a federated IdP with InitiateAuth . For more information, see Adding user pool sign-in through a third party .

Note

This action might generate an SMS text message. Starting June 1, 2021, US telecom carriers require you to register an origination phone number before you can send SMS messages to US phone numbers. If you use SMS text messages in Amazon Cognito, you must register a phone number with Amazon Pinpoint . Amazon Cognito uses the registered number automatically. Otherwise, Amazon Cognito users who must receive SMS messages might not be able to sign up, activate their accounts, or sign in.

If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Service, Amazon Simple Notification Service might place your account in the SMS sandbox. In * sandbox mode * , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see SMS message settings for Amazon Cognito user pools in the Amazon Cognito Developer Guide .

See also: AWS API Documentation

Request Syntax

response = client.initiate_auth(
    AuthFlow='USER_SRP_AUTH'|'REFRESH_TOKEN_AUTH'|'REFRESH_TOKEN'|'CUSTOM_AUTH'|'ADMIN_NO_SRP_AUTH'|'USER_PASSWORD_AUTH'|'ADMIN_USER_PASSWORD_AUTH',
    AuthParameters={
        'string': 'string'
    },
    ClientMetadata={
        'string': 'string'
    },
    ClientId='string',
    AnalyticsMetadata={
        'AnalyticsEndpointId': 'string'
    },
    UserContextData={
        'IpAddress': 'string',
        'EncodedData': 'string'
    }
)
Parameters
  • AuthFlow (string) --

    [REQUIRED]

    The authentication flow for this call to run. The API action will depend on this value. For example:

    • REFRESH_TOKEN_AUTH takes in a valid refresh token and returns new tokens.
    • USER_SRP_AUTH takes in USERNAME and SRP_A and returns the SRP variables to be used for next challenge execution.
    • USER_PASSWORD_AUTH takes in USERNAME and PASSWORD and returns the next challenge or tokens.

    Valid values include:

    • USER_SRP_AUTH : Authentication flow for the Secure Remote Password (SRP) protocol.
    • REFRESH_TOKEN_AUTH /REFRESH_TOKEN : Authentication flow for refreshing the access token and ID token by supplying a valid refresh token.
    • CUSTOM_AUTH : Custom authentication flow.
    • USER_PASSWORD_AUTH : Non-SRP authentication flow; user name and password are passed directly. If a user migration Lambda trigger is set, this flow will invoke the user migration Lambda if it doesn't find the user name in the user pool.
    ADMIN_NO_SRP_AUTH isn't a valid value.
  • AuthParameters (dict) --

    The authentication parameters. These are inputs corresponding to the AuthFlow that you're invoking. The required values depend on the value of AuthFlow :

    • For USER_SRP_AUTH : USERNAME (required), SRP_A (required), SECRET_HASH (required if the app client is configured with a client secret), DEVICE_KEY .
    • For REFRESH_TOKEN_AUTH/REFRESH_TOKEN : REFRESH_TOKEN (required), SECRET_HASH (required if the app client is configured with a client secret), DEVICE_KEY .
    • For CUSTOM_AUTH : USERNAME (required), SECRET_HASH (if app client is configured with client secret), DEVICE_KEY . To start the authentication flow with password verification, include ChallengeName: SRP_A and SRP_A: (The SRP_A Value) .
    • (string) --
      • (string) --
  • ClientMetadata (dict) --

    A map of custom key-value pairs that you can provide as input for certain custom workflows that this action triggers.

    You create custom workflows by assigning Lambda functions to user pool triggers. When you use the InitiateAuth API action, Amazon Cognito invokes the Lambda functions that are specified for various triggers. The ClientMetadata value is passed as input to the functions for only the following triggers:

    • Pre signup
    • Pre authentication
    • User migration

    When Amazon Cognito invokes the functions for these triggers, it passes a JSON payload, which the function receives as input. This payload contains a validationData attribute, which provides the data that you assigned to the ClientMetadata parameter in your InitiateAuth request. In your function code in Lambda, you can process the validationData value to enhance your workflow for your specific needs.

    When you use the InitiateAuth API action, Amazon Cognito also invokes the functions for the following triggers, but it doesn't provide the ClientMetadata value as input:

    • Post authentication
    • Custom message
    • Pre token generation
    • Create auth challenge
    • Define auth challenge
    • Verify auth challenge

    For more information, see Customizing user pool Workflows with Lambda Triggers in the Amazon Cognito Developer Guide .

    Note

    When you use the ClientMetadata parameter, remember that Amazon Cognito won't do the following:

    • Store the ClientMetadata value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration doesn't include triggers, the ClientMetadata parameter serves no purpose.
    • Validate the ClientMetadata value.
    • Encrypt the ClientMetadata value. Don't use Amazon Cognito to provide sensitive information.
    • (string) --
      • (string) --
  • ClientId (string) --

    [REQUIRED]

    The app client ID.

  • AnalyticsMetadata (dict) --

    The Amazon Pinpoint analytics metadata that contributes to your metrics for InitiateAuth calls.

    • AnalyticsEndpointId (string) --

      The endpoint ID.

  • UserContextData (dict) --

    Contextual data about your user session, such as the device fingerprint, IP address, or location. Amazon Cognito advanced security evaluates the risk of an authentication event based on the context that your app generates and passes to Amazon Cognito when it makes API requests.

    • IpAddress (string) --

      The source IP address of your user's device.

    • EncodedData (string) --

      Encoded device-fingerprint details that your app collected with the Amazon Cognito context data collection library. For more information, see Adding user device and session data to API requests .

Return type

dict

Returns

Response Syntax

{
    'ChallengeName': 'SMS_MFA'|'SOFTWARE_TOKEN_MFA'|'SELECT_MFA_TYPE'|'MFA_SETUP'|'PASSWORD_VERIFIER'|'CUSTOM_CHALLENGE'|'DEVICE_SRP_AUTH'|'DEVICE_PASSWORD_VERIFIER'|'ADMIN_NO_SRP_AUTH'|'NEW_PASSWORD_REQUIRED',
    'Session': 'string',
    'ChallengeParameters': {
        'string': 'string'
    },
    'AuthenticationResult': {
        'AccessToken': 'string',
        'ExpiresIn': 123,
        'TokenType': 'string',
        'RefreshToken': 'string',
        'IdToken': 'string',
        'NewDeviceMetadata': {
            'DeviceKey': 'string',
            'DeviceGroupKey': 'string'
        }
    }
}

Response Structure

  • (dict) --

    Initiates the authentication response.

    • ChallengeName (string) --

      The name of the challenge that you're responding to with this call. This name is returned in the AdminInitiateAuth response if you must pass another challenge.

      Valid values include the following:

      Note

      All of the following challenges require USERNAME and SECRET_HASH (if applicable) in the parameters.

      • SMS_MFA : Next challenge is to supply an SMS_MFA_CODE , delivered via SMS.
      • PASSWORD_VERIFIER : Next challenge is to supply PASSWORD_CLAIM_SIGNATURE , PASSWORD_CLAIM_SECRET_BLOCK , and TIMESTAMP after the client-side SRP calculations.
      • CUSTOM_CHALLENGE : This is returned if your custom authentication flow determines that the user should pass another challenge before tokens are issued.
      • DEVICE_SRP_AUTH : If device tracking was activated on your user pool and the previous challenges were passed, this challenge is returned so that Amazon Cognito can start tracking this device.
      • DEVICE_PASSWORD_VERIFIER : Similar to PASSWORD_VERIFIER , but for devices only.
      • NEW_PASSWORD_REQUIRED : For users who are required to change their passwords after successful first login. Respond to this challenge with NEW_PASSWORD and any required attributes that Amazon Cognito returned in the requiredAttributes parameter. You can also set values for attributes that aren't required by your user pool and that your app client can write. For more information, see RespondToAuthChallenge .

      Note

      In a NEW_PASSWORD_REQUIRED challenge response, you can't modify a required attribute that already has a value. In RespondToAuthChallenge , set a value for any keys that Amazon Cognito returned in the requiredAttributes parameter, then use the UpdateUserAttributes API operation to modify the value of any additional attributes.

      • MFA_SETUP : For users who are required to setup an MFA factor before they can sign in. The MFA types activated for the user pool will be listed in the challenge parameters MFA_CAN_SETUP value. To set up software token MFA, use the session returned here from InitiateAuth as an input to AssociateSoftwareToken . Use the session returned by VerifySoftwareToken as an input to RespondToAuthChallenge with challenge name MFA_SETUP to complete sign-in. To set up SMS MFA, an administrator should help the user to add a phone number to their account, and then the user should call InitiateAuth again to restart sign-in.
    • Session (string) --

      The session that should pass both ways in challenge-response calls to the service. If the caller must pass another challenge, they return a session with other challenge parameters. This session should be passed as it is to the next RespondToAuthChallenge API call.

    • ChallengeParameters (dict) --

      The challenge parameters. These are returned in the InitiateAuth response if you must pass another challenge. The responses in this parameter should be used to compute inputs to the next call (RespondToAuthChallenge ).

      All challenges require USERNAME and SECRET_HASH (if applicable).

      • (string) --
        • (string) --
    • AuthenticationResult (dict) --

      The result of the authentication response. This result is only returned if the caller doesn't need to pass another challenge. If the caller does need to pass another challenge before it gets tokens, ChallengeName , ChallengeParameters , and Session are returned.

      • AccessToken (string) --

        A valid access token that Amazon Cognito issued to the user who you want to authenticate.

      • ExpiresIn (integer) --

        The expiration period of the authentication result in seconds.

      • TokenType (string) --

        The token type.

      • RefreshToken (string) --

        The refresh token.

      • IdToken (string) --

        The ID token.

      • NewDeviceMetadata (dict) --

        The new device metadata from an authentication result.

        • DeviceKey (string) --

          The device key.

        • DeviceGroupKey (string) --

          The device group key.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.UnexpectedLambdaException
  • CognitoIdentityProvider.Client.exceptions.InvalidUserPoolConfigurationException
  • CognitoIdentityProvider.Client.exceptions.UserLambdaValidationException
  • CognitoIdentityProvider.Client.exceptions.InvalidLambdaResponseException
  • CognitoIdentityProvider.Client.exceptions.PasswordResetRequiredException
  • CognitoIdentityProvider.Client.exceptions.UserNotFoundException
  • CognitoIdentityProvider.Client.exceptions.UserNotConfirmedException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
  • CognitoIdentityProvider.Client.exceptions.InvalidSmsRoleAccessPolicyException
  • CognitoIdentityProvider.Client.exceptions.InvalidSmsRoleTrustRelationshipException
  • CognitoIdentityProvider.Client.exceptions.ForbiddenException
list_devices(**kwargs)

Lists the sign-in devices that Amazon Cognito has registered to the current user.

See also: AWS API Documentation

Request Syntax

response = client.list_devices(
    AccessToken='string',
    Limit=123,
    PaginationToken='string'
)
Parameters
  • AccessToken (string) --

    [REQUIRED]

    A valid access token that Amazon Cognito issued to the user whose list of devices you want to view.

  • Limit (integer) -- The limit of the device request.
  • PaginationToken (string) -- The pagination token for the list request.
Return type

dict

Returns

Response Syntax

{
    'Devices': [
        {
            'DeviceKey': 'string',
            'DeviceAttributes': [
                {
                    'Name': 'string',
                    'Value': 'string'
                },
            ],
            'DeviceCreateDate': datetime(2015, 1, 1),
            'DeviceLastModifiedDate': datetime(2015, 1, 1),
            'DeviceLastAuthenticatedDate': datetime(2015, 1, 1)
        },
    ],
    'PaginationToken': 'string'
}

Response Structure

  • (dict) --

    Represents the response to list devices.

    • Devices (list) --

      The devices returned in the list devices response.

      • (dict) --

        The device type.

        • DeviceKey (string) --

          The device key.

        • DeviceAttributes (list) --

          The device attributes.

          • (dict) --

            Specifies whether the attribute is standard or custom.

            • Name (string) --

              The name of the attribute.

            • Value (string) --

              The value of the attribute.

        • DeviceCreateDate (datetime) --

          The creation date of the device.

        • DeviceLastModifiedDate (datetime) --

          The last modified date of the device.

        • DeviceLastAuthenticatedDate (datetime) --

          The date when the device was last authenticated.

    • PaginationToken (string) --

      The pagination token for the list device response.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.InvalidUserPoolConfigurationException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.PasswordResetRequiredException
  • CognitoIdentityProvider.Client.exceptions.UserNotFoundException
  • CognitoIdentityProvider.Client.exceptions.UserNotConfirmedException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
  • CognitoIdentityProvider.Client.exceptions.ForbiddenException
list_groups(**kwargs)

Lists the groups associated with a user pool.

Calling this action requires developer credentials.

See also: AWS API Documentation

Request Syntax

response = client.list_groups(
    UserPoolId='string',
    Limit=123,
    NextToken='string'
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool.

  • Limit (integer) -- The limit of the request to list groups.
  • NextToken (string) -- An identifier that was returned from the previous call to this operation, which can be used to return the next set of items in the list.
Return type

dict

Returns

Response Syntax

{
    'Groups': [
        {
            'GroupName': 'string',
            'UserPoolId': 'string',
            'Description': 'string',
            'RoleArn': 'string',
            'Precedence': 123,
            'LastModifiedDate': datetime(2015, 1, 1),
            'CreationDate': datetime(2015, 1, 1)
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • Groups (list) --

      The group objects for the groups.

      • (dict) --

        The group type.

        • GroupName (string) --

          The name of the group.

        • UserPoolId (string) --

          The user pool ID for the user pool.

        • Description (string) --

          A string containing the description of the group.

        • RoleArn (string) --

          The role Amazon Resource Name (ARN) for the group.

        • Precedence (integer) --

          A non-negative integer value that specifies the precedence of this group relative to the other groups that a user can belong to in the user pool. Zero is the highest precedence value. Groups with lower Precedence values take precedence over groups with higher ornull Precedence values. If a user belongs to two or more groups, it is the group with the lowest precedence value whose role ARN is given in the user's tokens for the cognito:roles and cognito:preferred_role claims.

          Two groups can have the same Precedence value. If this happens, neither group takes precedence over the other. If two groups with the same Precedence have the same role ARN, that role is used in the cognito:preferred_role claim in tokens for users in each group. If the two groups have different role ARNs, the cognito:preferred_role claim isn't set in users' tokens.

          The default Precedence value is null.

        • LastModifiedDate (datetime) --

          The date the group was last modified.

        • CreationDate (datetime) --

          The date the group was created.

    • NextToken (string) --

      An identifier that was returned from the previous call to this operation, which can be used to return the next set of items in the list.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
list_identity_providers(**kwargs)

Lists information about all IdPs for a user pool.

See also: AWS API Documentation

Request Syntax

response = client.list_identity_providers(
    UserPoolId='string',
    MaxResults=123,
    NextToken='string'
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID.

  • MaxResults (integer) -- The maximum number of IdPs to return.
  • NextToken (string) -- A pagination token.
Return type

dict

Returns

Response Syntax

{
    'Providers': [
        {
            'ProviderName': 'string',
            'ProviderType': 'SAML'|'Facebook'|'Google'|'LoginWithAmazon'|'SignInWithApple'|'OIDC',
            'LastModifiedDate': datetime(2015, 1, 1),
            'CreationDate': datetime(2015, 1, 1)
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • Providers (list) --

      A list of IdP objects.

      • (dict) --

        A container for IdP details.

        • ProviderName (string) --

          The IdP name.

        • ProviderType (string) --

          The IdP type.

        • LastModifiedDate (datetime) --

          The date the provider was last modified.

        • CreationDate (datetime) --

          The date the provider was added to the user pool.

    • NextToken (string) --

      A pagination token.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
list_resource_servers(**kwargs)

Lists the resource servers for a user pool.

See also: AWS API Documentation

Request Syntax

response = client.list_resource_servers(
    UserPoolId='string',
    MaxResults=123,
    NextToken='string'
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool.

  • MaxResults (integer) -- The maximum number of resource servers to return.
  • NextToken (string) -- A pagination token.
Return type

dict

Returns

Response Syntax

{
    'ResourceServers': [
        {
            'UserPoolId': 'string',
            'Identifier': 'string',
            'Name': 'string',
            'Scopes': [
                {
                    'ScopeName': 'string',
                    'ScopeDescription': 'string'
                },
            ]
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • ResourceServers (list) --

      The resource servers.

      • (dict) --

        A container for information about a resource server for a user pool.

        • UserPoolId (string) --

          The user pool ID for the user pool that hosts the resource server.

        • Identifier (string) --

          The identifier for the resource server.

        • Name (string) --

          The name of the resource server.

        • Scopes (list) --

          A list of scopes that are defined for the resource server.

          • (dict) --

            A resource server scope.

            • ScopeName (string) --

              The name of the scope.

            • ScopeDescription (string) --

              A description of the scope.

    • NextToken (string) --

      A pagination token.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
list_tags_for_resource(**kwargs)

Lists the tags that are assigned to an Amazon Cognito user pool.

A tag is a label that you can apply to user pools to categorize and manage them in different ways, such as by purpose, owner, environment, or other criteria.

You can use this action up to 10 times per second, per account.

See also: AWS API Documentation

Request Syntax

response = client.list_tags_for_resource(
    ResourceArn='string'
)
Parameters
ResourceArn (string) --

[REQUIRED]

The Amazon Resource Name (ARN) of the user pool that the tags are assigned to.

Return type
dict
Returns
Response Syntax
{
    'Tags': {
        'string': 'string'
    }
}

Response Structure

  • (dict) --
    • Tags (dict) --

      The tags that are assigned to the user pool.

      • (string) --
        • (string) --

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
list_user_import_jobs(**kwargs)

Lists the user import jobs.

See also: AWS API Documentation

Request Syntax

response = client.list_user_import_jobs(
    UserPoolId='string',
    MaxResults=123,
    PaginationToken='string'
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool that the users are being imported into.

  • MaxResults (integer) --

    [REQUIRED]

    The maximum number of import jobs you want the request to return.

  • PaginationToken (string) -- An identifier that was returned from the previous call to ListUserImportJobs , which can be used to return the next set of import jobs in the list.
Return type

dict

Returns

Response Syntax

{
    'UserImportJobs': [
        {
            'JobName': 'string',
            'JobId': 'string',
            'UserPoolId': 'string',
            'PreSignedUrl': 'string',
            'CreationDate': datetime(2015, 1, 1),
            'StartDate': datetime(2015, 1, 1),
            'CompletionDate': datetime(2015, 1, 1),
            'Status': 'Created'|'Pending'|'InProgress'|'Stopping'|'Expired'|'Stopped'|'Failed'|'Succeeded',
            'CloudWatchLogsRoleArn': 'string',
            'ImportedUsers': 123,
            'SkippedUsers': 123,
            'FailedUsers': 123,
            'CompletionMessage': 'string'
        },
    ],
    'PaginationToken': 'string'
}

Response Structure

  • (dict) --

    Represents the response from the server to the request to list the user import jobs.

    • UserImportJobs (list) --

      The user import jobs.

      • (dict) --

        The user import job type.

        • JobName (string) --

          The job name for the user import job.

        • JobId (string) --

          The job ID for the user import job.

        • UserPoolId (string) --

          The user pool ID for the user pool that the users are being imported into.

        • PreSignedUrl (string) --

          The pre-signed URL to be used to upload the .csv file.

        • CreationDate (datetime) --

          The date the user import job was created.

        • StartDate (datetime) --

          The date when the user import job was started.

        • CompletionDate (datetime) --

          The date when the user import job was completed.

        • Status (string) --

          The status of the user import job. One of the following:

          • Created - The job was created but not started.
          • Pending - A transition state. You have started the job, but it has not begun importing users yet.
          • InProgress - The job has started, and users are being imported.
          • Stopping - You have stopped the job, but the job has not stopped importing users yet.
          • Stopped - You have stopped the job, and the job has stopped importing users.
          • Succeeded - The job has completed successfully.
          • Failed - The job has stopped due to an error.
          • Expired - You created a job, but did not start the job within 24-48 hours. All data associated with the job was deleted, and the job can't be started.
        • CloudWatchLogsRoleArn (string) --

          The role Amazon Resource Name (ARN) for the Amazon CloudWatch Logging role for the user import job. For more information, see "Creating the CloudWatch Logs IAM Role" in the Amazon Cognito Developer Guide.

        • ImportedUsers (integer) --

          The number of users that were successfully imported.

        • SkippedUsers (integer) --

          The number of users that were skipped.

        • FailedUsers (integer) --

          The number of users that couldn't be imported.

        • CompletionMessage (string) --

          The message returned when the user import job is completed.

    • PaginationToken (string) --

      An identifier that can be used to return the next set of user import jobs in the list.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
list_user_pool_clients(**kwargs)

Lists the clients that have been created for the specified user pool.

See also: AWS API Documentation

Request Syntax

response = client.list_user_pool_clients(
    UserPoolId='string',
    MaxResults=123,
    NextToken='string'
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool where you want to list user pool clients.

  • MaxResults (integer) -- The maximum number of results you want the request to return when listing the user pool clients.
  • NextToken (string) -- An identifier that was returned from the previous call to this operation, which can be used to return the next set of items in the list.
Return type

dict

Returns

Response Syntax

{
    'UserPoolClients': [
        {
            'ClientId': 'string',
            'UserPoolId': 'string',
            'ClientName': 'string'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    Represents the response from the server that lists user pool clients.

    • UserPoolClients (list) --

      The user pool clients in the response that lists user pool clients.

      • (dict) --

        The description of the user pool client.

        • ClientId (string) --

          The ID of the client associated with the user pool.

        • UserPoolId (string) --

          The user pool ID for the user pool where you want to describe the user pool client.

        • ClientName (string) --

          The client name from the user pool client description.

    • NextToken (string) --

      An identifier that was returned from the previous call to this operation, which can be used to return the next set of items in the list.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
list_user_pools(**kwargs)

Lists the user pools associated with an Amazon Web Services account.

See also: AWS API Documentation

Request Syntax

response = client.list_user_pools(
    NextToken='string',
    MaxResults=123
)
Parameters
  • NextToken (string) -- An identifier that was returned from the previous call to this operation, which can be used to return the next set of items in the list.
  • MaxResults (integer) --

    [REQUIRED]

    The maximum number of results you want the request to return when listing the user pools.

Return type

dict

Returns

Response Syntax

{
    'UserPools': [
        {
            'Id': 'string',
            'Name': 'string',
            'LambdaConfig': {
                'PreSignUp': 'string',
                'CustomMessage': 'string',
                'PostConfirmation': 'string',
                'PreAuthentication': 'string',
                'PostAuthentication': 'string',
                'DefineAuthChallenge': 'string',
                'CreateAuthChallenge': 'string',
                'VerifyAuthChallengeResponse': 'string',
                'PreTokenGeneration': 'string',
                'UserMigration': 'string',
                'CustomSMSSender': {
                    'LambdaVersion': 'V1_0',
                    'LambdaArn': 'string'
                },
                'CustomEmailSender': {
                    'LambdaVersion': 'V1_0',
                    'LambdaArn': 'string'
                },
                'KMSKeyID': 'string'
            },
            'Status': 'Enabled'|'Disabled',
            'LastModifiedDate': datetime(2015, 1, 1),
            'CreationDate': datetime(2015, 1, 1)
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    Represents the response to list user pools.

    • UserPools (list) --

      The user pools from the response to list users.

      • (dict) --

        A user pool description.

        • Id (string) --

          The ID in a user pool description.

        • Name (string) --

          The name in a user pool description.

        • LambdaConfig (dict) --

          The Lambda configuration information in a user pool description.

          • PreSignUp (string) --

            A pre-registration Lambda trigger.

          • CustomMessage (string) --

            A custom Message Lambda trigger.

          • PostConfirmation (string) --

            A post-confirmation Lambda trigger.

          • PreAuthentication (string) --

            A pre-authentication Lambda trigger.

          • PostAuthentication (string) --

            A post-authentication Lambda trigger.

          • DefineAuthChallenge (string) --

            Defines the authentication challenge.

          • CreateAuthChallenge (string) --

            Creates an authentication challenge.

          • VerifyAuthChallengeResponse (string) --

            Verifies the authentication challenge response.

          • PreTokenGeneration (string) --

            A Lambda trigger that is invoked before token generation.

          • UserMigration (string) --

            The user migration Lambda config type.

          • CustomSMSSender (dict) --

            A custom SMS sender Lambda trigger.

            • LambdaVersion (string) --

              Signature of the "request" attribute in the "event" information that Amazon Cognito passes to your custom SMS Lambda function. The only supported value is V1_0 .

            • LambdaArn (string) --

              The Amazon Resource Name (ARN) of the Lambda function that Amazon Cognito activates to send SMS notifications to users.

          • CustomEmailSender (dict) --

            A custom email sender Lambda trigger.

            • LambdaVersion (string) --

              Signature of the "request" attribute in the "event" information Amazon Cognito passes to your custom email Lambda function. The only supported value is V1_0 .

            • LambdaArn (string) --

              The Amazon Resource Name (ARN) of the Lambda function that Amazon Cognito activates to send email notifications to users.

          • KMSKeyID (string) --

            The Amazon Resource Name (ARN) of an KMS key . Amazon Cognito uses the key to encrypt codes and temporary passwords sent to CustomEmailSender and CustomSMSSender .

        • Status (string) --

          The user pool status in a user pool description.

        • LastModifiedDate (datetime) --

          The date the user pool description was last modified.

        • CreationDate (datetime) --

          The date the user pool description was created.

    • NextToken (string) --

      An identifier that was returned from the previous call to this operation, which can be used to return the next set of items in the list.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
list_users(**kwargs)

Lists the users in the Amazon Cognito user pool.

See also: AWS API Documentation

Request Syntax

response = client.list_users(
    UserPoolId='string',
    AttributesToGet=[
        'string',
    ],
    Limit=123,
    PaginationToken='string',
    Filter='string'
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool on which the search should be performed.

  • AttributesToGet (list) --

    An array of strings, where each string is the name of a user attribute to be returned for each user in the search results. If the array is null, all attributes are returned.

    • (string) --
  • Limit (integer) -- Maximum number of users to be returned.
  • PaginationToken (string) -- An identifier that was returned from the previous call to this operation, which can be used to return the next set of items in the list.
  • Filter (string) --

    A filter string of the form "AttributeName Filter-Type "AttributeValue "". Quotation marks within the filter string must be escaped using the backslash () character. For example, "family_name = "Reddy"".

    • AttributeName : The name of the attribute to search for. You can only search for one attribute at a time.
    • Filter-Type : For an exact match, use =, for example, "given_name = "Jon"". For a prefix ("starts with") match, use ^=, for example, "given_name ^= "Jon"".
    • AttributeValue : The attribute value that must be matched for each user.

    If the filter string is empty, ListUsers returns all users in the user pool.

    You can only search for the following standard attributes:

    • username (case-sensitive)
    • email
    • phone_number
    • name
    • given_name
    • family_name
    • preferred_username
    • cognito:user_status (called Status in the Console) (case-insensitive)
    • status (called **Enabled** in the Console) (case-sensitive)
    • sub

    Custom attributes aren't searchable.

    Note

    You can also list users with a client-side filter. The server-side filter matches no more than one attribute. For an advanced search, use a client-side filter with the --query parameter of the list-users action in the CLI. When you use a client-side filter, ListUsers returns a paginated list of zero or more users. You can receive multiple pages in a row with zero results. Repeat the query with each pagination token that is returned until you receive a null pagination token value, and then review the combined result.

    For more information about server-side and client-side filtering, see FilteringCLI output in the Command Line Interface User Guide .

    For more information, see Searching for Users Using the ListUsers API and Examples of Using the ListUsers API in the Amazon Cognito Developer Guide .

Return type

dict

Returns

Response Syntax

{
    'Users': [
        {
            'Username': 'string',
            'Attributes': [
                {
                    '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'
                },
            ]
        },
    ],
    'PaginationToken': 'string'
}

Response Structure

  • (dict) --

    The response from the request to list users.

    • Users (list) --

      The users returned in the request to list users.

      • (dict) --

        A user profile in a Amazon Cognito user pool.

        • Username (string) --

          The user name of the user you want to describe.

        • Attributes (list) --

          A container with information about the user type 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 creation date of the user.

        • UserLastModifiedDate (datetime) --

          The last modified date of the user.

        • Enabled (boolean) --

          Specifies whether the user is enabled.

        • UserStatus (string) --

          The user status. This can be one of the following:

          • UNCONFIRMED - User has been created but not confirmed.
          • CONFIRMED - User has been confirmed.
          • EXTERNAL_PROVIDER - User signed in with a third-party IdP.
          • ARCHIVED - User is no longer active.
          • 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) --

          The MFA options for the user.

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

    • PaginationToken (string) --

      An identifier that was returned from the previous call to this operation, which can be used to return the next set of items in the list.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
list_users_in_group(**kwargs)

Lists the users in the specified group.

Calling this action requires developer credentials.

See also: AWS API Documentation

Request Syntax

response = client.list_users_in_group(
    UserPoolId='string',
    GroupName='string',
    Limit=123,
    NextToken='string'
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool.

  • GroupName (string) --

    [REQUIRED]

    The name of the group.

  • Limit (integer) -- The limit of the request to list users.
  • NextToken (string) -- An identifier that was returned from the previous call to this operation, which can be used to return the next set of items in the list.
Return type

dict

Returns

Response Syntax

{
    'Users': [
        {
            'Username': 'string',
            'Attributes': [
                {
                    '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'
                },
            ]
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • Users (list) --

      The users returned in the request to list users.

      • (dict) --

        A user profile in a Amazon Cognito user pool.

        • Username (string) --

          The user name of the user you want to describe.

        • Attributes (list) --

          A container with information about the user type 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 creation date of the user.

        • UserLastModifiedDate (datetime) --

          The last modified date of the user.

        • Enabled (boolean) --

          Specifies whether the user is enabled.

        • UserStatus (string) --

          The user status. This can be one of the following:

          • UNCONFIRMED - User has been created but not confirmed.
          • CONFIRMED - User has been confirmed.
          • EXTERNAL_PROVIDER - User signed in with a third-party IdP.
          • ARCHIVED - User is no longer active.
          • 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) --

          The MFA options for the user.

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

    • NextToken (string) --

      An identifier that you can use in a later request to return the next set of items in the list.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
resend_confirmation_code(**kwargs)

Resends the confirmation (for confirmation of registration) to a specific user in the user pool.

Note

This action might generate an SMS text message. Starting June 1, 2021, US telecom carriers require you to register an origination phone number before you can send SMS messages to US phone numbers. If you use SMS text messages in Amazon Cognito, you must register a phone number with Amazon Pinpoint . Amazon Cognito uses the registered number automatically. Otherwise, Amazon Cognito users who must receive SMS messages might not be able to sign up, activate their accounts, or sign in.

If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Service, Amazon Simple Notification Service might place your account in the SMS sandbox. In * sandbox mode * , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see SMS message settings for Amazon Cognito user pools in the Amazon Cognito Developer Guide .

See also: AWS API Documentation

Request Syntax

response = client.resend_confirmation_code(
    ClientId='string',
    SecretHash='string',
    UserContextData={
        'IpAddress': 'string',
        'EncodedData': 'string'
    },
    Username='string',
    AnalyticsMetadata={
        'AnalyticsEndpointId': 'string'
    },
    ClientMetadata={
        'string': 'string'
    }
)
Parameters
  • ClientId (string) --

    [REQUIRED]

    The ID of the client associated with the user pool.

  • SecretHash (string) -- A keyed-hash message authentication code (HMAC) calculated using the secret key of a user pool client and username plus the client ID in the message.
  • UserContextData (dict) --

    Contextual data about your user session, such as the device fingerprint, IP address, or location. Amazon Cognito advanced security evaluates the risk of an authentication event based on the context that your app generates and passes to Amazon Cognito when it makes API requests.

    • IpAddress (string) --

      The source IP address of your user's device.

    • EncodedData (string) --

      Encoded device-fingerprint details that your app collected with the Amazon Cognito context data collection library. For more information, see Adding user device and session data to API requests .

  • Username (string) --

    [REQUIRED]

    The username attribute of the user to whom you want to resend a confirmation code.

  • AnalyticsMetadata (dict) --

    The Amazon Pinpoint analytics metadata that contributes to your metrics for ResendConfirmationCode calls.

    • AnalyticsEndpointId (string) --

      The endpoint ID.

  • ClientMetadata (dict) --

    A map of custom key-value pairs that you can provide as input for any custom workflows that this action triggers.

    You create custom workflows by assigning Lambda functions to user pool triggers. When you use the ResendConfirmationCode API action, Amazon Cognito invokes the function that is assigned to the custom message trigger. When Amazon Cognito invokes this function, it passes a JSON payload, which the function receives as input. This payload contains a clientMetadata attribute, which provides the data that you assigned to the ClientMetadata parameter in your ResendConfirmationCode request. In your function code in Lambda, you can process the clientMetadata value to enhance your workflow for your specific needs.

    For more information, see Customizing user pool Workflows with Lambda Triggers in the Amazon Cognito Developer Guide .

    Note

    When you use the ClientMetadata parameter, remember that Amazon Cognito won't do the following:

    • Store the ClientMetadata value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration doesn't include triggers, the ClientMetadata parameter serves no purpose.
    • Validate the ClientMetadata value.
    • Encrypt the ClientMetadata value. Don't use Amazon Cognito to provide sensitive information.
    • (string) --
      • (string) --
Return type

dict

Returns

Response Syntax

{
    'CodeDeliveryDetails': {
        'Destination': 'string',
        'DeliveryMedium': 'SMS'|'EMAIL',
        'AttributeName': 'string'
    }
}

Response Structure

  • (dict) --

    The response from the server when Amazon Cognito makes the request to resend a confirmation code.

    • CodeDeliveryDetails (dict) --

      The code delivery details returned by the server in response to the request to resend the confirmation code.

      • Destination (string) --

        The email address or phone number destination where Amazon Cognito sent the code.

      • DeliveryMedium (string) --

        The method that Amazon Cognito used to send the code.

      • AttributeName (string) --

        The name of the attribute that Amazon Cognito verifies with the code.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.UnexpectedLambdaException
  • CognitoIdentityProvider.Client.exceptions.UserLambdaValidationException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.InvalidLambdaResponseException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.LimitExceededException
  • CognitoIdentityProvider.Client.exceptions.InvalidSmsRoleAccessPolicyException
  • CognitoIdentityProvider.Client.exceptions.InvalidSmsRoleTrustRelationshipException
  • CognitoIdentityProvider.Client.exceptions.InvalidEmailRoleAccessPolicyException
  • CognitoIdentityProvider.Client.exceptions.CodeDeliveryFailureException
  • CognitoIdentityProvider.Client.exceptions.UserNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
  • CognitoIdentityProvider.Client.exceptions.ForbiddenException
respond_to_auth_challenge(**kwargs)

Responds to the authentication challenge.

Note

This action might generate an SMS text message. Starting June 1, 2021, US telecom carriers require you to register an origination phone number before you can send SMS messages to US phone numbers. If you use SMS text messages in Amazon Cognito, you must register a phone number with Amazon Pinpoint . Amazon Cognito uses the registered number automatically. Otherwise, Amazon Cognito users who must receive SMS messages might not be able to sign up, activate their accounts, or sign in.

If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Service, Amazon Simple Notification Service might place your account in the SMS sandbox. In * sandbox mode * , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see SMS message settings for Amazon Cognito user pools in the Amazon Cognito Developer Guide .

See also: AWS API Documentation

Request Syntax

response = client.respond_to_auth_challenge(
    ClientId='string',
    ChallengeName='SMS_MFA'|'SOFTWARE_TOKEN_MFA'|'SELECT_MFA_TYPE'|'MFA_SETUP'|'PASSWORD_VERIFIER'|'CUSTOM_CHALLENGE'|'DEVICE_SRP_AUTH'|'DEVICE_PASSWORD_VERIFIER'|'ADMIN_NO_SRP_AUTH'|'NEW_PASSWORD_REQUIRED',
    Session='string',
    ChallengeResponses={
        'string': 'string'
    },
    AnalyticsMetadata={
        'AnalyticsEndpointId': 'string'
    },
    UserContextData={
        'IpAddress': 'string',
        'EncodedData': 'string'
    },
    ClientMetadata={
        'string': 'string'
    }
)
Parameters
  • ClientId (string) --

    [REQUIRED]

    The app client ID.

  • ChallengeName (string) --

    [REQUIRED]

    The challenge name. For more information, see InitiateAuth .

    ADMIN_NO_SRP_AUTH isn't a valid value.
  • Session (string) -- The session that should be passed both ways in challenge-response calls to the service. If InitiateAuth or RespondToAuthChallenge API call determines that the caller must pass another challenge, they return a session with other challenge parameters. This session should be passed as it is to the next RespondToAuthChallenge API call.
  • ChallengeResponses (dict) --

    The challenge responses. These are inputs corresponding to the value of ChallengeName , for example:

    Note

    SECRET_HASH (if app client is configured with client secret) applies to all of the inputs that follow (including SOFTWARE_TOKEN_MFA ).

    • SMS_MFA : SMS_MFA_CODE , USERNAME .
    • PASSWORD_VERIFIER : PASSWORD_CLAIM_SIGNATURE , PASSWORD_CLAIM_SECRET_BLOCK , TIMESTAMP , USERNAME .

    Note

    PASSWORD_VERIFIER requires DEVICE_KEY when you sign in with a remembered device.

    • NEW_PASSWORD_REQUIRED : NEW_PASSWORD , USERNAME , SECRET_HASH (if app client is configured with client secret). To set any required attributes that Amazon Cognito returned as requiredAttributes in the InitiateAuth response, add a ``userAttributes.*attributename* `` parameter. This parameter can also set values for writable attributes that aren't required by your user pool.

    Note

    In a NEW_PASSWORD_REQUIRED challenge response, you can't modify a required attribute that already has a value. In RespondToAuthChallenge , set a value for any keys that Amazon Cognito returned in the requiredAttributes parameter, then use the UpdateUserAttributes API operation to modify the value of any additional attributes.

    • SOFTWARE_TOKEN_MFA : USERNAME and SOFTWARE_TOKEN_MFA_CODE are required attributes.
    • DEVICE_SRP_AUTH requires USERNAME , DEVICE_KEY , SRP_A (and SECRET_HASH ).
    • DEVICE_PASSWORD_VERIFIER requires everything that PASSWORD_VERIFIER requires, plus DEVICE_KEY .
    • MFA_SETUP requires USERNAME , plus you must use the session value returned by VerifySoftwareToken in the Session parameter.
    • (string) --
      • (string) --
  • AnalyticsMetadata (dict) --

    The Amazon Pinpoint analytics metadata that contributes to your metrics for RespondToAuthChallenge calls.

    • AnalyticsEndpointId (string) --

      The endpoint ID.

  • UserContextData (dict) --

    Contextual data about your user session, such as the device fingerprint, IP address, or location. Amazon Cognito advanced security evaluates the risk of an authentication event based on the context that your app generates and passes to Amazon Cognito when it makes API requests.

    • IpAddress (string) --

      The source IP address of your user's device.

    • EncodedData (string) --

      Encoded device-fingerprint details that your app collected with the Amazon Cognito context data collection library. For more information, see Adding user device and session data to API requests .

  • ClientMetadata (dict) --

    A map of custom key-value pairs that you can provide as input for any custom workflows that this action triggers.

    You create custom workflows by assigning Lambda functions to user pool triggers. When you use the RespondToAuthChallenge API action, Amazon Cognito invokes any functions that are assigned to the following triggers: post authentication , pre token generation , define auth challenge , create auth challenge , and verify auth challenge . When Amazon Cognito invokes any of these functions, it passes a JSON payload, which the function receives as input. This payload contains a clientMetadata attribute, which provides the data that you assigned to the ClientMetadata parameter in your RespondToAuthChallenge request. In your function code in Lambda, you can process the clientMetadata value to enhance your workflow for your specific needs.

    For more information, see Customizing user pool Workflows with Lambda Triggers in the Amazon Cognito Developer Guide .

    Note

    When you use the ClientMetadata parameter, remember that Amazon Cognito won't do the following:

    • Store the ClientMetadata value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration doesn't include triggers, the ClientMetadata parameter serves no purpose.
    • Validate the ClientMetadata value.
    • Encrypt the ClientMetadata value. Don't use Amazon Cognito to provide sensitive information.
    • (string) --
      • (string) --
Return type

dict

Returns

Response Syntax

{
    'ChallengeName': 'SMS_MFA'|'SOFTWARE_TOKEN_MFA'|'SELECT_MFA_TYPE'|'MFA_SETUP'|'PASSWORD_VERIFIER'|'CUSTOM_CHALLENGE'|'DEVICE_SRP_AUTH'|'DEVICE_PASSWORD_VERIFIER'|'ADMIN_NO_SRP_AUTH'|'NEW_PASSWORD_REQUIRED',
    'Session': 'string',
    'ChallengeParameters': {
        'string': 'string'
    },
    'AuthenticationResult': {
        'AccessToken': 'string',
        'ExpiresIn': 123,
        'TokenType': 'string',
        'RefreshToken': 'string',
        'IdToken': 'string',
        'NewDeviceMetadata': {
            'DeviceKey': 'string',
            'DeviceGroupKey': 'string'
        }
    }
}

Response Structure

  • (dict) --

    The response to respond to the authentication challenge.

    • ChallengeName (string) --

      The challenge name. For more information, see InitiateAuth .

    • Session (string) --

      The session that should be passed both ways in challenge-response calls to the service. If the caller must pass another challenge, they return a session with other challenge parameters. This session should be passed as it is to the next RespondToAuthChallenge API call.

    • ChallengeParameters (dict) --

      The challenge parameters. For more information, see InitiateAuth .

      • (string) --
        • (string) --
    • AuthenticationResult (dict) --

      The result returned by the server in response to the request to respond to the authentication challenge.

      • AccessToken (string) --

        A valid access token that Amazon Cognito issued to the user who you want to authenticate.

      • ExpiresIn (integer) --

        The expiration period of the authentication result in seconds.

      • TokenType (string) --

        The token type.

      • RefreshToken (string) --

        The refresh token.

      • IdToken (string) --

        The ID token.

      • NewDeviceMetadata (dict) --

        The new device metadata from an authentication result.

        • DeviceKey (string) --

          The device key.

        • DeviceGroupKey (string) --

          The device group key.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.CodeMismatchException
  • CognitoIdentityProvider.Client.exceptions.ExpiredCodeException
  • CognitoIdentityProvider.Client.exceptions.UnexpectedLambdaException
  • CognitoIdentityProvider.Client.exceptions.UserLambdaValidationException
  • CognitoIdentityProvider.Client.exceptions.InvalidPasswordException
  • CognitoIdentityProvider.Client.exceptions.InvalidLambdaResponseException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.InvalidUserPoolConfigurationException
  • CognitoIdentityProvider.Client.exceptions.MFAMethodNotFoundException
  • CognitoIdentityProvider.Client.exceptions.PasswordResetRequiredException
  • CognitoIdentityProvider.Client.exceptions.UserNotFoundException
  • CognitoIdentityProvider.Client.exceptions.UserNotConfirmedException
  • CognitoIdentityProvider.Client.exceptions.InvalidSmsRoleAccessPolicyException
  • CognitoIdentityProvider.Client.exceptions.InvalidSmsRoleTrustRelationshipException
  • CognitoIdentityProvider.Client.exceptions.AliasExistsException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
  • CognitoIdentityProvider.Client.exceptions.SoftwareTokenMFANotFoundException
  • CognitoIdentityProvider.Client.exceptions.ForbiddenException
revoke_token(**kwargs)

Revokes all of the access tokens generated by the specified refresh token. After the token is revoked, you can't use the revoked token to access Amazon Cognito authenticated APIs.

See also: AWS API Documentation

Request Syntax

response = client.revoke_token(
    Token='string',
    ClientId='string',
    ClientSecret='string'
)
Parameters
  • Token (string) --

    [REQUIRED]

    The refresh token that you want to revoke.

  • ClientId (string) --

    [REQUIRED]

    The client ID for the token that you want to revoke.

  • ClientSecret (string) -- The secret for the client ID. This is required only if the client ID has a secret.
Return type

dict

Returns

Response Syntax

{}

Response Structure

  • (dict) --

Exceptions

  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
  • CognitoIdentityProvider.Client.exceptions.UnauthorizedException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.UnsupportedOperationException
  • CognitoIdentityProvider.Client.exceptions.UnsupportedTokenTypeException
  • CognitoIdentityProvider.Client.exceptions.ForbiddenException
set_risk_configuration(**kwargs)

Configures actions on detected risks. To delete the risk configuration for UserPoolId or ClientId , pass null values for all four configuration types.

To activate Amazon Cognito advanced security features, update the user pool to include the UserPoolAddOns key``AdvancedSecurityMode`` .

See also: AWS API Documentation

Request Syntax

response = client.set_risk_configuration(
    UserPoolId='string',
    ClientId='string',
    CompromisedCredentialsRiskConfiguration={
        'EventFilter': [
            'SIGN_IN'|'PASSWORD_CHANGE'|'SIGN_UP',
        ],
        'Actions': {
            'EventAction': 'BLOCK'|'NO_ACTION'
        }
    },
    AccountTakeoverRiskConfiguration={
        'NotifyConfiguration': {
            'From': 'string',
            'ReplyTo': 'string',
            'SourceArn': 'string',
            'BlockEmail': {
                'Subject': 'string',
                'HtmlBody': 'string',
                'TextBody': 'string'
            },
            'NoActionEmail': {
                'Subject': 'string',
                'HtmlBody': 'string',
                'TextBody': 'string'
            },
            'MfaEmail': {
                'Subject': 'string',
                'HtmlBody': 'string',
                'TextBody': 'string'
            }
        },
        'Actions': {
            'LowAction': {
                'Notify': True|False,
                'EventAction': 'BLOCK'|'MFA_IF_CONFIGURED'|'MFA_REQUIRED'|'NO_ACTION'
            },
            'MediumAction': {
                'Notify': True|False,
                'EventAction': 'BLOCK'|'MFA_IF_CONFIGURED'|'MFA_REQUIRED'|'NO_ACTION'
            },
            'HighAction': {
                'Notify': True|False,
                'EventAction': 'BLOCK'|'MFA_IF_CONFIGURED'|'MFA_REQUIRED'|'NO_ACTION'
            }
        }
    },
    RiskExceptionConfiguration={
        'BlockedIPRangeList': [
            'string',
        ],
        'SkippedIPRangeList': [
            'string',
        ]
    }
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID.

  • ClientId (string) --

    The app client ID. If ClientId is null, then the risk configuration is mapped to userPoolId . When the client ID is null, the same risk configuration is applied to all the clients in the userPool.

    Otherwise, ClientId is mapped to the client. When the client ID isn't null, the user pool configuration is overridden and the risk configuration for the client is used instead.

  • CompromisedCredentialsRiskConfiguration (dict) --

    The compromised credentials risk configuration.

    • EventFilter (list) --

      Perform the action for these events. The default is to perform all events if no event filter is specified.

      • (string) --
    • Actions (dict) -- [REQUIRED]

      The compromised credentials risk configuration actions.

      • EventAction (string) -- [REQUIRED]

        The event action.

  • AccountTakeoverRiskConfiguration (dict) --

    The account takeover risk configuration.

    • NotifyConfiguration (dict) --

      The notify configuration used to construct email notifications.

      • From (string) --

        The email address that is sending the email. The address must be either individually verified with Amazon Simple Email Service, or from a domain that has been verified with Amazon SES.

      • ReplyTo (string) --

        The destination to which the receiver of an email should reply to.

      • SourceArn (string) -- [REQUIRED]

        The Amazon Resource Name (ARN) of the identity that is associated with the sending authorization policy. This identity permits Amazon Cognito to send for the email address specified in the From parameter.

      • BlockEmail (dict) --

        Email template used when a detected risk event is blocked.

        • Subject (string) -- [REQUIRED]

          The email subject.

        • HtmlBody (string) --

          The email HTML body.

        • TextBody (string) --

          The email text body.

      • NoActionEmail (dict) --

        The email template used when a detected risk event is allowed.

        • Subject (string) -- [REQUIRED]

          The email subject.

        • HtmlBody (string) --

          The email HTML body.

        • TextBody (string) --

          The email text body.

      • MfaEmail (dict) --

        The multi-factor authentication (MFA) email template used when MFA is challenged as part of a detected risk.

        • Subject (string) -- [REQUIRED]

          The email subject.

        • HtmlBody (string) --

          The email HTML body.

        • TextBody (string) --

          The email text body.

    • Actions (dict) -- [REQUIRED]

      Account takeover risk configuration actions.

      • LowAction (dict) --

        Action to take for a low risk.

        • Notify (boolean) -- [REQUIRED]

          Flag specifying whether to send a notification.

        • EventAction (string) -- [REQUIRED]

          The action to take in response to the account takeover action. Valid values are as follows:

          • BLOCK Choosing this action will block the request.
          • MFA_IF_CONFIGURED Present an MFA challenge if user has configured it, else allow the request.
          • MFA_REQUIRED Present an MFA challenge if user has configured it, else block the request.
          • NO_ACTION Allow the user to sign in.
      • MediumAction (dict) --

        Action to take for a medium risk.

        • Notify (boolean) -- [REQUIRED]

          Flag specifying whether to send a notification.

        • EventAction (string) -- [REQUIRED]

          The action to take in response to the account takeover action. Valid values are as follows:

          • BLOCK Choosing this action will block the request.
          • MFA_IF_CONFIGURED Present an MFA challenge if user has configured it, else allow the request.
          • MFA_REQUIRED Present an MFA challenge if user has configured it, else block the request.
          • NO_ACTION Allow the user to sign in.
      • HighAction (dict) --

        Action to take for a high risk.

        • Notify (boolean) -- [REQUIRED]

          Flag specifying whether to send a notification.

        • EventAction (string) -- [REQUIRED]

          The action to take in response to the account takeover action. Valid values are as follows:

          • BLOCK Choosing this action will block the request.
          • MFA_IF_CONFIGURED Present an MFA challenge if user has configured it, else allow the request.
          • MFA_REQUIRED Present an MFA challenge if user has configured it, else block the request.
          • NO_ACTION Allow the user to sign in.
  • RiskExceptionConfiguration (dict) --

    The configuration to override the risk decision.

    • BlockedIPRangeList (list) --

      Overrides the risk decision to always block the pre-authentication requests. The IP range is in CIDR notation, a compact representation of an IP address and its routing prefix.

      • (string) --
    • SkippedIPRangeList (list) --

      Risk detection isn't performed on the IP addresses in this range list. The IP range is in CIDR notation.

      • (string) --
Return type

dict

Returns

Response Syntax

{
    'RiskConfiguration': {
        'UserPoolId': 'string',
        'ClientId': 'string',
        'CompromisedCredentialsRiskConfiguration': {
            'EventFilter': [
                'SIGN_IN'|'PASSWORD_CHANGE'|'SIGN_UP',
            ],
            'Actions': {
                'EventAction': 'BLOCK'|'NO_ACTION'
            }
        },
        'AccountTakeoverRiskConfiguration': {
            'NotifyConfiguration': {
                'From': 'string',
                'ReplyTo': 'string',
                'SourceArn': 'string',
                'BlockEmail': {
                    'Subject': 'string',
                    'HtmlBody': 'string',
                    'TextBody': 'string'
                },
                'NoActionEmail': {
                    'Subject': 'string',
                    'HtmlBody': 'string',
                    'TextBody': 'string'
                },
                'MfaEmail': {
                    'Subject': 'string',
                    'HtmlBody': 'string',
                    'TextBody': 'string'
                }
            },
            'Actions': {
                'LowAction': {
                    'Notify': True|False,
                    'EventAction': 'BLOCK'|'MFA_IF_CONFIGURED'|'MFA_REQUIRED'|'NO_ACTION'
                },
                'MediumAction': {
                    'Notify': True|False,
                    'EventAction': 'BLOCK'|'MFA_IF_CONFIGURED'|'MFA_REQUIRED'|'NO_ACTION'
                },
                'HighAction': {
                    'Notify': True|False,
                    'EventAction': 'BLOCK'|'MFA_IF_CONFIGURED'|'MFA_REQUIRED'|'NO_ACTION'
                }
            }
        },
        'RiskExceptionConfiguration': {
            'BlockedIPRangeList': [
                'string',
            ],
            'SkippedIPRangeList': [
                'string',
            ]
        },
        'LastModifiedDate': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) --

    • RiskConfiguration (dict) --

      The risk configuration.

      • UserPoolId (string) --

        The user pool ID.

      • ClientId (string) --

        The app client ID.

      • CompromisedCredentialsRiskConfiguration (dict) --

        The compromised credentials risk configuration object, including the EventFilter and the EventAction .

        • EventFilter (list) --

          Perform the action for these events. The default is to perform all events if no event filter is specified.

          • (string) --
        • Actions (dict) --

          The compromised credentials risk configuration actions.

          • EventAction (string) --

            The event action.

      • AccountTakeoverRiskConfiguration (dict) --

        The account takeover risk configuration object, including the NotifyConfiguration object and Actions to take if there is an account takeover.

        • NotifyConfiguration (dict) --

          The notify configuration used to construct email notifications.

          • From (string) --

            The email address that is sending the email. The address must be either individually verified with Amazon Simple Email Service, or from a domain that has been verified with Amazon SES.

          • ReplyTo (string) --

            The destination to which the receiver of an email should reply to.

          • SourceArn (string) --

            The Amazon Resource Name (ARN) of the identity that is associated with the sending authorization policy. This identity permits Amazon Cognito to send for the email address specified in the From parameter.

          • BlockEmail (dict) --

            Email template used when a detected risk event is blocked.

            • Subject (string) --

              The email subject.

            • HtmlBody (string) --

              The email HTML body.

            • TextBody (string) --

              The email text body.

          • NoActionEmail (dict) --

            The email template used when a detected risk event is allowed.

            • Subject (string) --

              The email subject.

            • HtmlBody (string) --

              The email HTML body.

            • TextBody (string) --

              The email text body.

          • MfaEmail (dict) --

            The multi-factor authentication (MFA) email template used when MFA is challenged as part of a detected risk.

            • Subject (string) --

              The email subject.

            • HtmlBody (string) --

              The email HTML body.

            • TextBody (string) --

              The email text body.

        • Actions (dict) --

          Account takeover risk configuration actions.

          • LowAction (dict) --

            Action to take for a low risk.

            • Notify (boolean) --

              Flag specifying whether to send a notification.

            • EventAction (string) --

              The action to take in response to the account takeover action. Valid values are as follows:

              • BLOCK Choosing this action will block the request.
              • MFA_IF_CONFIGURED Present an MFA challenge if user has configured it, else allow the request.
              • MFA_REQUIRED Present an MFA challenge if user has configured it, else block the request.
              • NO_ACTION Allow the user to sign in.
          • MediumAction (dict) --

            Action to take for a medium risk.

            • Notify (boolean) --

              Flag specifying whether to send a notification.

            • EventAction (string) --

              The action to take in response to the account takeover action. Valid values are as follows:

              • BLOCK Choosing this action will block the request.
              • MFA_IF_CONFIGURED Present an MFA challenge if user has configured it, else allow the request.
              • MFA_REQUIRED Present an MFA challenge if user has configured it, else block the request.
              • NO_ACTION Allow the user to sign in.
          • HighAction (dict) --

            Action to take for a high risk.

            • Notify (boolean) --

              Flag specifying whether to send a notification.

            • EventAction (string) --

              The action to take in response to the account takeover action. Valid values are as follows:

              • BLOCK Choosing this action will block the request.
              • MFA_IF_CONFIGURED Present an MFA challenge if user has configured it, else allow the request.
              • MFA_REQUIRED Present an MFA challenge if user has configured it, else block the request.
              • NO_ACTION Allow the user to sign in.
      • RiskExceptionConfiguration (dict) --

        The configuration to override the risk decision.

        • BlockedIPRangeList (list) --

          Overrides the risk decision to always block the pre-authentication requests. The IP range is in CIDR notation, a compact representation of an IP address and its routing prefix.

          • (string) --
        • SkippedIPRangeList (list) --

          Risk detection isn't performed on the IP addresses in this range list. The IP range is in CIDR notation.

          • (string) --
      • LastModifiedDate (datetime) --

        The last modified date.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.UserPoolAddOnNotEnabledException
  • CognitoIdentityProvider.Client.exceptions.CodeDeliveryFailureException
  • CognitoIdentityProvider.Client.exceptions.InvalidEmailRoleAccessPolicyException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
set_ui_customization(**kwargs)

Sets the user interface (UI) customization information for a user pool's built-in app UI.

You can specify app UI customization settings for a single client (with a specific clientId ) or for all clients (by setting the clientId to ALL ). If you specify ALL , the default configuration is used for every client that has no previously set UI customization. If you specify UI customization settings for a particular client, it will no longer return to the ALL configuration.

Note

To use this API, your user pool must have a domain associated with it. Otherwise, there is no place to host the app's pages, and the service will throw an error.

See also: AWS API Documentation

Request Syntax

response = client.set_ui_customization(
    UserPoolId='string',
    ClientId='string',
    CSS='string',
    ImageFile=b'bytes'
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool.

  • ClientId (string) -- The client ID for the client app.
  • CSS (string) -- The CSS values in the UI customization.
  • ImageFile (bytes) -- The uploaded logo image for the UI customization.
Return type

dict

Returns

Response Syntax

{
    'UICustomization': {
        'UserPoolId': 'string',
        'ClientId': 'string',
        'ImageUrl': 'string',
        'CSS': 'string',
        'CSSVersion': 'string',
        'LastModifiedDate': datetime(2015, 1, 1),
        'CreationDate': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) --

    • UICustomization (dict) --

      The UI customization information.

      • UserPoolId (string) --

        The user pool ID for the user pool.

      • ClientId (string) --

        The client ID for the client app.

      • ImageUrl (string) --

        The logo image for the UI customization.

      • CSS (string) --

        The CSS values in the UI customization.

      • CSSVersion (string) --

        The CSS version number.

      • LastModifiedDate (datetime) --

        The last-modified date for the UI customization.

      • CreationDate (datetime) --

        The creation date for the UI customization.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
set_user_mfa_preference(**kwargs)

Set the user's multi-factor authentication (MFA) method preference, including which MFA factors are activated and if any are preferred. Only one factor can be set as preferred. The preferred MFA factor will be used to authenticate a user if multiple factors are activated. If multiple options are activated and no preference is set, a challenge to choose an MFA option will be returned during sign-in. If an MFA type is activated for a user, the user will be prompted for MFA during all sign-in attempts unless device tracking is turned on and the device has been trusted. If you want MFA to be applied selectively based on the assessed risk level of sign-in attempts, deactivate MFA for users and turn on Adaptive Authentication for the user pool.

See also: AWS API Documentation

Request Syntax

response = client.set_user_mfa_preference(
    SMSMfaSettings={
        'Enabled': True|False,
        'PreferredMfa': True|False
    },
    SoftwareTokenMfaSettings={
        'Enabled': True|False,
        'PreferredMfa': True|False
    },
    AccessToken='string'
)
Parameters
  • SMSMfaSettings (dict) --

    The SMS text message multi-factor authentication (MFA) settings.

    • Enabled (boolean) --

      Specifies whether SMS text message MFA is activated. If an MFA type is activated for a user, the user will be prompted for MFA during all sign-in attempts, unless device tracking is turned on and the device has been trusted.

    • PreferredMfa (boolean) --

      Specifies whether SMS is the preferred MFA method.

  • SoftwareTokenMfaSettings (dict) --

    The time-based one-time password (TOTP) software token MFA settings.

    • Enabled (boolean) --

      Specifies whether software token MFA is activated. If an MFA type is activated for a user, the user will be prompted for MFA during all sign-in attempts, unless device tracking is turned on and the device has been trusted.

    • PreferredMfa (boolean) --

      Specifies whether software token MFA is the preferred MFA method.

  • AccessToken (string) --

    [REQUIRED]

    A valid access token that Amazon Cognito issued to the user whose MFA preference you want to set.

Return type

dict

Returns

Response Syntax

{}

Response Structure

  • (dict) --

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.PasswordResetRequiredException
  • CognitoIdentityProvider.Client.exceptions.UserNotFoundException
  • CognitoIdentityProvider.Client.exceptions.UserNotConfirmedException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
  • CognitoIdentityProvider.Client.exceptions.ForbiddenException
set_user_pool_mfa_config(**kwargs)

Sets the user pool multi-factor authentication (MFA) configuration.

Note

This action might generate an SMS text message. Starting June 1, 2021, US telecom carriers require you to register an origination phone number before you can send SMS messages to US phone numbers. If you use SMS text messages in Amazon Cognito, you must register a phone number with Amazon Pinpoint . Amazon Cognito uses the registered number automatically. Otherwise, Amazon Cognito users who must receive SMS messages might not be able to sign up, activate their accounts, or sign in.

If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Service, Amazon Simple Notification Service might place your account in the SMS sandbox. In * sandbox mode * , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see SMS message settings for Amazon Cognito user pools in the Amazon Cognito Developer Guide .

See also: AWS API Documentation

Request Syntax

response = client.set_user_pool_mfa_config(
    UserPoolId='string',
    SmsMfaConfiguration={
        'SmsAuthenticationMessage': 'string',
        'SmsConfiguration': {
            'SnsCallerArn': 'string',
            'ExternalId': 'string',
            'SnsRegion': 'string'
        }
    },
    SoftwareTokenMfaConfiguration={
        'Enabled': True|False
    },
    MfaConfiguration='OFF'|'ON'|'OPTIONAL'
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID.

  • SmsMfaConfiguration (dict) --

    The SMS text message MFA configuration.

    • SmsAuthenticationMessage (string) --

      The SMS authentication message that will be sent to users with the code they must sign in. The message must contain the ‘{####}’ placeholder, which is replaced with the code. If the message isn't included, and default message will be used.

    • SmsConfiguration (dict) --

      The SMS configuration with the settings that your Amazon Cognito user pool must use to send an SMS message from your Amazon Web Services account through Amazon Simple Notification Service. To request Amazon SNS in the Amazon Web Services Region that you want, the Amazon Cognito user pool uses an Identity and Access Management (IAM) role that you provide for your Amazon Web Services account.

      • SnsCallerArn (string) -- [REQUIRED]

        The Amazon Resource Name (ARN) of the Amazon SNS caller. This is the ARN of the IAM role in your Amazon Web Services account that Amazon Cognito will use to send SMS messages. SMS messages are subject to a spending limit .

      • ExternalId (string) --

        The external ID provides additional security for your IAM role. You can use an ExternalId with the IAM role that you use with Amazon SNS to send SMS messages for your user pool. If you provide an ExternalId , your Amazon Cognito user pool includes it in the request to assume your IAM role. You can configure the role trust policy to require that Amazon Cognito, and any principal, provide the ExternalID . If you use the Amazon Cognito Management Console to create a role for SMS multi-factor authentication (MFA), Amazon Cognito creates a role with the required permissions and a trust policy that demonstrates use of the ExternalId .

        For more information about the ExternalId of a role, see How to use an external ID when granting access to your Amazon Web Services resources to a third party

      • SnsRegion (string) --

        The Amazon Web Services Region to use with Amazon SNS integration. You can choose the same Region as your user pool, or a supported Legacy Amazon SNS alternate Region .

        Amazon Cognito resources in the Asia Pacific (Seoul) Amazon Web Services Region must use your Amazon SNS configuration in the Asia Pacific (Tokyo) Region. For more information, see SMS message settings for Amazon Cognito user pools .

  • SoftwareTokenMfaConfiguration (dict) --

    The software token MFA configuration.

    • Enabled (boolean) --

      Specifies whether software token MFA is activated.

  • MfaConfiguration (string) --

    The MFA configuration. If you set the MfaConfiguration value to ‘ON’, only users who have set up an MFA factor can sign in. To learn more, see Adding Multi-Factor Authentication (MFA) to a user pool . Valid values include:

    • OFF MFA won't be used for any users.
    • ON MFA is required for all users to sign in.
    • OPTIONAL MFA will be required only for individual users who have an MFA factor activated.
Return type

dict

Returns

Response Syntax

{
    'SmsMfaConfiguration': {
        'SmsAuthenticationMessage': 'string',
        'SmsConfiguration': {
            'SnsCallerArn': 'string',
            'ExternalId': 'string',
            'SnsRegion': 'string'
        }
    },
    'SoftwareTokenMfaConfiguration': {
        'Enabled': True|False
    },
    'MfaConfiguration': 'OFF'|'ON'|'OPTIONAL'
}

Response Structure

  • (dict) --

    • SmsMfaConfiguration (dict) --

      The SMS text message MFA configuration.

      • SmsAuthenticationMessage (string) --

        The SMS authentication message that will be sent to users with the code they must sign in. The message must contain the ‘{####}’ placeholder, which is replaced with the code. If the message isn't included, and default message will be used.

      • SmsConfiguration (dict) --

        The SMS configuration with the settings that your Amazon Cognito user pool must use to send an SMS message from your Amazon Web Services account through Amazon Simple Notification Service. To request Amazon SNS in the Amazon Web Services Region that you want, the Amazon Cognito user pool uses an Identity and Access Management (IAM) role that you provide for your Amazon Web Services account.

        • SnsCallerArn (string) --

          The Amazon Resource Name (ARN) of the Amazon SNS caller. This is the ARN of the IAM role in your Amazon Web Services account that Amazon Cognito will use to send SMS messages. SMS messages are subject to a spending limit .

        • ExternalId (string) --

          The external ID provides additional security for your IAM role. You can use an ExternalId with the IAM role that you use with Amazon SNS to send SMS messages for your user pool. If you provide an ExternalId , your Amazon Cognito user pool includes it in the request to assume your IAM role. You can configure the role trust policy to require that Amazon Cognito, and any principal, provide the ExternalID . If you use the Amazon Cognito Management Console to create a role for SMS multi-factor authentication (MFA), Amazon Cognito creates a role with the required permissions and a trust policy that demonstrates use of the ExternalId .

          For more information about the ExternalId of a role, see How to use an external ID when granting access to your Amazon Web Services resources to a third party

        • SnsRegion (string) --

          The Amazon Web Services Region to use with Amazon SNS integration. You can choose the same Region as your user pool, or a supported Legacy Amazon SNS alternate Region .

          Amazon Cognito resources in the Asia Pacific (Seoul) Amazon Web Services Region must use your Amazon SNS configuration in the Asia Pacific (Tokyo) Region. For more information, see SMS message settings for Amazon Cognito user pools .

    • SoftwareTokenMfaConfiguration (dict) --

      The software token MFA configuration.

      • Enabled (boolean) --

        Specifies whether software token MFA is activated.

    • MfaConfiguration (string) --

      The MFA configuration. Valid values include:

      • OFF MFA won't be used for any users.
      • ON MFA is required for all users to sign in.
      • OPTIONAL MFA will be required only for individual users who have an MFA factor enabled.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidSmsRoleAccessPolicyException
  • CognitoIdentityProvider.Client.exceptions.InvalidSmsRoleTrustRelationshipException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
set_user_settings(**kwargs)
This action is no longer supported. You can use it to configure only SMS MFA. You can't use it to configure time-based one-time password (TOTP) software token MFA. To configure either type of MFA, use SetUserMFAPreference instead.

See also: AWS API Documentation

Request Syntax

response = client.set_user_settings(
    AccessToken='string',
    MFAOptions=[
        {
            'DeliveryMedium': 'SMS'|'EMAIL',
            'AttributeName': 'string'
        },
    ]
)
Parameters
  • AccessToken (string) --

    [REQUIRED]

    A valid access token that Amazon Cognito issued to the user whose user settings you want to configure.

  • MFAOptions (list) --

    [REQUIRED]

    You can use this parameter only to set an SMS configuration that uses SMS for delivery.

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

Return type

dict

Returns

Response Syntax

{}

Response Structure

  • (dict) --

    The response from the server for a set user settings request.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.PasswordResetRequiredException
  • CognitoIdentityProvider.Client.exceptions.UserNotFoundException
  • CognitoIdentityProvider.Client.exceptions.UserNotConfirmedException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
  • CognitoIdentityProvider.Client.exceptions.ForbiddenException
sign_up(**kwargs)

Registers the user in the specified user pool and creates a user name, password, and user attributes.

Note

This action might generate an SMS text message. Starting June 1, 2021, US telecom carriers require you to register an origination phone number before you can send SMS messages to US phone numbers. If you use SMS text messages in Amazon Cognito, you must register a phone number with Amazon Pinpoint . Amazon Cognito uses the registered number automatically. Otherwise, Amazon Cognito users who must receive SMS messages might not be able to sign up, activate their accounts, or sign in.

If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Service, Amazon Simple Notification Service might place your account in the SMS sandbox. In * sandbox mode * , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see SMS message settings for Amazon Cognito user pools in the Amazon Cognito Developer Guide .

See also: AWS API Documentation

Request Syntax

response = client.sign_up(
    ClientId='string',
    SecretHash='string',
    Username='string',
    Password='string',
    UserAttributes=[
        {
            'Name': 'string',
            'Value': 'string'
        },
    ],
    ValidationData=[
        {
            'Name': 'string',
            'Value': 'string'
        },
    ],
    AnalyticsMetadata={
        'AnalyticsEndpointId': 'string'
    },
    UserContextData={
        'IpAddress': 'string',
        'EncodedData': 'string'
    },
    ClientMetadata={
        'string': 'string'
    }
)
Parameters
  • ClientId (string) --

    [REQUIRED]

    The ID of the client associated with the user pool.

  • SecretHash (string) -- A keyed-hash message authentication code (HMAC) calculated using the secret key of a user pool client and username plus the client ID in the message.
  • Username (string) --

    [REQUIRED]

    The user name of the user you want to register.

  • Password (string) --

    [REQUIRED]

    The password of the user you want to register.

  • 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) -- [REQUIRED]

        The name of the attribute.

      • Value (string) --

        The value of the attribute.

  • ValidationData (list) --

    The validation data in the request to register a user.

    • (dict) --

      Specifies whether the attribute is standard or custom.

      • Name (string) -- [REQUIRED]

        The name of the attribute.

      • Value (string) --

        The value of the attribute.

  • AnalyticsMetadata (dict) --

    The Amazon Pinpoint analytics metadata that contributes to your metrics for SignUp calls.

    • AnalyticsEndpointId (string) --

      The endpoint ID.

  • UserContextData (dict) --

    Contextual data about your user session, such as the device fingerprint, IP address, or location. Amazon Cognito advanced security evaluates the risk of an authentication event based on the context that your app generates and passes to Amazon Cognito when it makes API requests.

    • IpAddress (string) --

      The source IP address of your user's device.

    • EncodedData (string) --

      Encoded device-fingerprint details that your app collected with the Amazon Cognito context data collection library. For more information, see Adding user device and session data to API requests .

  • ClientMetadata (dict) --

    A map of custom key-value pairs that you can provide as input for any custom workflows that this action triggers.

    You create custom workflows by assigning Lambda functions to user pool triggers. When you use the SignUp API action, Amazon Cognito invokes any functions that are assigned to the following triggers: pre sign-up , custom message , and post confirmation . When Amazon Cognito invokes any of these functions, it passes a JSON payload, which the function receives as input. This payload contains a clientMetadata attribute, which provides the data that you assigned to the ClientMetadata parameter in your SignUp request. In your function code in Lambda, you can process the clientMetadata value to enhance your workflow for your specific needs.

    For more information, see Customizing user pool Workflows with Lambda Triggers in the Amazon Cognito Developer Guide .

    Note

    When you use the ClientMetadata parameter, remember that Amazon Cognito won't do the following:

    • Store the ClientMetadata value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration doesn't include triggers, the ClientMetadata parameter serves no purpose.
    • Validate the ClientMetadata value.
    • Encrypt the ClientMetadata value. Don't use Amazon Cognito to provide sensitive information.
    • (string) --
      • (string) --
Return type

dict

Returns

Response Syntax

{
    'UserConfirmed': True|False,
    'CodeDeliveryDetails': {
        'Destination': 'string',
        'DeliveryMedium': 'SMS'|'EMAIL',
        'AttributeName': 'string'
    },
    'UserSub': 'string'
}

Response Structure

  • (dict) --

    The response from the server for a registration request.

    • UserConfirmed (boolean) --

      A response from the server indicating that a user registration has been confirmed.

    • CodeDeliveryDetails (dict) --

      The code delivery details returned by the server response to the user registration request.

      • Destination (string) --

        The email address or phone number destination where Amazon Cognito sent the code.

      • DeliveryMedium (string) --

        The method that Amazon Cognito used to send the code.

      • AttributeName (string) --

        The name of the attribute that Amazon Cognito verifies with the code.

    • UserSub (string) --

      The UUID of the authenticated user. This isn't the same as username .

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.UnexpectedLambdaException
  • CognitoIdentityProvider.Client.exceptions.UserLambdaValidationException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.InvalidPasswordException
  • CognitoIdentityProvider.Client.exceptions.InvalidLambdaResponseException
  • CognitoIdentityProvider.Client.exceptions.UsernameExistsException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
  • CognitoIdentityProvider.Client.exceptions.InvalidSmsRoleAccessPolicyException
  • CognitoIdentityProvider.Client.exceptions.InvalidSmsRoleTrustRelationshipException
  • CognitoIdentityProvider.Client.exceptions.InvalidEmailRoleAccessPolicyException
  • CognitoIdentityProvider.Client.exceptions.CodeDeliveryFailureException
  • CognitoIdentityProvider.Client.exceptions.ForbiddenException
start_user_import_job(**kwargs)

Starts the user import.

See also: AWS API Documentation

Request Syntax

response = client.start_user_import_job(
    UserPoolId='string',
    JobId='string'
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool that the users are being imported into.

  • JobId (string) --

    [REQUIRED]

    The job ID for the user import job.

Return type

dict

Returns

Response Syntax

{
    'UserImportJob': {
        'JobName': 'string',
        'JobId': 'string',
        'UserPoolId': 'string',
        'PreSignedUrl': 'string',
        'CreationDate': datetime(2015, 1, 1),
        'StartDate': datetime(2015, 1, 1),
        'CompletionDate': datetime(2015, 1, 1),
        'Status': 'Created'|'Pending'|'InProgress'|'Stopping'|'Expired'|'Stopped'|'Failed'|'Succeeded',
        'CloudWatchLogsRoleArn': 'string',
        'ImportedUsers': 123,
        'SkippedUsers': 123,
        'FailedUsers': 123,
        'CompletionMessage': 'string'
    }
}

Response Structure

  • (dict) --

    Represents the response from the server to the request to start the user import job.

    • UserImportJob (dict) --

      The job object that represents the user import job.

      • JobName (string) --

        The job name for the user import job.

      • JobId (string) --

        The job ID for the user import job.

      • UserPoolId (string) --

        The user pool ID for the user pool that the users are being imported into.

      • PreSignedUrl (string) --

        The pre-signed URL to be used to upload the .csv file.

      • CreationDate (datetime) --

        The date the user import job was created.

      • StartDate (datetime) --

        The date when the user import job was started.

      • CompletionDate (datetime) --

        The date when the user import job was completed.

      • Status (string) --

        The status of the user import job. One of the following:

        • Created - The job was created but not started.
        • Pending - A transition state. You have started the job, but it has not begun importing users yet.
        • InProgress - The job has started, and users are being imported.
        • Stopping - You have stopped the job, but the job has not stopped importing users yet.
        • Stopped - You have stopped the job, and the job has stopped importing users.
        • Succeeded - The job has completed successfully.
        • Failed - The job has stopped due to an error.
        • Expired - You created a job, but did not start the job within 24-48 hours. All data associated with the job was deleted, and the job can't be started.
      • CloudWatchLogsRoleArn (string) --

        The role Amazon Resource Name (ARN) for the Amazon CloudWatch Logging role for the user import job. For more information, see "Creating the CloudWatch Logs IAM Role" in the Amazon Cognito Developer Guide.

      • ImportedUsers (integer) --

        The number of users that were successfully imported.

      • SkippedUsers (integer) --

        The number of users that were skipped.

      • FailedUsers (integer) --

        The number of users that couldn't be imported.

      • CompletionMessage (string) --

        The message returned when the user import job is completed.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
  • CognitoIdentityProvider.Client.exceptions.PreconditionNotMetException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
stop_user_import_job(**kwargs)

Stops the user import job.

See also: AWS API Documentation

Request Syntax

response = client.stop_user_import_job(
    UserPoolId='string',
    JobId='string'
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool that the users are being imported into.

  • JobId (string) --

    [REQUIRED]

    The job ID for the user import job.

Return type

dict

Returns

Response Syntax

{
    'UserImportJob': {
        'JobName': 'string',
        'JobId': 'string',
        'UserPoolId': 'string',
        'PreSignedUrl': 'string',
        'CreationDate': datetime(2015, 1, 1),
        'StartDate': datetime(2015, 1, 1),
        'CompletionDate': datetime(2015, 1, 1),
        'Status': 'Created'|'Pending'|'InProgress'|'Stopping'|'Expired'|'Stopped'|'Failed'|'Succeeded',
        'CloudWatchLogsRoleArn': 'string',
        'ImportedUsers': 123,
        'SkippedUsers': 123,
        'FailedUsers': 123,
        'CompletionMessage': 'string'
    }
}

Response Structure

  • (dict) --

    Represents the response from the server to the request to stop the user import job.

    • UserImportJob (dict) --

      The job object that represents the user import job.

      • JobName (string) --

        The job name for the user import job.

      • JobId (string) --

        The job ID for the user import job.

      • UserPoolId (string) --

        The user pool ID for the user pool that the users are being imported into.

      • PreSignedUrl (string) --

        The pre-signed URL to be used to upload the .csv file.

      • CreationDate (datetime) --

        The date the user import job was created.

      • StartDate (datetime) --

        The date when the user import job was started.

      • CompletionDate (datetime) --

        The date when the user import job was completed.

      • Status (string) --

        The status of the user import job. One of the following:

        • Created - The job was created but not started.
        • Pending - A transition state. You have started the job, but it has not begun importing users yet.
        • InProgress - The job has started, and users are being imported.
        • Stopping - You have stopped the job, but the job has not stopped importing users yet.
        • Stopped - You have stopped the job, and the job has stopped importing users.
        • Succeeded - The job has completed successfully.
        • Failed - The job has stopped due to an error.
        • Expired - You created a job, but did not start the job within 24-48 hours. All data associated with the job was deleted, and the job can't be started.
      • CloudWatchLogsRoleArn (string) --

        The role Amazon Resource Name (ARN) for the Amazon CloudWatch Logging role for the user import job. For more information, see "Creating the CloudWatch Logs IAM Role" in the Amazon Cognito Developer Guide.

      • ImportedUsers (integer) --

        The number of users that were successfully imported.

      • SkippedUsers (integer) --

        The number of users that were skipped.

      • FailedUsers (integer) --

        The number of users that couldn't be imported.

      • CompletionMessage (string) --

        The message returned when the user import job is completed.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
  • CognitoIdentityProvider.Client.exceptions.PreconditionNotMetException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
tag_resource(**kwargs)

Assigns a set of tags to an Amazon Cognito user pool. A tag is a label that you can use to categorize and manage user pools in different ways, such as by purpose, owner, environment, or other criteria.

Each tag consists of a key and value, both of which you define. A key is a general category for more specific values. For example, if you have two versions of a user pool, one for testing and another for production, you might assign an Environment tag key to both user pools. The value of this key might be Test for one user pool, and Production for the other.

Tags are useful for cost tracking and access control. You can activate your tags so that they appear on the Billing and Cost Management console, where you can track the costs associated with your user pools. In an Identity and Access Management policy, you can constrain permissions for user pools based on specific tags or tag values.

You can use this action up to 5 times per second, per account. A user pool can have as many as 50 tags.

See also: AWS API Documentation

Request Syntax

response = client.tag_resource(
    ResourceArn='string',
    Tags={
        'string': 'string'
    }
)
Parameters
  • ResourceArn (string) --

    [REQUIRED]

    The Amazon Resource Name (ARN) of the user pool to assign the tags to.

  • Tags (dict) --

    [REQUIRED]

    The tags to assign to the user pool.

    • (string) --
      • (string) --
Return type

dict

Returns

Response Syntax

{}

Response Structure

  • (dict) --

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
untag_resource(**kwargs)

Removes the specified tags from an Amazon Cognito user pool. You can use this action up to 5 times per second, per account.

See also: AWS API Documentation

Request Syntax

response = client.untag_resource(
    ResourceArn='string',
    TagKeys=[
        'string',
    ]
)
Parameters
  • ResourceArn (string) --

    [REQUIRED]

    The Amazon Resource Name (ARN) of the user pool that the tags are assigned to.

  • TagKeys (list) --

    [REQUIRED]

    The keys of the tags to remove from the user pool.

    • (string) --
Return type

dict

Returns

Response Syntax

{}

Response Structure

  • (dict) --

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
update_auth_event_feedback(**kwargs)

Provides the feedback for an authentication event, whether it was from a valid user or not. This feedback is used for improving the risk evaluation decision for the user pool as part of Amazon Cognito advanced security.

See also: AWS API Documentation

Request Syntax

response = client.update_auth_event_feedback(
    UserPoolId='string',
    Username='string',
    EventId='string',
    FeedbackToken='string',
    FeedbackValue='Valid'|'Invalid'
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID.

  • Username (string) --

    [REQUIRED]

    The user pool username.

  • EventId (string) --

    [REQUIRED]

    The event ID.

  • FeedbackToken (string) --

    [REQUIRED]

    The feedback token.

  • FeedbackValue (string) --

    [REQUIRED]

    The authentication event feedback value.

Return type

dict

Returns

Response Syntax

{}

Response Structure

  • (dict) --

Exceptions

  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.UserNotFoundException
  • CognitoIdentityProvider.Client.exceptions.UserPoolAddOnNotEnabledException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
update_device_status(**kwargs)

Updates the device status.

See also: AWS API Documentation

Request Syntax

response = client.update_device_status(
    AccessToken='string',
    DeviceKey='string',
    DeviceRememberedStatus='remembered'|'not_remembered'
)
Parameters
  • AccessToken (string) --

    [REQUIRED]

    A valid access token that Amazon Cognito issued to the user whose device status you want to update.

  • DeviceKey (string) --

    [REQUIRED]

    The device key.

  • DeviceRememberedStatus (string) -- The status of whether a device is remembered.
Return type

dict

Returns

Response Syntax

{}

Response Structure

  • (dict) --

    The response to the request to update the device status.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.InvalidUserPoolConfigurationException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.PasswordResetRequiredException
  • CognitoIdentityProvider.Client.exceptions.UserNotFoundException
  • CognitoIdentityProvider.Client.exceptions.UserNotConfirmedException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
  • CognitoIdentityProvider.Client.exceptions.ForbiddenException
update_group(**kwargs)

Updates the specified group with the specified attributes.

Calling this action requires developer credentials.

See also: AWS API Documentation

Request Syntax

response = client.update_group(
    GroupName='string',
    UserPoolId='string',
    Description='string',
    RoleArn='string',
    Precedence=123
)
Parameters
  • GroupName (string) --

    [REQUIRED]

    The name of the group.

  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool.

  • Description (string) -- A string containing the new description of the group.
  • RoleArn (string) -- The new role Amazon Resource Name (ARN) for the group. This is used for setting the cognito:roles and cognito:preferred_role claims in the token.
  • Precedence (integer) -- The new precedence value for the group. For more information about this parameter, see CreateGroup .
Return type

dict

Returns

Response Syntax

{
    'Group': {
        'GroupName': 'string',
        'UserPoolId': 'string',
        'Description': 'string',
        'RoleArn': 'string',
        'Precedence': 123,
        'LastModifiedDate': datetime(2015, 1, 1),
        'CreationDate': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) --

    • Group (dict) --

      The group object for the group.

      • GroupName (string) --

        The name of the group.

      • UserPoolId (string) --

        The user pool ID for the user pool.

      • Description (string) --

        A string containing the description of the group.

      • RoleArn (string) --

        The role Amazon Resource Name (ARN) for the group.

      • Precedence (integer) --

        A non-negative integer value that specifies the precedence of this group relative to the other groups that a user can belong to in the user pool. Zero is the highest precedence value. Groups with lower Precedence values take precedence over groups with higher ornull Precedence values. If a user belongs to two or more groups, it is the group with the lowest precedence value whose role ARN is given in the user's tokens for the cognito:roles and cognito:preferred_role claims.

        Two groups can have the same Precedence value. If this happens, neither group takes precedence over the other. If two groups with the same Precedence have the same role ARN, that role is used in the cognito:preferred_role claim in tokens for users in each group. If the two groups have different role ARNs, the cognito:preferred_role claim isn't set in users' tokens.

        The default Precedence value is null.

      • LastModifiedDate (datetime) --

        The date the group was last modified.

      • CreationDate (datetime) --

        The date the group was created.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
update_identity_provider(**kwargs)

Updates IdP information for a user pool.

See also: AWS API Documentation

Request Syntax

response = client.update_identity_provider(
    UserPoolId='string',
    ProviderName='string',
    ProviderDetails={
        'string': 'string'
    },
    AttributeMapping={
        'string': 'string'
    },
    IdpIdentifiers=[
        'string',
    ]
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID.

  • ProviderName (string) --

    [REQUIRED]

    The IdP name.

  • ProviderDetails (dict) --

    The IdP details to be updated, such as MetadataURL and MetadataFile .

    • (string) --
      • (string) --
  • AttributeMapping (dict) --

    The IdP attribute mapping to be changed.

    • (string) --
      • (string) --
  • IdpIdentifiers (list) --

    A list of IdP identifiers.

    • (string) --
Return type

dict

Returns

Response Syntax

{
    'IdentityProvider': {
        'UserPoolId': 'string',
        'ProviderName': 'string',
        'ProviderType': 'SAML'|'Facebook'|'Google'|'LoginWithAmazon'|'SignInWithApple'|'OIDC',
        'ProviderDetails': {
            'string': 'string'
        },
        'AttributeMapping': {
            'string': 'string'
        },
        'IdpIdentifiers': [
            'string',
        ],
        'LastModifiedDate': datetime(2015, 1, 1),
        'CreationDate': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) --

    • IdentityProvider (dict) --

      The IdP object.

      • UserPoolId (string) --

        The user pool ID.

      • ProviderName (string) --

        The IdP name.

      • ProviderType (string) --

        The IdP type.

      • ProviderDetails (dict) --

        The IdP details. The following list describes the provider detail keys for each IdP type.

        • For Google and Login with Amazon:
          • client_id
          • client_secret
          • authorize_scopes
        • For Facebook:
          • client_id
          • client_secret
          • authorize_scopes
          • api_version
        • For Sign in with Apple:
          • client_id
          • team_id
          • key_id
          • private_key You can submit a private_key when you add or update an IdP. Describe operations don't return the private key.
          • authorize_scopes
        • For OIDC providers:
          • client_id
          • client_secret
          • attributes_request_method
          • oidc_issuer
          • authorize_scopes
          • The following keys are only present if Amazon Cognito didn't discover them at the oidc_issuer URL.
            • authorize_url
            • token_url
            • attributes_url
            • jwks_uri
          • Amazon Cognito sets the value of the following keys automatically. They are read-only.
            • attributes_url_add_attributes
        • For SAML providers:
          • MetadataFile or MetadataURL
          • IDPSignout optional
        • (string) --
          • (string) --
      • AttributeMapping (dict) --

        A mapping of IdP attributes to standard and custom user pool attributes.

        • (string) --
          • (string) --
      • IdpIdentifiers (list) --

        A list of IdP identifiers.

        • (string) --
      • LastModifiedDate (datetime) --

        The date the IdP was last modified.

      • CreationDate (datetime) --

        The date the IdP was created.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.UnsupportedIdentityProviderException
  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
update_resource_server(**kwargs)

Updates the name and scopes of resource server. All other fields are read-only.

Warning

If you don't provide a value for an attribute, it is set to the default value.

See also: AWS API Documentation

Request Syntax

response = client.update_resource_server(
    UserPoolId='string',
    Identifier='string',
    Name='string',
    Scopes=[
        {
            'ScopeName': 'string',
            'ScopeDescription': 'string'
        },
    ]
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool.

  • Identifier (string) --

    [REQUIRED]

    The identifier for the resource server.

  • Name (string) --

    [REQUIRED]

    The name of the resource server.

  • Scopes (list) --

    The scope values to be set for the resource server.

    • (dict) --

      A resource server scope.

      • ScopeName (string) -- [REQUIRED]

        The name of the scope.

      • ScopeDescription (string) -- [REQUIRED]

        A description of the scope.

Return type

dict

Returns

Response Syntax

{
    'ResourceServer': {
        'UserPoolId': 'string',
        'Identifier': 'string',
        'Name': 'string',
        'Scopes': [
            {
                'ScopeName': 'string',
                'ScopeDescription': 'string'
            },
        ]
    }
}

Response Structure

  • (dict) --

    • ResourceServer (dict) --

      The resource server.

      • UserPoolId (string) --

        The user pool ID for the user pool that hosts the resource server.

      • Identifier (string) --

        The identifier for the resource server.

      • Name (string) --

        The name of the resource server.

      • Scopes (list) --

        A list of scopes that are defined for the resource server.

        • (dict) --

          A resource server scope.

          • ScopeName (string) --

            The name of the scope.

          • ScopeDescription (string) --

            A description of the scope.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
update_user_attributes(**kwargs)

Allows a user to update a specific attribute (one at a time).

Note

This action might generate an SMS text message. Starting June 1, 2021, US telecom carriers require you to register an origination phone number before you can send SMS messages to US phone numbers. If you use SMS text messages in Amazon Cognito, you must register a phone number with Amazon Pinpoint . Amazon Cognito uses the registered number automatically. Otherwise, Amazon Cognito users who must receive SMS messages might not be able to sign up, activate their accounts, or sign in.

If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Service, Amazon Simple Notification Service might place your account in the SMS sandbox. In * sandbox mode * , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see SMS message settings for Amazon Cognito user pools in the Amazon Cognito Developer Guide .

See also: AWS API Documentation

Request Syntax

response = client.update_user_attributes(
    UserAttributes=[
        {
            'Name': 'string',
            'Value': 'string'
        },
    ],
    AccessToken='string',
    ClientMetadata={
        'string': 'string'
    }
)
Parameters
  • UserAttributes (list) --

    [REQUIRED]

    An array of name-value pairs representing user attributes.

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

    If you have set an attribute to require verification before Amazon Cognito updates its value, this request doesn’t immediately update the value of that attribute. After your user receives and responds to a verification message to verify the new value, Amazon Cognito updates the attribute value. Your user can sign in and receive messages with the original attribute value until they verify the new value.

    • (dict) --

      Specifies whether the attribute is standard or custom.

      • Name (string) -- [REQUIRED]

        The name of the attribute.

      • Value (string) --

        The value of the attribute.

  • AccessToken (string) --

    [REQUIRED]

    A valid access token that Amazon Cognito issued to the user whose user attributes you want to update.

  • ClientMetadata (dict) --

    A map of custom key-value pairs that you can provide as input for any custom workflows that this action initiates.

    You create custom workflows by assigning Lambda functions to user pool triggers. When you use the UpdateUserAttributes API action, Amazon Cognito invokes the function that is assigned to the custom message trigger. When Amazon Cognito invokes this function, it passes a JSON payload, which the function receives as input. This payload contains a clientMetadata attribute, which provides the data that you assigned to the ClientMetadata parameter in your UpdateUserAttributes request. In your function code in Lambda, you can process the clientMetadata value to enhance your workflow for your specific needs.

    For more information, see Customizing user pool Workflows with Lambda Triggers in the Amazon Cognito Developer Guide .

    Note

    When you use the ClientMetadata parameter, remember that Amazon Cognito won't do the following:

    • Store the ClientMetadata value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration doesn't include triggers, the ClientMetadata parameter serves no purpose.
    • Validate the ClientMetadata value.
    • Encrypt the ClientMetadata value. Don't use Amazon Cognito to provide sensitive information.
    • (string) --
      • (string) --
Return type

dict

Returns

Response Syntax

{
    'CodeDeliveryDetailsList': [
        {
            'Destination': 'string',
            'DeliveryMedium': 'SMS'|'EMAIL',
            'AttributeName': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    Represents the response from the server for the request to update user attributes.

    • CodeDeliveryDetailsList (list) --

      The code delivery details list from the server for the request to update user attributes.

      • (dict) --

        The delivery details for an email or SMS message that Amazon Cognito sent for authentication or verification.

        • Destination (string) --

          The email address or phone number destination where Amazon Cognito sent the code.

        • DeliveryMedium (string) --

          The method that Amazon Cognito used to send the code.

        • AttributeName (string) --

          The name of the attribute that Amazon Cognito verifies with the code.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.CodeMismatchException
  • CognitoIdentityProvider.Client.exceptions.ExpiredCodeException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.UnexpectedLambdaException
  • CognitoIdentityProvider.Client.exceptions.UserLambdaValidationException
  • CognitoIdentityProvider.Client.exceptions.InvalidLambdaResponseException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.AliasExistsException
  • CognitoIdentityProvider.Client.exceptions.InvalidSmsRoleAccessPolicyException
  • CognitoIdentityProvider.Client.exceptions.InvalidSmsRoleTrustRelationshipException
  • CognitoIdentityProvider.Client.exceptions.InvalidEmailRoleAccessPolicyException
  • CognitoIdentityProvider.Client.exceptions.CodeDeliveryFailureException
  • CognitoIdentityProvider.Client.exceptions.PasswordResetRequiredException
  • CognitoIdentityProvider.Client.exceptions.UserNotFoundException
  • CognitoIdentityProvider.Client.exceptions.UserNotConfirmedException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
  • CognitoIdentityProvider.Client.exceptions.ForbiddenException
update_user_pool(**kwargs)

Updates the specified user pool with the specified attributes. You can get a list of the current user pool settings using DescribeUserPool . If you don't provide a value for an attribute, it will be set to the default value.

Note

This action might generate an SMS text message. Starting June 1, 2021, US telecom carriers require you to register an origination phone number before you can send SMS messages to US phone numbers. If you use SMS text messages in Amazon Cognito, you must register a phone number with Amazon Pinpoint . Amazon Cognito uses the registered number automatically. Otherwise, Amazon Cognito users who must receive SMS messages might not be able to sign up, activate their accounts, or sign in.

If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Service, Amazon Simple Notification Service might place your account in the SMS sandbox. In * sandbox mode * , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see SMS message settings for Amazon Cognito user pools in the Amazon Cognito Developer Guide .

See also: AWS API Documentation

Request Syntax

response = client.update_user_pool(
    UserPoolId='string',
    Policies={
        'PasswordPolicy': {
            'MinimumLength': 123,
            'RequireUppercase': True|False,
            'RequireLowercase': True|False,
            'RequireNumbers': True|False,
            'RequireSymbols': True|False,
            'TemporaryPasswordValidityDays': 123
        }
    },
    LambdaConfig={
        'PreSignUp': 'string',
        'CustomMessage': 'string',
        'PostConfirmation': 'string',
        'PreAuthentication': 'string',
        'PostAuthentication': 'string',
        'DefineAuthChallenge': 'string',
        'CreateAuthChallenge': 'string',
        'VerifyAuthChallengeResponse': 'string',
        'PreTokenGeneration': 'string',
        'UserMigration': 'string',
        'CustomSMSSender': {
            'LambdaVersion': 'V1_0',
            'LambdaArn': 'string'
        },
        'CustomEmailSender': {
            'LambdaVersion': 'V1_0',
            'LambdaArn': 'string'
        },
        'KMSKeyID': 'string'
    },
    AutoVerifiedAttributes=[
        'phone_number'|'email',
    ],
    SmsVerificationMessage='string',
    EmailVerificationMessage='string',
    EmailVerificationSubject='string',
    VerificationMessageTemplate={
        'SmsMessage': 'string',
        'EmailMessage': 'string',
        'EmailSubject': 'string',
        'EmailMessageByLink': 'string',
        'EmailSubjectByLink': 'string',
        'DefaultEmailOption': 'CONFIRM_WITH_LINK'|'CONFIRM_WITH_CODE'
    },
    SmsAuthenticationMessage='string',
    UserAttributeUpdateSettings={
        'AttributesRequireVerificationBeforeUpdate': [
            'phone_number'|'email',
        ]
    },
    MfaConfiguration='OFF'|'ON'|'OPTIONAL',
    DeviceConfiguration={
        'ChallengeRequiredOnNewDevice': True|False,
        'DeviceOnlyRememberedOnUserPrompt': True|False
    },
    EmailConfiguration={
        'SourceArn': 'string',
        'ReplyToEmailAddress': 'string',
        'EmailSendingAccount': 'COGNITO_DEFAULT'|'DEVELOPER',
        'From': 'string',
        'ConfigurationSet': 'string'
    },
    SmsConfiguration={
        'SnsCallerArn': 'string',
        'ExternalId': 'string',
        'SnsRegion': 'string'
    },
    UserPoolTags={
        'string': 'string'
    },
    AdminCreateUserConfig={
        'AllowAdminCreateUserOnly': True|False,
        'UnusedAccountValidityDays': 123,
        'InviteMessageTemplate': {
            'SMSMessage': 'string',
            'EmailMessage': 'string',
            'EmailSubject': 'string'
        }
    },
    UserPoolAddOns={
        'AdvancedSecurityMode': 'OFF'|'AUDIT'|'ENFORCED'
    },
    AccountRecoverySetting={
        'RecoveryMechanisms': [
            {
                'Priority': 123,
                'Name': 'verified_email'|'verified_phone_number'|'admin_only'
            },
        ]
    }
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool you want to update.

  • Policies (dict) --

    A container with the policies you want to update in a user pool.

    • PasswordPolicy (dict) --

      The password policy.

      • MinimumLength (integer) --

        The minimum length of the password in the policy that you have set. This value can't be less than 6.

      • RequireUppercase (boolean) --

        In the password policy that you have set, refers to whether you have required users to use at least one uppercase letter in their password.

      • RequireLowercase (boolean) --

        In the password policy that you have set, refers to whether you have required users to use at least one lowercase letter in their password.

      • RequireNumbers (boolean) --

        In the password policy that you have set, refers to whether you have required users to use at least one number in their password.

      • RequireSymbols (boolean) --

        In the password policy that you have set, refers to whether you have required users to use at least one symbol in their password.

      • TemporaryPasswordValidityDays (integer) --

        The number of days a temporary password is valid in the password policy. If the user doesn't sign in during this time, an administrator must reset their password.

        Note

        When you set TemporaryPasswordValidityDays for a user pool, you can no longer set a value for the legacy UnusedAccountValidityDays parameter in that user pool.

  • LambdaConfig (dict) --

    The Lambda configuration information from the request to update the user pool.

    • PreSignUp (string) --

      A pre-registration Lambda trigger.

    • CustomMessage (string) --

      A custom Message Lambda trigger.

    • PostConfirmation (string) --

      A post-confirmation Lambda trigger.

    • PreAuthentication (string) --

      A pre-authentication Lambda trigger.

    • PostAuthentication (string) --

      A post-authentication Lambda trigger.

    • DefineAuthChallenge (string) --

      Defines the authentication challenge.

    • CreateAuthChallenge (string) --

      Creates an authentication challenge.

    • VerifyAuthChallengeResponse (string) --

      Verifies the authentication challenge response.

    • PreTokenGeneration (string) --

      A Lambda trigger that is invoked before token generation.

    • UserMigration (string) --

      The user migration Lambda config type.

    • CustomSMSSender (dict) --

      A custom SMS sender Lambda trigger.

      • LambdaVersion (string) -- [REQUIRED]

        Signature of the "request" attribute in the "event" information that Amazon Cognito passes to your custom SMS Lambda function. The only supported value is V1_0 .

      • LambdaArn (string) -- [REQUIRED]

        The Amazon Resource Name (ARN) of the Lambda function that Amazon Cognito activates to send SMS notifications to users.

    • CustomEmailSender (dict) --

      A custom email sender Lambda trigger.

      • LambdaVersion (string) -- [REQUIRED]

        Signature of the "request" attribute in the "event" information Amazon Cognito passes to your custom email Lambda function. The only supported value is V1_0 .

      • LambdaArn (string) -- [REQUIRED]

        The Amazon Resource Name (ARN) of the Lambda function that Amazon Cognito activates to send email notifications to users.

    • KMSKeyID (string) --

      The Amazon Resource Name (ARN) of an KMS key . Amazon Cognito uses the key to encrypt codes and temporary passwords sent to CustomEmailSender and CustomSMSSender .

  • AutoVerifiedAttributes (list) --

    The attributes that are automatically verified when Amazon Cognito requests to update user pools.

    • (string) --
  • SmsVerificationMessage (string) -- This parameter is no longer used. See VerificationMessageTemplateType .
  • EmailVerificationMessage (string) -- This parameter is no longer used. See VerificationMessageTemplateType .
  • EmailVerificationSubject (string) -- This parameter is no longer used. See VerificationMessageTemplateType .
  • VerificationMessageTemplate (dict) --

    The template for verification messages.

    • SmsMessage (string) --

      The template for SMS messages that Amazon Cognito sends to your users.

    • EmailMessage (string) --

      The template for email messages that Amazon Cognito sends to your users. You can set an EmailMessage template only if the value of EmailSendingAccount is DEVELOPER . When your EmailSendingAccount is DEVELOPER , your user pool sends email messages with your own Amazon SES configuration.

    • EmailSubject (string) --

      The subject line for the email message template. You can set an EmailSubject template only if the value of EmailSendingAccount is DEVELOPER . When your EmailSendingAccount is DEVELOPER , your user pool sends email messages with your own Amazon SES configuration.

    • EmailMessageByLink (string) --

      The email message template for sending a confirmation link to the user. You can set an EmailMessageByLink template only if the value of EmailSendingAccount is DEVELOPER . When your EmailSendingAccount is DEVELOPER , your user pool sends email messages with your own Amazon SES configuration.

    • EmailSubjectByLink (string) --

      The subject line for the email message template for sending a confirmation link to the user. You can set an EmailSubjectByLink template only if the value of EmailSendingAccount is DEVELOPER . When your EmailSendingAccount is DEVELOPER , your user pool sends email messages with your own Amazon SES configuration.

    • DefaultEmailOption (string) --

      The default email option.

  • SmsAuthenticationMessage (string) -- The contents of the SMS authentication message.
  • UserAttributeUpdateSettings (dict) --

    The settings for updates to user attributes. These settings include the property AttributesRequireVerificationBeforeUpdate , a user-pool setting that tells Amazon Cognito how to handle changes to the value of your users' email address and phone number attributes. For more information, see Verifying updates to email addresses and phone numbers .

    • AttributesRequireVerificationBeforeUpdate (list) --

      Requires that your user verifies their email address, phone number, or both before Amazon Cognito updates the value of that attribute. When you update a user attribute that has this option activated, Amazon Cognito sends a verification message to the new phone number or email address. Amazon Cognito doesn’t change the value of the attribute until your user responds to the verification message and confirms the new value.

      You can verify an updated email address or phone number with a VerifyUserAttribute API request. You can also call the UpdateUserAttributes or AdminUpdateUserAttributes API and set email_verified or phone_number_verified to true.

      When AttributesRequireVerificationBeforeUpdate is false, your user pool doesn't require that your users verify attribute changes before Amazon Cognito updates them. In a user pool where AttributesRequireVerificationBeforeUpdate is false, API operations that change attribute values can immediately update a user’s email or phone_number attribute.

      • (string) --
  • MfaConfiguration (string) --

    Possible values include:

    • OFF - MFA tokens aren't required and can't be specified during user registration.
    • ON - MFA tokens are required for all user registrations. You can only specify ON when you're initially creating a user pool. You can use the SetUserPoolMfaConfig API operation to turn MFA "ON" for existing user pools.
    • OPTIONAL - Users have the option when registering to create an MFA token.
  • DeviceConfiguration (dict) --

    The device-remembering configuration for a user pool. A null value indicates that you have deactivated device remembering in your user pool.

    Note

    When you provide a value for any DeviceConfiguration field, you activate the Amazon Cognito device-remembering feature.

    • ChallengeRequiredOnNewDevice (boolean) --

      When true, a remembered device can sign in with device authentication instead of SMS and time-based one-time password (TOTP) factors for multi-factor authentication (MFA).

      Note

      Whether or not ChallengeRequiredOnNewDevice is true, users who sign in with devices that have not been confirmed or remembered must still provide a second factor in a user pool that requires MFA.

    • DeviceOnlyRememberedOnUserPrompt (boolean) --

      When true, Amazon Cognito doesn't automatically remember a user's device when your app sends a ConfirmDevice API request. In your app, create a prompt for your user to choose whether they want to remember their device. Return the user's choice in an UpdateDeviceStatus API request.

      When DeviceOnlyRememberedOnUserPrompt is false , Amazon Cognito immediately remembers devices that you register in a ConfirmDevice API request.

  • EmailConfiguration (dict) --

    The email configuration of your user pool. The email configuration type sets your preferred sending method, Amazon Web Services Region, and sender for email invitation and verification messages from your user pool.

    • SourceArn (string) --

      The ARN of a verified email address in Amazon SES. Amazon Cognito uses this email address in one of the following ways, depending on the value that you specify for the EmailSendingAccount parameter:

      • If you specify COGNITO_DEFAULT , Amazon Cognito uses this address as the custom FROM address when it emails your users using its built-in email account.
      • If you specify DEVELOPER , Amazon Cognito emails your users with this address by calling Amazon SES on your behalf.

      The Region value of the SourceArn parameter must indicate a supported Amazon Web Services Region of your user pool. Typically, the Region in the SourceArn and the user pool Region are the same. For more information, see Amazon SES email configuration regions in the Amazon Cognito Developer Guide .

    • ReplyToEmailAddress (string) --

      The destination to which the receiver of the email should reply.

    • EmailSendingAccount (string) --

      Specifies whether Amazon Cognito uses its built-in functionality to send your users email messages, or uses your Amazon Simple Email Service email configuration. Specify one of the following values:

      COGNITO_DEFAULT

      When Amazon Cognito emails your users, it uses its built-in email functionality. When you use the default option, Amazon Cognito allows only a limited number of emails each day for your user pool. For typical production environments, the default email limit is less than the required delivery volume. To achieve a higher delivery volume, specify DEVELOPER to use your Amazon SES email configuration.

      To look up the email delivery limit for the default option, see Limits in in the Developer Guide .

      The default FROM address is no-reply@verificationemail.com . To customize the FROM address, provide the Amazon Resource Name (ARN) of an Amazon SES verified email address for the SourceArn parameter.

      DEVELOPER

      When Amazon Cognito emails your users, it uses your Amazon SES configuration. Amazon Cognito calls Amazon SES on your behalf to send email from your verified email address. When you use this option, the email delivery limits are the same limits that apply to your Amazon SES verified email address in your Amazon Web Services account.

      If you use this option, provide the ARN of an Amazon SES verified email address for the SourceArn parameter.

      Before Amazon Cognito can email your users, it requires additional permissions to call Amazon SES on your behalf. When you update your user pool with this option, Amazon Cognito creates a service-linked role , which is a type of role, in your Amazon Web Services account. This role contains the permissions that allow to access Amazon SES and send email messages with your address. For more information about the service-linked role that Amazon Cognito creates, see Using Service-Linked Roles for Amazon Cognito in the Amazon Cognito Developer Guide .

    • From (string) --

      Either the sender’s email address or the sender’s name with their email address. For example, testuser@example.com or Test User <testuser@example.com> . This address appears before the body of the email.

    • ConfigurationSet (string) --

      The set of configuration rules that can be applied to emails sent using Amazon Simple Email Service. A configuration set is applied to an email by including a reference to the configuration set in the headers of the email. Once applied, all of the rules in that configuration set are applied to the email. Configuration sets can be used to apply the following types of rules to emails:

      Event publishing

      Amazon Simple Email Service can track the number of send, delivery, open, click, bounce, and complaint events for each email sent. Use event publishing to send information about these events to other Amazon Web Services services such as and Amazon CloudWatch

      IP pool management

      When leasing dedicated IP addresses with Amazon Simple Email Service, you can create groups of IP addresses, called dedicated IP pools. You can then associate the dedicated IP pools with configuration sets.

  • SmsConfiguration (dict) --

    The SMS configuration with the settings that your Amazon Cognito user pool must use to send an SMS message from your Amazon Web Services account through Amazon Simple Notification Service. To send SMS messages with Amazon SNS in the Amazon Web Services Region that you want, the Amazon Cognito user pool uses an Identity and Access Management (IAM) role in your Amazon Web Services account.

    • SnsCallerArn (string) -- [REQUIRED]

      The Amazon Resource Name (ARN) of the Amazon SNS caller. This is the ARN of the IAM role in your Amazon Web Services account that Amazon Cognito will use to send SMS messages. SMS messages are subject to a spending limit .

    • ExternalId (string) --

      The external ID provides additional security for your IAM role. You can use an ExternalId with the IAM role that you use with Amazon SNS to send SMS messages for your user pool. If you provide an ExternalId , your Amazon Cognito user pool includes it in the request to assume your IAM role. You can configure the role trust policy to require that Amazon Cognito, and any principal, provide the ExternalID . If you use the Amazon Cognito Management Console to create a role for SMS multi-factor authentication (MFA), Amazon Cognito creates a role with the required permissions and a trust policy that demonstrates use of the ExternalId .

      For more information about the ExternalId of a role, see How to use an external ID when granting access to your Amazon Web Services resources to a third party

    • SnsRegion (string) --

      The Amazon Web Services Region to use with Amazon SNS integration. You can choose the same Region as your user pool, or a supported Legacy Amazon SNS alternate Region .

      Amazon Cognito resources in the Asia Pacific (Seoul) Amazon Web Services Region must use your Amazon SNS configuration in the Asia Pacific (Tokyo) Region. For more information, see SMS message settings for Amazon Cognito user pools .

  • UserPoolTags (dict) --

    The tag keys and values to assign to the user pool. A tag is a label that you can use to categorize and manage user pools in different ways, such as by purpose, owner, environment, or other criteria.

    • (string) --
      • (string) --
  • AdminCreateUserConfig (dict) --

    The configuration for AdminCreateUser requests.

    • AllowAdminCreateUserOnly (boolean) --

      Set to True if only the administrator is allowed to create user profiles. Set to False if users can sign themselves up via an app.

    • UnusedAccountValidityDays (integer) --

      The user account expiration limit, in days, after which a new account that hasn't signed in is no longer usable. To reset the account after that time limit, you must call AdminCreateUser again, specifying "RESEND" for the MessageAction parameter. The default value for this parameter is 7.

      Note

      If you set a value for TemporaryPasswordValidityDays in PasswordPolicy , that value will be used, and UnusedAccountValidityDays will be no longer be an available parameter for that user pool.

    • InviteMessageTemplate (dict) --

      The message template to be used for the welcome message to new users.

      See also Customizing User Invitation Messages .

      • SMSMessage (string) --

        The message template for SMS messages.

      • EmailMessage (string) --

        The message template for email messages. EmailMessage is allowed only if EmailSendingAccount is DEVELOPER.

      • EmailSubject (string) --

        The subject line for email messages. EmailSubject is allowed only if EmailSendingAccount is DEVELOPER.

  • UserPoolAddOns (dict) --

    Enables advanced security risk detection. Set the key AdvancedSecurityMode to the value "AUDIT".

    • AdvancedSecurityMode (string) -- [REQUIRED]

      The advanced security mode.

  • AccountRecoverySetting (dict) --

    The available verified method a user can use to recover their password when they call ForgotPassword . You can use this setting to define a preferred method when a user has more than one method available. With this setting, SMS doesn't qualify for a valid password recovery mechanism if the user also has SMS multi-factor authentication (MFA) activated. In the absence of this setting, Amazon Cognito uses the legacy behavior to determine the recovery method where SMS is preferred through email.

    • RecoveryMechanisms (list) --

      The list of RecoveryOptionTypes .

      • (dict) --

        A map containing a priority as a key, and recovery method name as a value.

        • Priority (integer) -- [REQUIRED]

          A positive integer specifying priority of a method with 1 being the highest priority.

        • Name (string) -- [REQUIRED]

          The recovery method for a user.

Return type

dict

Returns

Response Syntax

{}

Response Structure

  • (dict) --

    Represents the response from the server when you make a request to update the user pool.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.ConcurrentModificationException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.UserImportInProgressException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
  • CognitoIdentityProvider.Client.exceptions.InvalidSmsRoleAccessPolicyException
  • CognitoIdentityProvider.Client.exceptions.InvalidSmsRoleTrustRelationshipException
  • CognitoIdentityProvider.Client.exceptions.UserPoolTaggingException
  • CognitoIdentityProvider.Client.exceptions.InvalidEmailRoleAccessPolicyException
update_user_pool_client(**kwargs)

Updates the specified user pool app client with the specified attributes. You can get a list of the current user pool app client settings using DescribeUserPoolClient .

Warning

If you don't provide a value for an attribute, it will be set to the default value.

You can also use this operation to enable token revocation for user pool clients. For more information about revoking tokens, see RevokeToken .

See also: AWS API Documentation

Request Syntax

response = client.update_user_pool_client(
    UserPoolId='string',
    ClientId='string',
    ClientName='string',
    RefreshTokenValidity=123,
    AccessTokenValidity=123,
    IdTokenValidity=123,
    TokenValidityUnits={
        'AccessToken': 'seconds'|'minutes'|'hours'|'days',
        'IdToken': 'seconds'|'minutes'|'hours'|'days',
        'RefreshToken': 'seconds'|'minutes'|'hours'|'days'
    },
    ReadAttributes=[
        'string',
    ],
    WriteAttributes=[
        'string',
    ],
    ExplicitAuthFlows=[
        'ADMIN_NO_SRP_AUTH'|'CUSTOM_AUTH_FLOW_ONLY'|'USER_PASSWORD_AUTH'|'ALLOW_ADMIN_USER_PASSWORD_AUTH'|'ALLOW_CUSTOM_AUTH'|'ALLOW_USER_PASSWORD_AUTH'|'ALLOW_USER_SRP_AUTH'|'ALLOW_REFRESH_TOKEN_AUTH',
    ],
    SupportedIdentityProviders=[
        'string',
    ],
    CallbackURLs=[
        'string',
    ],
    LogoutURLs=[
        'string',
    ],
    DefaultRedirectURI='string',
    AllowedOAuthFlows=[
        'code'|'implicit'|'client_credentials',
    ],
    AllowedOAuthScopes=[
        'string',
    ],
    AllowedOAuthFlowsUserPoolClient=True|False,
    AnalyticsConfiguration={
        'ApplicationId': 'string',
        'ApplicationArn': 'string',
        'RoleArn': 'string',
        'ExternalId': 'string',
        'UserDataShared': True|False
    },
    PreventUserExistenceErrors='LEGACY'|'ENABLED',
    EnableTokenRevocation=True|False,
    EnablePropagateAdditionalUserContextData=True|False,
    AuthSessionValidity=123
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool where you want to update the user pool client.

  • ClientId (string) --

    [REQUIRED]

    The ID of the client associated with the user pool.

  • ClientName (string) -- The client name from the update user pool client request.
  • RefreshTokenValidity (integer) --

    The refresh token time limit. After this limit expires, your user can't use their refresh token. To specify the time unit for RefreshTokenValidity as seconds , minutes , hours , or days , set a TokenValidityUnits value in your API request.

    For example, when you set RefreshTokenValidity as 10 and TokenValidityUnits as days , your user can refresh their session and retrieve new access and ID tokens for 10 days.

    The default time unit for RefreshTokenValidity in an API request is days. You can't set RefreshTokenValidity to 0. If you do, Amazon Cognito overrides the value with the default value of 30 days. Valid range is displayed below in seconds.

  • AccessTokenValidity (integer) --

    The access token time limit. After this limit expires, your user can't use their access token. To specify the time unit for AccessTokenValidity as seconds , minutes , hours , or days , set a TokenValidityUnits value in your API request.

    For example, when you set AccessTokenValidity to 10 and TokenValidityUnits to hours , your user can authorize access with their access token for 10 hours.

    The default time unit for AccessTokenValidity in an API request is hours. Valid range is displayed below in seconds.

  • IdTokenValidity (integer) --

    The ID token time limit. After this limit expires, your user can't use their ID token. To specify the time unit for IdTokenValidity as seconds , minutes , hours , or days , set a TokenValidityUnits value in your API request.

    For example, when you set IdTokenValidity as 10 and TokenValidityUnits as hours , your user can authenticate their session with their ID token for 10 hours.

    The default time unit for AccessTokenValidity in an API request is hours. Valid range is displayed below in seconds.

  • TokenValidityUnits (dict) --

    The units in which the validity times are represented. The default unit for RefreshToken is days, and the default for ID and access tokens is hours.

    • AccessToken (string) --

      A time unit of seconds , minutes , hours , or days for the value that you set in the AccessTokenValidity parameter. The default AccessTokenValidity time unit is hours.

    • IdToken (string) --

      A time unit of seconds , minutes , hours , or days for the value that you set in the IdTokenValidity parameter. The default IdTokenValidity time unit is hours.

    • RefreshToken (string) --

      A time unit of seconds , minutes , hours , or days for the value that you set in the RefreshTokenValidity parameter. The default RefreshTokenValidity time unit is days.

  • ReadAttributes (list) --

    The read-only attributes of the user pool.

    • (string) --
  • WriteAttributes (list) --

    The writeable attributes of the user pool.

    • (string) --
  • ExplicitAuthFlows (list) --

    The authentication flows that are supported by the user pool clients. Flow names without the ALLOW_ prefix are no longer supported in favor of new names with the ALLOW_ prefix. Note that values with ALLOW_ prefix must be used only along with values with the ALLOW_ prefix.

    Valid values include:

    • ALLOW_ADMIN_USER_PASSWORD_AUTH : Enable admin based user password authentication flow ADMIN_USER_PASSWORD_AUTH . This setting replaces the ADMIN_NO_SRP_AUTH setting. With this authentication flow, Amazon Cognito receives the password in the request instead of using the Secure Remote Password (SRP) protocol to verify passwords.
    • ALLOW_CUSTOM_AUTH : Enable Lambda trigger based authentication.
    • ALLOW_USER_PASSWORD_AUTH : Enable user password-based authentication. In this flow, Amazon Cognito receives the password in the request instead of using the SRP protocol to verify passwords.
    • ALLOW_USER_SRP_AUTH : Enable SRP-based authentication.
    • ALLOW_REFRESH_TOKEN_AUTH : Enable authflow to refresh tokens.
    • (string) --
  • SupportedIdentityProviders (list) --

    A list of provider names for the IdPs that this client supports. The following are supported: COGNITO , Facebook , Google , SignInWithApple , LoginWithAmazon , and the names of your own SAML and OIDC providers.

    • (string) --
  • CallbackURLs (list) --

    A list of allowed redirect (callback) URLs for the IdPs.

    A redirect URI must:

    • Be an absolute URI.
    • Be registered with the authorization server.
    • Not include a fragment component.

    See OAuth 2.0 - Redirection Endpoint .

    Amazon Cognito requires HTTPS over HTTP except for http://localhost for testing purposes only.

    App callback URLs such as myapp://example are also supported.

    • (string) --
  • LogoutURLs (list) --

    A list of allowed logout URLs for the IdPs.

    • (string) --
  • DefaultRedirectURI (string) --

    The default redirect URI. Must be in the CallbackURLs list.

    A redirect URI must:

    • Be an absolute URI.
    • Be registered with the authorization server.
    • Not include a fragment component.

    See OAuth 2.0 - Redirection Endpoint .

    Amazon Cognito requires HTTPS over HTTP except for http://localhost for testing purposes only.

    App callback URLs such as myapp://example are also supported.

  • AllowedOAuthFlows (list) --

    The allowed OAuth flows.

    code

    Use a code grant flow, which provides an authorization code as the response. This code can be exchanged for access tokens with the /oauth2/token endpoint.

    implicit

    Issue the access token (and, optionally, ID token, based on scopes) directly to your user.

    client_credentials

    Issue the access token from the /oauth2/token endpoint directly to a non-person user using a combination of the client ID and client secret.

    • (string) --
  • AllowedOAuthScopes (list) --

    The allowed OAuth scopes. Possible values provided by OAuth are phone , email , openid , and profile . Possible values provided by Amazon Web Services are aws.cognito.signin.user.admin . Custom scopes created in Resource Servers are also supported.

    • (string) --
  • AllowedOAuthFlowsUserPoolClient (boolean) -- Set to true if the client is allowed to follow the OAuth protocol when interacting with Amazon Cognito user pools.
  • AnalyticsConfiguration (dict) --

    The Amazon Pinpoint analytics configuration necessary to collect metrics for this user pool.

    Note

    In Amazon Web Services Regions where Amazon Pinpoint isn't available, user pools only support sending events to Amazon Pinpoint projects in us-east-1. In Regions where Amazon Pinpoint is available, user pools support sending events to Amazon Pinpoint projects within that same Region.

    • ApplicationId (string) --

      The application ID for an Amazon Pinpoint application.

    • ApplicationArn (string) --

      The Amazon Resource Name (ARN) of an Amazon Pinpoint project. You can use the Amazon Pinpoint project to integrate with the chosen user pool Client. Amazon Cognito publishes events to the Amazon Pinpoint project that the app ARN declares.

    • RoleArn (string) --

      The ARN of an Identity and Access Management role that authorizes Amazon Cognito to publish events to Amazon Pinpoint analytics.

    • ExternalId (string) --

      The external ID.

    • UserDataShared (boolean) --

      If UserDataShared is true , Amazon Cognito includes user data in the events that it publishes to Amazon Pinpoint analytics.

  • PreventUserExistenceErrors (string) --

    Errors and responses that you want Amazon Cognito APIs to return during authentication, account confirmation, and password recovery when the user doesn't exist in the user pool. When set to ENABLED and the user doesn't exist, authentication returns an error indicating either the username or password was incorrect. Account confirmation and password recovery return a response indicating a code was sent to a simulated destination. When set to LEGACY , those APIs return a UserNotFoundException exception if the user doesn't exist in the user pool.

    Valid values include:

    • ENABLED - This prevents user existence-related errors.
    • LEGACY - This represents the early behavior of Amazon Cognito where user existence related errors aren't prevented.
  • EnableTokenRevocation (boolean) -- Activates or deactivates token revocation. For more information about revoking tokens, see RevokeToken .
  • EnablePropagateAdditionalUserContextData (boolean) -- Activates the propagation of additional user context data. For more information about propagation of user context data, see Adding advanced security to a user pool . If you don’t include this parameter, you can't send device fingerprint information, including source IP address, to Amazon Cognito advanced security. You can only activate EnablePropagateAdditionalUserContextData in an app client that has a client secret.
  • AuthSessionValidity (integer) -- Amazon Cognito creates a session token for each API request in an authentication flow. AuthSessionValidity is the duration, in minutes, of that session token. Your user pool native user must respond to each authentication challenge before the session expires.
Return type

dict

Returns

Response Syntax

{
    'UserPoolClient': {
        'UserPoolId': 'string',
        'ClientName': 'string',
        'ClientId': 'string',
        'ClientSecret': 'string',
        'LastModifiedDate': datetime(2015, 1, 1),
        'CreationDate': datetime(2015, 1, 1),
        'RefreshTokenValidity': 123,
        'AccessTokenValidity': 123,
        'IdTokenValidity': 123,
        'TokenValidityUnits': {
            'AccessToken': 'seconds'|'minutes'|'hours'|'days',
            'IdToken': 'seconds'|'minutes'|'hours'|'days',
            'RefreshToken': 'seconds'|'minutes'|'hours'|'days'
        },
        'ReadAttributes': [
            'string',
        ],
        'WriteAttributes': [
            'string',
        ],
        'ExplicitAuthFlows': [
            'ADMIN_NO_SRP_AUTH'|'CUSTOM_AUTH_FLOW_ONLY'|'USER_PASSWORD_AUTH'|'ALLOW_ADMIN_USER_PASSWORD_AUTH'|'ALLOW_CUSTOM_AUTH'|'ALLOW_USER_PASSWORD_AUTH'|'ALLOW_USER_SRP_AUTH'|'ALLOW_REFRESH_TOKEN_AUTH',
        ],
        'SupportedIdentityProviders': [
            'string',
        ],
        'CallbackURLs': [
            'string',
        ],
        'LogoutURLs': [
            'string',
        ],
        'DefaultRedirectURI': 'string',
        'AllowedOAuthFlows': [
            'code'|'implicit'|'client_credentials',
        ],
        'AllowedOAuthScopes': [
            'string',
        ],
        'AllowedOAuthFlowsUserPoolClient': True|False,
        'AnalyticsConfiguration': {
            'ApplicationId': 'string',
            'ApplicationArn': 'string',
            'RoleArn': 'string',
            'ExternalId': 'string',
            'UserDataShared': True|False
        },
        'PreventUserExistenceErrors': 'LEGACY'|'ENABLED',
        'EnableTokenRevocation': True|False,
        'EnablePropagateAdditionalUserContextData': True|False,
        'AuthSessionValidity': 123
    }
}

Response Structure

  • (dict) --

    Represents the response from the server to the request to update the user pool client.

    • UserPoolClient (dict) --

      The user pool client value from the response from the server when you request to update the user pool client.

      • UserPoolId (string) --

        The user pool ID for the user pool client.

      • ClientName (string) --

        The client name from the user pool request of the client type.

      • ClientId (string) --

        The ID of the client associated with the user pool.

      • ClientSecret (string) --

        The client secret from the user pool request of the client type.

      • LastModifiedDate (datetime) --

        The date the user pool client was last modified.

      • CreationDate (datetime) --

        The date the user pool client was created.

      • RefreshTokenValidity (integer) --

        The refresh token time limit. After this limit expires, your user can't use their refresh token. To specify the time unit for RefreshTokenValidity as seconds , minutes , hours , or days , set a TokenValidityUnits value in your API request.

        For example, when you set RefreshTokenValidity as 10 and TokenValidityUnits as days , your user can refresh their session and retrieve new access and ID tokens for 10 days.

        The default time unit for RefreshTokenValidity in an API request is days. You can't set RefreshTokenValidity to 0. If you do, Amazon Cognito overrides the value with the default value of 30 days. Valid range is displayed below in seconds.

      • AccessTokenValidity (integer) --

        The access token time limit. After this limit expires, your user can't use their access token. To specify the time unit for AccessTokenValidity as seconds , minutes , hours , or days , set a TokenValidityUnits value in your API request.

        For example, when you set AccessTokenValidity to 10 and TokenValidityUnits to hours , your user can authorize access with their access token for 10 hours.

        The default time unit for AccessTokenValidity in an API request is hours. Valid range is displayed below in seconds.

      • IdTokenValidity (integer) --

        The ID token time limit. After this limit expires, your user can't use their ID token. To specify the time unit for IdTokenValidity as seconds , minutes , hours , or days , set a TokenValidityUnits value in your API request.

        For example, when you set IdTokenValidity as 10 and TokenValidityUnits as hours , your user can authenticate their session with their ID token for 10 hours.

        The default time unit for AccessTokenValidity in an API request is hours. Valid range is displayed below in seconds.

      • TokenValidityUnits (dict) --

        The time units used to specify the token validity times of each token type: ID, access, and refresh.

        • AccessToken (string) --

          A time unit of seconds , minutes , hours , or days for the value that you set in the AccessTokenValidity parameter. The default AccessTokenValidity time unit is hours.

        • IdToken (string) --

          A time unit of seconds , minutes , hours , or days for the value that you set in the IdTokenValidity parameter. The default IdTokenValidity time unit is hours.

        • RefreshToken (string) --

          A time unit of seconds , minutes , hours , or days for the value that you set in the RefreshTokenValidity parameter. The default RefreshTokenValidity time unit is days.

      • ReadAttributes (list) --

        The Read-only attributes.

        • (string) --
      • WriteAttributes (list) --

        The writeable attributes.

        • (string) --
      • ExplicitAuthFlows (list) --

        The authentication flows that are supported by the user pool clients. Flow names without the ALLOW_ prefix are no longer supported in favor of new names with the ALLOW_ prefix. Note that values with ALLOW_ prefix must be used only along with values including the ALLOW_ prefix.

        Valid values include:

        • ALLOW_ADMIN_USER_PASSWORD_AUTH : Enable admin based user password authentication flow ADMIN_USER_PASSWORD_AUTH . This setting replaces the ADMIN_NO_SRP_AUTH setting. With this authentication flow, Amazon Cognito receives the password in the request instead of using the Secure Remote Password (SRP) protocol to verify passwords.
        • ALLOW_CUSTOM_AUTH : Enable Lambda trigger based authentication.
        • ALLOW_USER_PASSWORD_AUTH : Enable user password-based authentication. In this flow, Amazon Cognito receives the password in the request instead of using the SRP protocol to verify passwords.
        • ALLOW_USER_SRP_AUTH : Enable SRP-based authentication.
        • ALLOW_REFRESH_TOKEN_AUTH : Enable authflow to refresh tokens.
        • (string) --
      • SupportedIdentityProviders (list) --

        A list of provider names for the IdPs that this client supports. The following are supported: COGNITO , Facebook , Google , SignInWithApple , LoginWithAmazon , and the names of your own SAML and OIDC providers.

        • (string) --
      • CallbackURLs (list) --

        A list of allowed redirect (callback) URLs for the IdPs.

        A redirect URI must:

        • Be an absolute URI.
        • Be registered with the authorization server.
        • Not include a fragment component.

        See OAuth 2.0 - Redirection Endpoint .

        Amazon Cognito requires HTTPS over HTTP except for http://localhost for testing purposes only.

        App callback URLs such as myapp://example are also supported.

        • (string) --
      • LogoutURLs (list) --

        A list of allowed logout URLs for the IdPs.

        • (string) --
      • DefaultRedirectURI (string) --

        The default redirect URI. Must be in the CallbackURLs list.

        A redirect URI must:

        • Be an absolute URI.
        • Be registered with the authorization server.
        • Not include a fragment component.

        See OAuth 2.0 - Redirection Endpoint .

        Amazon Cognito requires HTTPS over HTTP except for http://localhost for testing purposes only.

        App callback URLs such as myapp://example are also supported.

      • AllowedOAuthFlows (list) --

        The allowed OAuth flows.

        code

        Use a code grant flow, which provides an authorization code as the response. This code can be exchanged for access tokens with the /oauth2/token endpoint.

        implicit

        Issue the access token (and, optionally, ID token, based on scopes) directly to your user.

        client_credentials

        Issue the access token from the /oauth2/token endpoint directly to a non-person user using a combination of the client ID and client secret.

        • (string) --
      • AllowedOAuthScopes (list) --

        The OAuth scopes that your app client supports. Possible values that OAuth provides are phone , email , openid , and profile . Possible values that Amazon Web Services provides are aws.cognito.signin.user.admin . Amazon Cognito also supports custom scopes that you create in Resource Servers.

        • (string) --
      • AllowedOAuthFlowsUserPoolClient (boolean) --

        Set to true if the client is allowed to follow the OAuth protocol when interacting with Amazon Cognito user pools.

      • AnalyticsConfiguration (dict) --

        The Amazon Pinpoint analytics configuration for the user pool client.

        Note

        Amazon Cognito user pools only support sending events to Amazon Pinpoint projects in the US East (N. Virginia) us-east-1 Region, regardless of the Region where the user pool resides.

        • ApplicationId (string) --

          The application ID for an Amazon Pinpoint application.

        • ApplicationArn (string) --

          The Amazon Resource Name (ARN) of an Amazon Pinpoint project. You can use the Amazon Pinpoint project to integrate with the chosen user pool Client. Amazon Cognito publishes events to the Amazon Pinpoint project that the app ARN declares.

        • RoleArn (string) --

          The ARN of an Identity and Access Management role that authorizes Amazon Cognito to publish events to Amazon Pinpoint analytics.

        • ExternalId (string) --

          The external ID.

        • UserDataShared (boolean) --

          If UserDataShared is true , Amazon Cognito includes user data in the events that it publishes to Amazon Pinpoint analytics.

      • PreventUserExistenceErrors (string) --

        Errors and responses that you want Amazon Cognito APIs to return during authentication, account confirmation, and password recovery when the user doesn't exist in the user pool. When set to ENABLED and the user doesn't exist, authentication returns an error indicating either the username or password was incorrect. Account confirmation and password recovery return a response indicating a code was sent to a simulated destination. When set to LEGACY , those APIs return a UserNotFoundException exception if the user doesn't exist in the user pool.

        Valid values include:

        • ENABLED - This prevents user existence-related errors.
        • LEGACY - This represents the old behavior of Amazon Cognito where user existence related errors aren't prevented.
      • EnableTokenRevocation (boolean) --

        Indicates whether token revocation is activated for the user pool client. When you create a new user pool client, token revocation is activated by default. For more information about revoking tokens, see RevokeToken .

      • EnablePropagateAdditionalUserContextData (boolean) --

        When EnablePropagateAdditionalUserContextData is true, Amazon Cognito accepts an IpAddress value that you send in the UserContextData parameter. The UserContextData parameter sends information to Amazon Cognito advanced security for risk analysis. You can send UserContextData when you sign in Amazon Cognito native users with the InitiateAuth and RespondToAuthChallenge API operations.

        When EnablePropagateAdditionalUserContextData is false, you can't send your user's source IP address to Amazon Cognito advanced security with unauthenticated API operations. EnablePropagateAdditionalUserContextData doesn't affect whether you can send a source IP address in a ContextData parameter with the authenticated API operations AdminInitiateAuth and AdminRespondToAuthChallenge .

        You can only activate EnablePropagateAdditionalUserContextData in an app client that has a client secret. For more information about propagation of user context data, see Adding user device and session data to API requests .

      • AuthSessionValidity (integer) --

        Amazon Cognito creates a session token for each API request in an authentication flow. AuthSessionValidity is the duration, in minutes, of that session token. Your user pool native user must respond to each authentication challenge before the session expires.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.ConcurrentModificationException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.ScopeDoesNotExistException
  • CognitoIdentityProvider.Client.exceptions.InvalidOAuthFlowException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
update_user_pool_domain(**kwargs)

Updates the Secure Sockets Layer (SSL) certificate for the custom domain for your user pool.

You can use this operation to provide the Amazon Resource Name (ARN) of a new certificate to Amazon Cognito. You can't use it to change the domain for a user pool.

A custom domain is used to host the Amazon Cognito hosted UI, which provides sign-up and sign-in pages for your application. When you set up a custom domain, you provide a certificate that you manage with Certificate Manager (ACM). When necessary, you can use this operation to change the certificate that you applied to your custom domain.

Usually, this is unnecessary following routine certificate renewal with ACM. When you renew your existing certificate in ACM, the ARN for your certificate remains the same, and your custom domain uses the new certificate automatically.

However, if you replace your existing certificate with a new one, ACM gives the new certificate a new ARN. To apply the new certificate to your custom domain, you must provide this ARN to Amazon Cognito.

When you add your new certificate in ACM, you must choose US East (N. Virginia) as the Amazon Web Services Region.

After you submit your request, Amazon Cognito requires up to 1 hour to distribute your new certificate to your custom domain.

For more information about adding a custom domain to your user pool, see Using Your Own Domain for the Hosted UI .

See also: AWS API Documentation

Request Syntax

response = client.update_user_pool_domain(
    Domain='string',
    UserPoolId='string',
    CustomDomainConfig={
        'CertificateArn': 'string'
    }
)
Parameters
  • Domain (string) --

    [REQUIRED]

    The domain name for the custom domain that hosts the sign-up and sign-in pages for your application. One example might be auth.example.com .

    This string can include only lowercase letters, numbers, and hyphens. Don't use a hyphen for the first or last character. Use periods to separate subdomain names.

  • UserPoolId (string) --

    [REQUIRED]

    The ID of the user pool that is associated with the custom domain whose certificate you're updating.

  • CustomDomainConfig (dict) --

    [REQUIRED]

    The configuration for a custom domain that hosts the sign-up and sign-in pages for your application. Use this object to specify an SSL certificate that is managed by ACM.

    • CertificateArn (string) -- [REQUIRED]

      The Amazon Resource Name (ARN) of an Certificate Manager SSL certificate. You use this certificate for the subdomain of your custom domain.

Return type

dict

Returns

Response Syntax

{
    'CloudFrontDomain': 'string'
}

Response Structure

  • (dict) --

    The UpdateUserPoolDomain response output.

    • CloudFrontDomain (string) --

      The Amazon CloudFront endpoint that Amazon Cognito set up when you added the custom domain to your user pool.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
verify_software_token(**kwargs)

Use this API to register a user's entered time-based one-time password (TOTP) code and mark the user's software token MFA status as "verified" if successful. The request takes an access token or a session string, but not both.

See also: AWS API Documentation

Request Syntax

response = client.verify_software_token(
    AccessToken='string',
    Session='string',
    UserCode='string',
    FriendlyDeviceName='string'
)
Parameters
  • AccessToken (string) -- A valid access token that Amazon Cognito issued to the user whose software token you want to verify.
  • Session (string) -- The session that should be passed both ways in challenge-response calls to the service.
  • UserCode (string) --

    [REQUIRED]

    The one- time password computed using the secret code returned by AssociateSoftwareToken .

  • FriendlyDeviceName (string) -- The friendly device name.
Return type

dict

Returns

Response Syntax

{
    'Status': 'SUCCESS'|'ERROR',
    'Session': 'string'
}

Response Structure

  • (dict) --

    • Status (string) --

      The status of the verify software token.

    • Session (string) --

      The session that should be passed both ways in challenge-response calls to the service.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidUserPoolConfigurationException
  • 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.EnableSoftwareTokenMFAException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.SoftwareTokenMFANotFoundException
  • CognitoIdentityProvider.Client.exceptions.CodeMismatchException
  • CognitoIdentityProvider.Client.exceptions.ForbiddenException
verify_user_attribute(**kwargs)

Verifies the specified user attributes in the user pool.

If your user pool requires verification before Amazon Cognito updates the attribute value, VerifyUserAttribute updates the affected attribute to its pending value. For more information, see UserAttributeUpdateSettingsType .

See also: AWS API Documentation

Request Syntax

response = client.verify_user_attribute(
    AccessToken='string',
    AttributeName='string',
    Code='string'
)
Parameters
  • AccessToken (string) --

    [REQUIRED]

    A valid access token that Amazon Cognito issued to the user whose user attributes you want to verify.

  • AttributeName (string) --

    [REQUIRED]

    The attribute name in the request to verify user attributes.

  • Code (string) --

    [REQUIRED]

    The verification code in the request to verify user attributes.

Return type

dict

Returns

Response Syntax

{}

Response Structure

  • (dict) --

    A container representing the response from the server from the request to verify user attributes.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.CodeMismatchException
  • CognitoIdentityProvider.Client.exceptions.ExpiredCodeException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.LimitExceededException
  • CognitoIdentityProvider.Client.exceptions.PasswordResetRequiredException
  • CognitoIdentityProvider.Client.exceptions.UserNotFoundException
  • CognitoIdentityProvider.Client.exceptions.UserNotConfirmedException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException
  • CognitoIdentityProvider.Client.exceptions.AliasExistsException
  • CognitoIdentityProvider.Client.exceptions.ForbiddenException

Paginators

The available paginators are:

class CognitoIdentityProvider.Paginator.AdminListGroupsForUser
paginator = client.get_paginator('admin_list_groups_for_user')
paginate(**kwargs)

Creates an iterator that will paginate through responses from CognitoIdentityProvider.Client.admin_list_groups_for_user().

See also: AWS API Documentation

Request Syntax

response_iterator = paginator.paginate(
    Username='string',
    UserPoolId='string',
    PaginationConfig={
        'MaxItems': 123,
        'PageSize': 123,
        'StartingToken': 'string'
    }
)
Parameters
  • Username (string) --

    [REQUIRED]

    The username for the user.

  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool.

  • PaginationConfig (dict) --

    A dictionary that provides parameters to control pagination.

    • MaxItems (integer) --

      The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.

    • PageSize (integer) --

      The size of each page.

    • StartingToken (string) --

      A token to specify where to start paginating. This is the NextToken from a previous response.

Return type

dict

Returns

Response Syntax

{
    'Groups': [
        {
            'GroupName': 'string',
            'UserPoolId': 'string',
            'Description': 'string',
            'RoleArn': 'string',
            'Precedence': 123,
            'LastModifiedDate': datetime(2015, 1, 1),
            'CreationDate': datetime(2015, 1, 1)
        },
    ],

}

Response Structure

  • (dict) --

    • Groups (list) --

      The groups that the user belongs to.

      • (dict) --

        The group type.

        • GroupName (string) --

          The name of the group.

        • UserPoolId (string) --

          The user pool ID for the user pool.

        • Description (string) --

          A string containing the description of the group.

        • RoleArn (string) --

          The role Amazon Resource Name (ARN) for the group.

        • Precedence (integer) --

          A non-negative integer value that specifies the precedence of this group relative to the other groups that a user can belong to in the user pool. Zero is the highest precedence value. Groups with lower Precedence values take precedence over groups with higher ornull Precedence values. If a user belongs to two or more groups, it is the group with the lowest precedence value whose role ARN is given in the user's tokens for the cognito:roles and cognito:preferred_role claims.

          Two groups can have the same Precedence value. If this happens, neither group takes precedence over the other. If two groups with the same Precedence have the same role ARN, that role is used in the cognito:preferred_role claim in tokens for users in each group. If the two groups have different role ARNs, the cognito:preferred_role claim isn't set in users' tokens.

          The default Precedence value is null.

        • LastModifiedDate (datetime) --

          The date the group was last modified.

        • CreationDate (datetime) --

          The date the group was created.

class CognitoIdentityProvider.Paginator.AdminListUserAuthEvents
paginator = client.get_paginator('admin_list_user_auth_events')
paginate(**kwargs)

Creates an iterator that will paginate through responses from CognitoIdentityProvider.Client.admin_list_user_auth_events().

See also: AWS API Documentation

Request Syntax

response_iterator = paginator.paginate(
    UserPoolId='string',
    Username='string',
    PaginationConfig={
        'MaxItems': 123,
        'PageSize': 123,
        'StartingToken': 'string'
    }
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID.

  • Username (string) --

    [REQUIRED]

    The user pool username or an alias.

  • PaginationConfig (dict) --

    A dictionary that provides parameters to control pagination.

    • MaxItems (integer) --

      The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.

    • PageSize (integer) --

      The size of each page.

    • StartingToken (string) --

      A token to specify where to start paginating. This is the NextToken from a previous response.

Return type

dict

Returns

Response Syntax

{
    'AuthEvents': [
        {
            'EventId': 'string',
            'EventType': 'SignIn'|'SignUp'|'ForgotPassword'|'PasswordChange'|'ResendCode',
            'CreationDate': datetime(2015, 1, 1),
            'EventResponse': 'Pass'|'Fail'|'InProgress',
            'EventRisk': {
                'RiskDecision': 'NoRisk'|'AccountTakeover'|'Block',
                'RiskLevel': 'Low'|'Medium'|'High',
                'CompromisedCredentialsDetected': True|False
            },
            'ChallengeResponses': [
                {
                    'ChallengeName': 'Password'|'Mfa',
                    'ChallengeResponse': 'Success'|'Failure'
                },
            ],
            'EventContextData': {
                'IpAddress': 'string',
                'DeviceName': 'string',
                'Timezone': 'string',
                'City': 'string',
                'Country': 'string'
            },
            'EventFeedback': {
                'FeedbackValue': 'Valid'|'Invalid',
                'Provider': 'string',
                'FeedbackDate': datetime(2015, 1, 1)
            }
        },
    ],

}

Response Structure

  • (dict) --

    • AuthEvents (list) --

      The response object. It includes the EventID , EventType , CreationDate , EventRisk , and EventResponse .

      • (dict) --

        The authentication event type.

        • EventId (string) --

          The event ID.

        • EventType (string) --

          The event type.

        • CreationDate (datetime) --

          The creation date

        • EventResponse (string) --

          The event response.

        • EventRisk (dict) --

          The event risk.

          • RiskDecision (string) --

            The risk decision.

          • RiskLevel (string) --

            The risk level.

          • CompromisedCredentialsDetected (boolean) --

            Indicates whether compromised credentials were detected during an authentication event.

        • ChallengeResponses (list) --

          The challenge responses.

          • (dict) --

            The challenge response type.

            • ChallengeName (string) --

              The challenge name.

            • ChallengeResponse (string) --

              The challenge response.

        • EventContextData (dict) --

          The user context data captured at the time of an event request. This value provides additional information about the client from which event the request is received.

          • IpAddress (string) --

            The source IP address of your user's device.

          • DeviceName (string) --

            The user's device name.

          • Timezone (string) --

            The user's time zone.

          • City (string) --

            The user's city.

          • Country (string) --

            The user's country.

        • EventFeedback (dict) --

          A flag specifying the user feedback captured at the time of an event request is good or bad.

          • FeedbackValue (string) --

            The event feedback value.

          • Provider (string) --

            The provider.

          • FeedbackDate (datetime) --

            The event feedback date.

class CognitoIdentityProvider.Paginator.ListGroups
paginator = client.get_paginator('list_groups')
paginate(**kwargs)

Creates an iterator that will paginate through responses from CognitoIdentityProvider.Client.list_groups().

See also: AWS API Documentation

Request Syntax

response_iterator = paginator.paginate(
    UserPoolId='string',
    PaginationConfig={
        'MaxItems': 123,
        'PageSize': 123,
        'StartingToken': 'string'
    }
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool.

  • PaginationConfig (dict) --

    A dictionary that provides parameters to control pagination.

    • MaxItems (integer) --

      The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.

    • PageSize (integer) --

      The size of each page.

    • StartingToken (string) --

      A token to specify where to start paginating. This is the NextToken from a previous response.

Return type

dict

Returns

Response Syntax

{
    'Groups': [
        {
            'GroupName': 'string',
            'UserPoolId': 'string',
            'Description': 'string',
            'RoleArn': 'string',
            'Precedence': 123,
            'LastModifiedDate': datetime(2015, 1, 1),
            'CreationDate': datetime(2015, 1, 1)
        },
    ],

}

Response Structure

  • (dict) --

    • Groups (list) --

      The group objects for the groups.

      • (dict) --

        The group type.

        • GroupName (string) --

          The name of the group.

        • UserPoolId (string) --

          The user pool ID for the user pool.

        • Description (string) --

          A string containing the description of the group.

        • RoleArn (string) --

          The role Amazon Resource Name (ARN) for the group.

        • Precedence (integer) --

          A non-negative integer value that specifies the precedence of this group relative to the other groups that a user can belong to in the user pool. Zero is the highest precedence value. Groups with lower Precedence values take precedence over groups with higher ornull Precedence values. If a user belongs to two or more groups, it is the group with the lowest precedence value whose role ARN is given in the user's tokens for the cognito:roles and cognito:preferred_role claims.

          Two groups can have the same Precedence value. If this happens, neither group takes precedence over the other. If two groups with the same Precedence have the same role ARN, that role is used in the cognito:preferred_role claim in tokens for users in each group. If the two groups have different role ARNs, the cognito:preferred_role claim isn't set in users' tokens.

          The default Precedence value is null.

        • LastModifiedDate (datetime) --

          The date the group was last modified.

        • CreationDate (datetime) --

          The date the group was created.

class CognitoIdentityProvider.Paginator.ListIdentityProviders
paginator = client.get_paginator('list_identity_providers')
paginate(**kwargs)

Creates an iterator that will paginate through responses from CognitoIdentityProvider.Client.list_identity_providers().

See also: AWS API Documentation

Request Syntax

response_iterator = paginator.paginate(
    UserPoolId='string',
    PaginationConfig={
        'MaxItems': 123,
        'PageSize': 123,
        'StartingToken': 'string'
    }
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID.

  • PaginationConfig (dict) --

    A dictionary that provides parameters to control pagination.

    • MaxItems (integer) --

      The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.

    • PageSize (integer) --

      The size of each page.

    • StartingToken (string) --

      A token to specify where to start paginating. This is the NextToken from a previous response.

Return type

dict

Returns

Response Syntax

{
    'Providers': [
        {
            'ProviderName': 'string',
            'ProviderType': 'SAML'|'Facebook'|'Google'|'LoginWithAmazon'|'SignInWithApple'|'OIDC',
            'LastModifiedDate': datetime(2015, 1, 1),
            'CreationDate': datetime(2015, 1, 1)
        },
    ],

}

Response Structure

  • (dict) --

    • Providers (list) --

      A list of IdP objects.

      • (dict) --

        A container for IdP details.

        • ProviderName (string) --

          The IdP name.

        • ProviderType (string) --

          The IdP type.

        • LastModifiedDate (datetime) --

          The date the provider was last modified.

        • CreationDate (datetime) --

          The date the provider was added to the user pool.

class CognitoIdentityProvider.Paginator.ListResourceServers
paginator = client.get_paginator('list_resource_servers')
paginate(**kwargs)

Creates an iterator that will paginate through responses from CognitoIdentityProvider.Client.list_resource_servers().

See also: AWS API Documentation

Request Syntax

response_iterator = paginator.paginate(
    UserPoolId='string',
    PaginationConfig={
        'MaxItems': 123,
        'PageSize': 123,
        'StartingToken': 'string'
    }
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool.

  • PaginationConfig (dict) --

    A dictionary that provides parameters to control pagination.

    • MaxItems (integer) --

      The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.

    • PageSize (integer) --

      The size of each page.

    • StartingToken (string) --

      A token to specify where to start paginating. This is the NextToken from a previous response.

Return type

dict

Returns

Response Syntax

{
    'ResourceServers': [
        {
            'UserPoolId': 'string',
            'Identifier': 'string',
            'Name': 'string',
            'Scopes': [
                {
                    'ScopeName': 'string',
                    'ScopeDescription': 'string'
                },
            ]
        },
    ],

}

Response Structure

  • (dict) --

    • ResourceServers (list) --

      The resource servers.

      • (dict) --

        A container for information about a resource server for a user pool.

        • UserPoolId (string) --

          The user pool ID for the user pool that hosts the resource server.

        • Identifier (string) --

          The identifier for the resource server.

        • Name (string) --

          The name of the resource server.

        • Scopes (list) --

          A list of scopes that are defined for the resource server.

          • (dict) --

            A resource server scope.

            • ScopeName (string) --

              The name of the scope.

            • ScopeDescription (string) --

              A description of the scope.

class CognitoIdentityProvider.Paginator.ListUserPoolClients
paginator = client.get_paginator('list_user_pool_clients')
paginate(**kwargs)

Creates an iterator that will paginate through responses from CognitoIdentityProvider.Client.list_user_pool_clients().

See also: AWS API Documentation

Request Syntax

response_iterator = paginator.paginate(
    UserPoolId='string',
    PaginationConfig={
        'MaxItems': 123,
        'PageSize': 123,
        'StartingToken': 'string'
    }
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool where you want to list user pool clients.

  • PaginationConfig (dict) --

    A dictionary that provides parameters to control pagination.

    • MaxItems (integer) --

      The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.

    • PageSize (integer) --

      The size of each page.

    • StartingToken (string) --

      A token to specify where to start paginating. This is the NextToken from a previous response.

Return type

dict

Returns

Response Syntax

{
    'UserPoolClients': [
        {
            'ClientId': 'string',
            'UserPoolId': 'string',
            'ClientName': 'string'
        },
    ],

}

Response Structure

  • (dict) --

    Represents the response from the server that lists user pool clients.

    • UserPoolClients (list) --

      The user pool clients in the response that lists user pool clients.

      • (dict) --

        The description of the user pool client.

        • ClientId (string) --

          The ID of the client associated with the user pool.

        • UserPoolId (string) --

          The user pool ID for the user pool where you want to describe the user pool client.

        • ClientName (string) --

          The client name from the user pool client description.

class CognitoIdentityProvider.Paginator.ListUserPools
paginator = client.get_paginator('list_user_pools')
paginate(**kwargs)

Creates an iterator that will paginate through responses from CognitoIdentityProvider.Client.list_user_pools().

See also: AWS API Documentation

Request Syntax

response_iterator = paginator.paginate(
    PaginationConfig={
        'MaxItems': 123,
        'PageSize': 123,
        'StartingToken': 'string'
    }
)
Parameters
PaginationConfig (dict) --

A dictionary that provides parameters to control pagination.

  • MaxItems (integer) --

    The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.

  • PageSize (integer) --

    The size of each page.

  • StartingToken (string) --

    A token to specify where to start paginating. This is the NextToken from a previous response.

Return type
dict
Returns
Response Syntax
{
    'UserPools': [
        {
            'Id': 'string',
            'Name': 'string',
            'LambdaConfig': {
                'PreSignUp': 'string',
                'CustomMessage': 'string',
                'PostConfirmation': 'string',
                'PreAuthentication': 'string',
                'PostAuthentication': 'string',
                'DefineAuthChallenge': 'string',
                'CreateAuthChallenge': 'string',
                'VerifyAuthChallengeResponse': 'string',
                'PreTokenGeneration': 'string',
                'UserMigration': 'string',
                'CustomSMSSender': {
                    'LambdaVersion': 'V1_0',
                    'LambdaArn': 'string'
                },
                'CustomEmailSender': {
                    'LambdaVersion': 'V1_0',
                    'LambdaArn': 'string'
                },
                'KMSKeyID': 'string'
            },
            'Status': 'Enabled'|'Disabled',
            'LastModifiedDate': datetime(2015, 1, 1),
            'CreationDate': datetime(2015, 1, 1)
        },
    ],

}

Response Structure

  • (dict) --

    Represents the response to list user pools.

    • UserPools (list) --

      The user pools from the response to list users.

      • (dict) --

        A user pool description.

        • Id (string) --

          The ID in a user pool description.

        • Name (string) --

          The name in a user pool description.

        • LambdaConfig (dict) --

          The Lambda configuration information in a user pool description.

          • PreSignUp (string) --

            A pre-registration Lambda trigger.

          • CustomMessage (string) --

            A custom Message Lambda trigger.

          • PostConfirmation (string) --

            A post-confirmation Lambda trigger.

          • PreAuthentication (string) --

            A pre-authentication Lambda trigger.

          • PostAuthentication (string) --

            A post-authentication Lambda trigger.

          • DefineAuthChallenge (string) --

            Defines the authentication challenge.

          • CreateAuthChallenge (string) --

            Creates an authentication challenge.

          • VerifyAuthChallengeResponse (string) --

            Verifies the authentication challenge response.

          • PreTokenGeneration (string) --

            A Lambda trigger that is invoked before token generation.

          • UserMigration (string) --

            The user migration Lambda config type.

          • CustomSMSSender (dict) --

            A custom SMS sender Lambda trigger.

            • LambdaVersion (string) --

              Signature of the "request" attribute in the "event" information that Amazon Cognito passes to your custom SMS Lambda function. The only supported value is V1_0 .

            • LambdaArn (string) --

              The Amazon Resource Name (ARN) of the Lambda function that Amazon Cognito activates to send SMS notifications to users.

          • CustomEmailSender (dict) --

            A custom email sender Lambda trigger.

            • LambdaVersion (string) --

              Signature of the "request" attribute in the "event" information Amazon Cognito passes to your custom email Lambda function. The only supported value is V1_0 .

            • LambdaArn (string) --

              The Amazon Resource Name (ARN) of the Lambda function that Amazon Cognito activates to send email notifications to users.

          • KMSKeyID (string) --

            The Amazon Resource Name (ARN) of an KMS key . Amazon Cognito uses the key to encrypt codes and temporary passwords sent to CustomEmailSender and CustomSMSSender .

        • Status (string) --

          The user pool status in a user pool description.

        • LastModifiedDate (datetime) --

          The date the user pool description was last modified.

        • CreationDate (datetime) --

          The date the user pool description was created.

class CognitoIdentityProvider.Paginator.ListUsers
paginator = client.get_paginator('list_users')
paginate(**kwargs)

Creates an iterator that will paginate through responses from CognitoIdentityProvider.Client.list_users().

See also: AWS API Documentation

Request Syntax

response_iterator = paginator.paginate(
    UserPoolId='string',
    AttributesToGet=[
        'string',
    ],
    Filter='string',
    PaginationConfig={
        'MaxItems': 123,
        'PageSize': 123,
        'StartingToken': 'string'
    }
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool on which the search should be performed.

  • AttributesToGet (list) --

    An array of strings, where each string is the name of a user attribute to be returned for each user in the search results. If the array is null, all attributes are returned.

    • (string) --
  • Filter (string) --

    A filter string of the form "AttributeName Filter-Type "AttributeValue "". Quotation marks within the filter string must be escaped using the backslash () character. For example, "family_name = "Reddy"".

    • AttributeName : The name of the attribute to search for. You can only search for one attribute at a time.
    • Filter-Type : For an exact match, use =, for example, "given_name = "Jon"". For a prefix ("starts with") match, use ^=, for example, "given_name ^= "Jon"".
    • AttributeValue : The attribute value that must be matched for each user.

    If the filter string is empty, ListUsers returns all users in the user pool.

    You can only search for the following standard attributes:

    • username (case-sensitive)
    • email
    • phone_number
    • name
    • given_name
    • family_name
    • preferred_username
    • cognito:user_status (called Status in the Console) (case-insensitive)
    • status (called **Enabled** in the Console) (case-sensitive)
    • sub

    Custom attributes aren't searchable.

    Note

    You can also list users with a client-side filter. The server-side filter matches no more than one attribute. For an advanced search, use a client-side filter with the --query parameter of the list-users action in the CLI. When you use a client-side filter, ListUsers returns a paginated list of zero or more users. You can receive multiple pages in a row with zero results. Repeat the query with each pagination token that is returned until you receive a null pagination token value, and then review the combined result.

    For more information about server-side and client-side filtering, see FilteringCLI output in the Command Line Interface User Guide .

    For more information, see Searching for Users Using the ListUsers API and Examples of Using the ListUsers API in the Amazon Cognito Developer Guide .

  • PaginationConfig (dict) --

    A dictionary that provides parameters to control pagination.

    • MaxItems (integer) --

      The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.

    • PageSize (integer) --

      The size of each page.

    • StartingToken (string) --

      A token to specify where to start paginating. This is the NextToken from a previous response.

Return type

dict

Returns

Response Syntax

{
    'Users': [
        {
            'Username': 'string',
            'Attributes': [
                {
                    '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'
                },
            ]
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    The response from the request to list users.

    • Users (list) --

      The users returned in the request to list users.

      • (dict) --

        A user profile in a Amazon Cognito user pool.

        • Username (string) --

          The user name of the user you want to describe.

        • Attributes (list) --

          A container with information about the user type 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 creation date of the user.

        • UserLastModifiedDate (datetime) --

          The last modified date of the user.

        • Enabled (boolean) --

          Specifies whether the user is enabled.

        • UserStatus (string) --

          The user status. This can be one of the following:

          • UNCONFIRMED - User has been created but not confirmed.
          • CONFIRMED - User has been confirmed.
          • EXTERNAL_PROVIDER - User signed in with a third-party IdP.
          • ARCHIVED - User is no longer active.
          • 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) --

          The MFA options for the user.

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

    • NextToken (string) --

      A token to resume pagination.

class CognitoIdentityProvider.Paginator.ListUsersInGroup
paginator = client.get_paginator('list_users_in_group')
paginate(**kwargs)

Creates an iterator that will paginate through responses from CognitoIdentityProvider.Client.list_users_in_group().

See also: AWS API Documentation

Request Syntax

response_iterator = paginator.paginate(
    UserPoolId='string',
    GroupName='string',
    PaginationConfig={
        'MaxItems': 123,
        'PageSize': 123,
        'StartingToken': 'string'
    }
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool.

  • GroupName (string) --

    [REQUIRED]

    The name of the group.

  • PaginationConfig (dict) --

    A dictionary that provides parameters to control pagination.

    • MaxItems (integer) --

      The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.

    • PageSize (integer) --

      The size of each page.

    • StartingToken (string) --

      A token to specify where to start paginating. This is the NextToken from a previous response.

Return type

dict

Returns

Response Syntax

{
    'Users': [
        {
            'Username': 'string',
            'Attributes': [
                {
                    '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'
                },
            ]
        },
    ],

}

Response Structure

  • (dict) --

    • Users (list) --

      The users returned in the request to list users.

      • (dict) --

        A user profile in a Amazon Cognito user pool.

        • Username (string) --

          The user name of the user you want to describe.

        • Attributes (list) --

          A container with information about the user type 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 creation date of the user.

        • UserLastModifiedDate (datetime) --

          The last modified date of the user.

        • Enabled (boolean) --

          Specifies whether the user is enabled.

        • UserStatus (string) --

          The user status. This can be one of the following:

          • UNCONFIRMED - User has been created but not confirmed.
          • CONFIRMED - User has been confirmed.
          • EXTERNAL_PROVIDER - User signed in with a third-party IdP.
          • ARCHIVED - User is no longer active.
          • 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) --

          The MFA options for the user.

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