SDK for PHP 3.x

Client: Aws\CognitoIdentityProvider\CognitoIdentityProviderClient
Service ID: cognito-idp
Version: 2016-04-18

This page describes the parameters and results for the operations of the Amazon Cognito Identity Provider (2016-04-18), and shows how to use the Aws\CognitoIdentityProvider\CognitoIdentityProviderClient object to call the described operations. This documentation is specific to the 2016-04-18 API version of the service.

Operation Summary

Each of the following operations can be created from a client using $client->getCommand('CommandName'), where "CommandName" is the name of one of the following operations. Note: a command is a value that encapsulates an operation and the parameters used to create an HTTP request.

You can also create and send a command immediately using the magic methods available on a client object: $client->commandName(/* parameters */). You can send the command asynchronously (returning a promise) by appending the word "Async" to the operation name: $client->commandNameAsync(/* parameters */).

AddCustomAttributes ( array $params = [] )
Adds additional user attributes to the user pool schema.
AdminAddUserToGroup ( array $params = [] )
Adds a user to a group.
AdminConfirmSignUp ( array $params = [] )
Confirms user sign-up as an administrator.
AdminCreateUser ( array $params = [] )
Creates a new user in the specified user pool.
AdminDeleteUser ( array $params = [] )
Deletes a user profile in your user pool.
AdminDeleteUserAttributes ( array $params = [] )
Deletes attribute values from a user.
AdminDisableProviderForUser ( array $params = [] )
Prevents the user from signing in with the specified external (SAML or social) identity provider (IdP).
AdminDisableUser ( array $params = [] )
Deactivates a user profile and revokes all access tokens for the user.
AdminEnableUser ( array $params = [] )
Activate sign-in for a user profile that previously had sign-in access disabled.
AdminForgetDevice ( array $params = [] )
Forgets, or deletes, a remembered device from a user's profile.
AdminGetDevice ( array $params = [] )
Given the device key, returns details for a user' device.
AdminGetUser ( array $params = [] )
Given the username, returns details about a user profile in a user pool.
AdminInitiateAuth ( array $params = [] )
Starts sign-in for applications with a server-side component, for example a traditional web application.
AdminLinkProviderForUser ( array $params = [] )
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.
AdminListDevices ( array $params = [] )
Lists a user's registered devices.
AdminListGroupsForUser ( array $params = [] )
Lists the groups that a user belongs to.
AdminListUserAuthEvents ( array $params = [] )
Requests a history of user activity and any risks detected as part of Amazon Cognito threat protection.
AdminRemoveUserFromGroup ( array $params = [] )
Given a username and a group name.
AdminResetUserPassword ( array $params = [] )
Resets the specified user's password in a user pool.
AdminRespondToAuthChallenge ( array $params = [] )
Some API operations in a user pool generate a challenge, like a prompt for an MFA code, for device authentication that bypasses MFA, or for a custom authentication challenge.
AdminSetUserMFAPreference ( array $params = [] )
Sets the user's multi-factor authentication (MFA) preference, including which MFA options are activated, and if any are preferred.
AdminSetUserPassword ( array $params = [] )
Sets the specified user's password in a user pool.
AdminSetUserSettings ( array $params = [] )
This action is no longer supported.
AdminUpdateAuthEventFeedback ( array $params = [] )
Provides feedback for an authentication event indicating if it was from a valid user.
AdminUpdateDeviceStatus ( array $params = [] )
Updates the status of a user's device so that it is marked as remembered or not remembered for the purpose of device authentication.
AdminUpdateUserAttributes ( array $params = [] )
This action might generate an SMS text message.
AdminUserGlobalSignOut ( array $params = [] )
Invalidates the identity, access, and refresh tokens that Amazon Cognito issued to a user.
AssociateSoftwareToken ( array $params = [] )
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.
ChangePassword ( array $params = [] )
Changes the password for a specified user in a user pool.
CompleteWebAuthnRegistration ( array $params = [] )
Completes registration of a passkey authenticator for the current user.
ConfirmDevice ( array $params = [] )
Confirms a device that a user wants to remember.
ConfirmForgotPassword ( array $params = [] )
This public API operation accepts a confirmation code that Amazon Cognito sent to a user and accepts a new password for that user.
ConfirmSignUp ( array $params = [] )
This public API operation submits a code that Amazon Cognito sent to your user when they signed up in your user pool via the SignUp API operation.
CreateGroup ( array $params = [] )
Creates a new group in the specified user pool.
CreateIdentityProvider ( array $params = [] )
Adds a configuration and trust relationship between a third-party identity provider (IdP) and a user pool.
CreateManagedLoginBranding ( array $params = [] )
Creates a new set of branding settings for a user pool style and associates it with an app client.
CreateResourceServer ( array $params = [] )
Creates a new OAuth2.
CreateUserImportJob ( array $params = [] )
Creates a user import job.
CreateUserPool ( array $params = [] )
This action might generate an SMS text message.
CreateUserPoolClient ( array $params = [] )
Creates an app client in a user pool.
CreateUserPoolDomain ( array $params = [] )
A user pool domain hosts managed login, an authorization server and web server for authentication in your application.
DeleteGroup ( array $params = [] )
Deletes a group from the specified user pool.
DeleteIdentityProvider ( array $params = [] )
Deletes a user pool identity provider (IdP).
DeleteManagedLoginBranding ( array $params = [] )
Deletes a managed login branding style.
DeleteResourceServer ( array $params = [] )
Deletes a resource server.
DeleteUser ( array $params = [] )
Self-deletes a user profile.
DeleteUserAttributes ( array $params = [] )
Self-deletes attributes for a user.
DeleteUserPool ( array $params = [] )
Deletes a user pool.
DeleteUserPoolClient ( array $params = [] )
Deletes a user pool app client.
DeleteUserPoolDomain ( array $params = [] )
Given a user pool ID and domain identifier, deletes a user pool domain.
DeleteWebAuthnCredential ( array $params = [] )
Deletes a registered passkey, or webauthN, authenticator for the currently signed-in user.
DescribeIdentityProvider ( array $params = [] )
Given a user pool ID and identity provider (IdP) name, returns details about the IdP.
DescribeManagedLoginBranding ( array $params = [] )
Given the ID of a managed login branding style, returns detailed information about the style.
DescribeManagedLoginBrandingByClient ( array $params = [] )
Given the ID of a user pool app client, returns detailed information about the style assigned to the app client.
DescribeResourceServer ( array $params = [] )
Describes a resource server.
DescribeRiskConfiguration ( array $params = [] )
Given an app client or user pool ID where threat protection is configured, describes the risk configuration.
DescribeUserImportJob ( array $params = [] )
Describes a user import job.
DescribeUserPool ( array $params = [] )
Given a user pool ID, returns configuration information.
DescribeUserPoolClient ( array $params = [] )
Given an app client ID, returns configuration information.
DescribeUserPoolDomain ( array $params = [] )
Given a user pool domain name, returns information about the domain configuration.
ForgetDevice ( array $params = [] )
Forgets the specified device.
ForgotPassword ( array $params = [] )
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.
GetCSVHeader ( array $params = [] )
Gets the header information for the comma-separated value (CSV) file to be used as input for the user import job.
GetDevice ( array $params = [] )
Gets the device.
GetGroup ( array $params = [] )
Gets a group.
GetIdentityProviderByIdentifier ( array $params = [] )
Gets the specified IdP.
GetLogDeliveryConfiguration ( array $params = [] )
Gets the logging configuration of a user pool.
GetSigningCertificate ( array $params = [] )
This method takes a user pool ID, and returns the signing certificate.
GetUICustomization ( array $params = [] )
Gets the user interface (UI) Customization information for a particular app client's app UI, if any such information exists for the client.
GetUser ( array $params = [] )
Gets the user attributes and metadata for a user.
GetUserAttributeVerificationCode ( array $params = [] )
Generates a user attribute verification code for the specified attribute name.
GetUserAuthFactors ( array $params = [] )
Lists the authentication options for the currently signed-in user.
GetUserPoolMfaConfig ( array $params = [] )
Gets the user pool multi-factor authentication (MFA) configuration.
GlobalSignOut ( array $params = [] )
Invalidates the identity, access, and refresh tokens that Amazon Cognito issued to a user.
InitiateAuth ( array $params = [] )
Initiates sign-in for a user in the Amazon Cognito user directory.
ListDevices ( array $params = [] )
Lists the sign-in devices that Amazon Cognito has registered to the current user.
ListGroups ( array $params = [] )
Lists the groups associated with a user pool.
ListIdentityProviders ( array $params = [] )
Lists information about all IdPs for a user pool.
ListResourceServers ( array $params = [] )
Lists the resource servers for a user pool.
ListTagsForResource ( array $params = [] )
Lists the tags that are assigned to an Amazon Cognito user pool.
ListUserImportJobs ( array $params = [] )
Lists user import jobs for a user pool.
ListUserPoolClients ( array $params = [] )
Lists the clients that have been created for the specified user pool.
ListUserPools ( array $params = [] )
Lists the user pools associated with an Amazon Web Services account.
ListUsers ( array $params = [] )
Lists users and their basic details in a user pool.
ListUsersInGroup ( array $params = [] )
Lists the users in the specified group.
ListWebAuthnCredentials ( array $params = [] )
Generates a list of the current user's registered passkey, or webauthN, credentials.
ResendConfirmationCode ( array $params = [] )
Resends the confirmation (for confirmation of registration) to a specific user in the user pool.
RespondToAuthChallenge ( array $params = [] )
Some API operations in a user pool generate a challenge, like a prompt for an MFA code, for device authentication that bypasses MFA, or for a custom authentication challenge.
RevokeToken ( array $params = [] )
Revokes all of the access tokens generated by, and at the same time as, the specified refresh token.
SetLogDeliveryConfiguration ( array $params = [] )
Sets up or modifies the logging configuration of a user pool.
SetRiskConfiguration ( array $params = [] )
Configures actions on detected risks.
SetUICustomization ( array $params = [] )
Sets the user interface (UI) customization information for a user pool's built-in app UI.
SetUserMFAPreference ( array $params = [] )
Set the user's multi-factor authentication (MFA) method preference, including which MFA factors are activated and if any are preferred.
SetUserPoolMfaConfig ( array $params = [] )
Sets the user pool multi-factor authentication (MFA) and passkey configuration.
SetUserSettings ( array $params = [] )
This action is no longer supported.
SignUp ( array $params = [] )
Registers the user in the specified user pool and creates a user name, password, and user attributes.
StartUserImportJob ( array $params = [] )
Starts the user import.
StartWebAuthnRegistration ( array $params = [] )
Requests credential creation options from your user pool for registration of a passkey authenticator.
StopUserImportJob ( array $params = [] )
Stops the user import job.
TagResource ( array $params = [] )
Assigns a set of tags to an Amazon Cognito user pool.
UntagResource ( array $params = [] )
Removes the specified tags from an Amazon Cognito user pool.
UpdateAuthEventFeedback ( array $params = [] )
Provides the feedback for an authentication event, whether it was from a valid user or not.
UpdateDeviceStatus ( array $params = [] )
Updates the device status.
UpdateGroup ( array $params = [] )
Updates the specified group with the specified attributes.
UpdateIdentityProvider ( array $params = [] )
Updates IdP information for a user pool.
UpdateManagedLoginBranding ( array $params = [] )
Configures the branding settings for a user pool style.
UpdateResourceServer ( array $params = [] )
Updates the name and scopes of resource server.
UpdateUserAttributes ( array $params = [] )
With this operation, your users can update one or more of their attributes with their own credentials.
UpdateUserPool ( array $params = [] )
This action might generate an SMS text message.
UpdateUserPoolClient ( array $params = [] )
Updates the specified user pool app client with the specified attributes.
UpdateUserPoolDomain ( array $params = [] )
A user pool domain hosts managed login, an authorization server and web server for authentication in your application.
VerifySoftwareToken ( array $params = [] )
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.
VerifyUserAttribute ( array $params = [] )
Verifies the specified user attributes in the user pool.

Paginators

Paginators handle automatically iterating over paginated API results. Paginators are associated with specific API operations, and they accept the parameters that the corresponding API operation accepts. You can get a paginator from a client class using getPaginator($paginatorName, $operationParameters). This client supports the following paginators:

AdminListGroupsForUser
AdminListUserAuthEvents
ListGroups
ListIdentityProviders
ListResourceServers
ListUserPoolClients
ListUserPools
ListUsers
ListUsersInGroup

Operations

AddCustomAttributes

$result = $client->addCustomAttributes([/* ... */]);
$promise = $client->addCustomAttributesAsync([/* ... */]);

Adds additional user attributes to the user pool schema. Custom attributes can be mutable or immutable and have a custom: or dev: prefix. For more information, see Custom attributes.

You can also create custom attributes in the Schema parameter of CreateUserPool and UpdateUserPool. You can't delete custom attributes after you create them.

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

Learn more

Parameter Syntax

$result = $client->addCustomAttributes([
    'CustomAttributes' => [ // REQUIRED
        [
            'AttributeDataType' => 'String|Number|DateTime|Boolean',
            'DeveloperOnlyAttribute' => true || false,
            'Mutable' => true || false,
            'Name' => '<string>',
            'NumberAttributeConstraints' => [
                'MaxValue' => '<string>',
                'MinValue' => '<string>',
            ],
            'Required' => true || false,
            'StringAttributeConstraints' => [
                'MaxLength' => '<string>',
                'MinLength' => '<string>',
            ],
        ],
        // ...
    ],
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
CustomAttributes
Required: Yes
Type: Array of SchemaAttributeType structures

An array of custom attribute names and other properties. Sets the following characteristics:

AttributeDataType

The expected data type. Can be a string, a number, a date and time, or a boolean.

Mutable

If true, you can grant app clients write access to the attribute value. If false, the attribute value can only be set up on sign-up or administrator creation of users.

Name

The attribute name. For an attribute like custom:myAttribute, enter myAttribute for this field.

Required

When true, users who sign up or are created must set a value for the attribute.

NumberAttributeConstraints

The minimum and maximum length of accepted values for a Number-type attribute.

StringAttributeConstraints

The minimum and maximum length of accepted values for a String-type attribute.

DeveloperOnlyAttribute

This legacy option creates an attribute with a dev: prefix. You can only set the value of a developer-only attribute with administrative IAM credentials.

UserPoolId
Required: Yes
Type: string

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

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

UserImportInProgressException:

This exception is thrown when you're trying to modify a user pool while a user import job is in progress for that pool.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

AdminAddUserToGroup

$result = $client->adminAddUserToGroup([/* ... */]);
$promise = $client->adminAddUserToGroupAsync([/* ... */]);

Adds a user to a group. A user who is in a group can present a preferred-role claim to an identity pool, and populates a cognito:groups claim to their access and identity tokens.

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

Learn more

Parameter Syntax

$result = $client->adminAddUserToGroup([
    'GroupName' => '<string>', // REQUIRED
    'UserPoolId' => '<string>', // REQUIRED
    'Username' => '<string>', // REQUIRED
]);

Parameter Details

Members
GroupName
Required: Yes
Type: string

The name of the group that you want to add your user to.

UserPoolId
Required: Yes
Type: string

The ID of the user pool that contains the group that you want to add the user to.

Username
Required: Yes
Type: string

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

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

UserNotFoundException:

This exception is thrown when a user isn't found.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

AdminConfirmSignUp

$result = $client->adminConfirmSignUp([/* ... */]);
$promise = $client->adminConfirmSignUpAsync([/* ... */]);

Confirms user sign-up as an administrator. Unlike ConfirmSignUp, your IAM credentials authorize user account confirmation. No confirmation code is required.

This request sets a user account active in a user pool that requires confirmation of new user accounts before they can sign in. You can configure your user pool to not send confirmation codes to new users and instead confirm them with this API operation on the back end.

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

Learn more

To configure your user pool to require administrative confirmation of users, set AllowAdminCreateUserOnly to true in a CreateUserPool or UpdateUserPool request.

Parameter Syntax

$result = $client->adminConfirmSignUp([
    'ClientMetadata' => ['<string>', ...],
    'UserPoolId' => '<string>', // REQUIRED
    'Username' => '<string>', // REQUIRED
]);

Parameter Details

Members
ClientMetadata
Type: Associative array of custom strings keys (StringType) to strings

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.

When you use the ClientMetadata parameter, note 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 send sensitive information in this parameter.

UserPoolId
Required: Yes
Type: string

The ID of the user pool where you want to confirm a user's sign-up request.

Username
Required: Yes
Type: string

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

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

UnexpectedLambdaException:

This exception is thrown when Amazon Cognito encounters an unexpected exception with Lambda.

UserLambdaValidationException:

This exception is thrown when the Amazon Cognito service encounters a user validation exception with the Lambda service.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

TooManyFailedAttemptsException:

This exception is thrown when the user has made too many failed attempts for a given action, such as sign-in.

InvalidLambdaResponseException:

This exception is thrown when Amazon Cognito encounters an invalid Lambda response.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

LimitExceededException:

This exception is thrown when a user exceeds the limit for a requested Amazon Web Services resource.

UserNotFoundException:

This exception is thrown when a user isn't found.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

AdminCreateUser

$result = $client->adminCreateUser([/* ... */]);
$promise = $client->adminCreateUserAsync([/* ... */]);

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).

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 Services 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, if the user has a password, they will be in the FORCE_CHANGE_PASSWORD state until they sign in and set their password. Your invitation message template must have the {####} password placeholder if your users have passwords. If your template doesn't have this placeholder, Amazon Cognito doesn't deliver the invitation message. In this case, you must update your message template and resend the password with a new AdminCreateUser request with a MessageAction value of RESEND.

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

Learn more

Parameter Syntax

$result = $client->adminCreateUser([
    'ClientMetadata' => ['<string>', ...],
    'DesiredDeliveryMediums' => ['<string>', ...],
    'ForceAliasCreation' => true || false,
    'MessageAction' => 'RESEND|SUPPRESS',
    'TemporaryPassword' => '<string>',
    'UserAttributes' => [
        [
            'Name' => '<string>', // REQUIRED
            'Value' => '<string>',
        ],
        // ...
    ],
    'UserPoolId' => '<string>', // REQUIRED
    'Username' => '<string>', // REQUIRED
    'ValidationData' => [
        [
            'Name' => '<string>', // REQUIRED
            'Value' => '<string>',
        ],
        // ...
    ],
]);

Parameter Details

Members
ClientMetadata
Type: Associative array of custom strings keys (StringType) to strings

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.

When you use the ClientMetadata parameter, note 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 send sensitive information in this parameter.

DesiredDeliveryMediums
Type: Array of strings

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.

ForceAliasCreation
Type: 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, this request migrates 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
Type: string

Set to RESEND to resend the invitation message to a user that already exists, and to reset the temporary-password duration with a new temporary password. Set to SUPPRESS to suppress sending the message. You can specify only one value.

TemporaryPassword
Type: string

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

The exception to the requirement for a password is when your user pool supports passwordless sign-in with email or SMS OTPs. To create a user with no password, omit this parameter or submit a blank value. You can only create a passwordless user when passwordless sign-in is available. See the SignInPolicyType property of CreateUserPool and UpdateUserPool.

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.

If you don't specify a value, Amazon Cognito generates one for you unless you have passwordless options active for your user pool.

The temporary password can only be used until the user account expiration limit that you set for your user pool. To reset the account after that time limit, you must call AdminCreateUser again and specify RESEND for the MessageAction parameter.

UserAttributes
Type: Array of AttributeType structures

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.

You must also provide an email address or phone number when you expect the user to do passwordless sign-in with an email or SMS OTP. These attributes must be provided when passwordless options are the only available, or when you don't submit a TemporaryPassword.

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.

UserPoolId
Required: Yes
Type: string

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

Username
Required: Yes
Type: string

The value that you want to set as the username sign-in attribute. The following conditions apply to the username parameter.

  • The username can't be a duplicate of another username in the same user pool.

  • You can't change the value of a username after you create it.

  • You can only provide a value if usernames are a valid sign-in attribute for your user pool. If your user pool only supports phone numbers or email addresses as sign-in attributes, Amazon Cognito automatically generates a username value. For more information, see Customizing sign-in attributes.

ValidationData
Type: Array of AttributeType structures

Temporary user attributes that contribute to the outcomes of your pre sign-up Lambda trigger. This set of key-value pairs are for custom validation of information that you collect from your users but don't need to retain.

Your Lambda function can analyze this additional data and act on it. Your function might perform external API operations like logging user attributes and validation data to Amazon CloudWatch Logs. Validation data might also affect the response that your function returns to Amazon Cognito, like automatically confirming the user if they sign up from within your network.

For more information about the pre sign-up Lambda trigger, see Pre sign-up Lambda trigger.

Result Syntax

[
    'User' => [
        'Attributes' => [
            [
                'Name' => '<string>',
                'Value' => '<string>',
            ],
            // ...
        ],
        'Enabled' => true || false,
        'MFAOptions' => [
            [
                'AttributeName' => '<string>',
                'DeliveryMedium' => 'SMS|EMAIL',
            ],
            // ...
        ],
        'UserCreateDate' => <DateTime>,
        'UserLastModifiedDate' => <DateTime>,
        'UserStatus' => 'UNCONFIRMED|CONFIRMED|ARCHIVED|COMPROMISED|UNKNOWN|RESET_REQUIRED|FORCE_CHANGE_PASSWORD|EXTERNAL_PROVIDER',
        'Username' => '<string>',
    ],
]

Result Details

Members
User
Type: UserType structure

The new user's profile details.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

UserNotFoundException:

This exception is thrown when a user isn't found.

UsernameExistsException:

This exception is thrown when Amazon Cognito encounters a user name that already exists in the user pool.

InvalidPasswordException:

This exception is thrown when Amazon Cognito encounters an invalid password.

CodeDeliveryFailureException:

This exception is thrown when a verification code fails to deliver successfully.

UnexpectedLambdaException:

This exception is thrown when Amazon Cognito encounters an unexpected exception with Lambda.

UserLambdaValidationException:

This exception is thrown when the Amazon Cognito service encounters a user validation exception with the Lambda service.

InvalidLambdaResponseException:

This exception is thrown when Amazon Cognito encounters an invalid Lambda response.

PreconditionNotMetException:

This exception is thrown when a precondition is not met.

InvalidSmsRoleAccessPolicyException:

This exception is returned when the role provided for SMS configuration doesn't have permission to publish using Amazon SNS.

InvalidSmsRoleTrustRelationshipException:

This exception is thrown when the trust relationship is not valid for the role provided for SMS configuration. This can happen if you don't trust cognito-idp.amazonaws.com or the external ID provided in the role does not match what is provided in the SMS configuration for the user pool.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

UnsupportedUserStateException:

The request failed because the user is in an unsupported state.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

Examples

Example 1: An AdminCreateUser request for for a test user named John.

This request submits a value for all possible parameters for AdminCreateUser.

$result = $client->adminCreateUser([
    'DesiredDeliveryMediums' => [
        'SMS',
    ],
    'MessageAction' => 'SUPPRESS',
    'TemporaryPassword' => 'This-is-my-test-99!',
    'UserAttributes' => [
        [
            'Name' => 'name',
            'Value' => 'John',
        ],
        [
            'Name' => 'phone_number',
            'Value' => '+12065551212',
        ],
        [
            'Name' => 'email',
            'Value' => 'testuser@example.com',
        ],
    ],
    'UserPoolId' => 'us-east-1_EXAMPLE',
    'Username' => 'testuser',
]);

Result syntax:

[
    'User' => [
        'Attributes' => [
            [
                'Name' => 'sub',
                'Value' => 'd16b4aa8-8633-4abd-93b3-5062a8e1b5f8',
            ],
            [
                'Name' => 'name',
                'Value' => 'John',
            ],
            [
                'Name' => 'phone_number',
                'Value' => '+12065551212',
            ],
            [
                'Name' => 'email',
                'Value' => 'testuser@example.com',
            ],
        ],
        'Enabled' => 1,
        'UserCreateDate' => ,
        'UserLastModifiedDate' => ,
        'UserStatus' => 'FORCE_CHANGE_PASSWORD',
        'Username' => 'testuser',
    ],
]

AdminDeleteUser

$result = $client->adminDeleteUser([/* ... */]);
$promise = $client->adminDeleteUserAsync([/* ... */]);

Deletes a user profile in your user pool.

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

Learn more

Parameter Syntax

$result = $client->adminDeleteUser([
    'UserPoolId' => '<string>', // REQUIRED
    'Username' => '<string>', // REQUIRED
]);

Parameter Details

Members
UserPoolId
Required: Yes
Type: string

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

Username
Required: Yes
Type: string

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

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

UserNotFoundException:

This exception is thrown when a user isn't found.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

AdminDeleteUserAttributes

$result = $client->adminDeleteUserAttributes([/* ... */]);
$promise = $client->adminDeleteUserAttributesAsync([/* ... */]);

Deletes attribute values from a user. This operation doesn't affect tokens for existing user sessions. The next ID token that the user receives will no longer have this attribute.

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

Learn more

Parameter Syntax

$result = $client->adminDeleteUserAttributes([
    'UserAttributeNames' => ['<string>', ...], // REQUIRED
    'UserPoolId' => '<string>', // REQUIRED
    'Username' => '<string>', // REQUIRED
]);

Parameter Details

Members
UserAttributeNames
Required: Yes
Type: Array of strings

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.

UserPoolId
Required: Yes
Type: string

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

Username
Required: Yes
Type: string

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

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

UserNotFoundException:

This exception is thrown when a user isn't found.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

AdminDisableProviderForUser

$result = $client->adminDisableProviderForUser([/* ... */]);
$promise = $client->adminDisableProviderForUserAsync([/* ... */]);

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.

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.

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

Learn more

Parameter Syntax

$result = $client->adminDisableProviderForUser([
    'User' => [ // REQUIRED
        'ProviderAttributeName' => '<string>',
        'ProviderAttributeValue' => '<string>',
        'ProviderName' => '<string>',
    ],
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
User
Required: Yes
Type: ProviderUserIdentifierType structure

The user profile that you want to delete a linked identity from.

UserPoolId
Required: Yes
Type: string

The ID of the user pool where you want to delete the user's linked identities.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

UserNotFoundException:

This exception is thrown when a user isn't found.

AliasExistsException:

This exception is thrown when a user tries to confirm the account with an email address or phone number that has already been supplied as an alias for a different user profile. This exception indicates that an account with this email address or phone already exists in a user pool that you've configured to use email address or phone number as a sign-in alias.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

AdminDisableUser

$result = $client->adminDisableUser([/* ... */]);
$promise = $client->adminDisableUserAsync([/* ... */]);

Deactivates a user profile and revokes all access tokens for the user. A deactivated user can't sign in, but still appears in the responses to ListUsers API requests.

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

Learn more

Parameter Syntax

$result = $client->adminDisableUser([
    'UserPoolId' => '<string>', // REQUIRED
    'Username' => '<string>', // REQUIRED
]);

Parameter Details

Members
UserPoolId
Required: Yes
Type: string

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

Username
Required: Yes
Type: string

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

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

UserNotFoundException:

This exception is thrown when a user isn't found.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

AdminEnableUser

$result = $client->adminEnableUser([/* ... */]);
$promise = $client->adminEnableUserAsync([/* ... */]);

Activate sign-in for a user profile that previously had sign-in access disabled.

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

Learn more

Parameter Syntax

$result = $client->adminEnableUser([
    'UserPoolId' => '<string>', // REQUIRED
    'Username' => '<string>', // REQUIRED
]);

Parameter Details

Members
UserPoolId
Required: Yes
Type: string

The ID of the user pool where you want to activate sign-in for the user.

Username
Required: Yes
Type: string

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

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

UserNotFoundException:

This exception is thrown when a user isn't found.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

AdminForgetDevice

$result = $client->adminForgetDevice([/* ... */]);
$promise = $client->adminForgetDeviceAsync([/* ... */]);

Forgets, or deletes, a remembered device from a user's profile. After you forget the device, the user can no longer complete device authentication with that device and when applicable, must submit MFA codes again. For more information, see Working with devices.

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

Learn more

Parameter Syntax

$result = $client->adminForgetDevice([
    'DeviceKey' => '<string>', // REQUIRED
    'UserPoolId' => '<string>', // REQUIRED
    'Username' => '<string>', // REQUIRED
]);

Parameter Details

Members
DeviceKey
Required: Yes
Type: string

The key ID of the device that you want to delete. You can get device keys in the response to an AdminListDevices request.

UserPoolId
Required: Yes
Type: string

The ID of the user pool where the device owner is a user.

Username
Required: Yes
Type: string

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

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

InvalidUserPoolConfigurationException:

This exception is thrown when the user pool configuration is not valid.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

UserNotFoundException:

This exception is thrown when a user isn't found.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

AdminGetDevice

$result = $client->adminGetDevice([/* ... */]);
$promise = $client->adminGetDeviceAsync([/* ... */]);

Given the device key, returns details for a user' device. For more information, see Working with devices.

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

Learn more

Parameter Syntax

$result = $client->adminGetDevice([
    'DeviceKey' => '<string>', // REQUIRED
    'UserPoolId' => '<string>', // REQUIRED
    'Username' => '<string>', // REQUIRED
]);

Parameter Details

Members
DeviceKey
Required: Yes
Type: string

The key of the device that you want to delete. You can get device IDs in the response to an AdminListDevices request.

UserPoolId
Required: Yes
Type: string

The ID of the user pool where the device owner is a user.

Username
Required: Yes
Type: string

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

Result Syntax

[
    'Device' => [
        'DeviceAttributes' => [
            [
                'Name' => '<string>',
                'Value' => '<string>',
            ],
            // ...
        ],
        'DeviceCreateDate' => <DateTime>,
        'DeviceKey' => '<string>',
        'DeviceLastAuthenticatedDate' => <DateTime>,
        'DeviceLastModifiedDate' => <DateTime>,
    ],
]

Result Details

Members
Device
Required: Yes
Type: DeviceType structure

Details of the requested device. Includes device information, last-accessed and created dates, and the device key.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

InvalidUserPoolConfigurationException:

This exception is thrown when the user pool configuration is not valid.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

AdminGetUser

$result = $client->adminGetUser([/* ... */]);
$promise = $client->adminGetUserAsync([/* ... */]);

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

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

Learn more

Parameter Syntax

$result = $client->adminGetUser([
    'UserPoolId' => '<string>', // REQUIRED
    'Username' => '<string>', // REQUIRED
]);

Parameter Details

Members
UserPoolId
Required: Yes
Type: string

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

Username
Required: Yes
Type: string

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

Result Syntax

[
    'Enabled' => true || false,
    'MFAOptions' => [
        [
            'AttributeName' => '<string>',
            'DeliveryMedium' => 'SMS|EMAIL',
        ],
        // ...
    ],
    'PreferredMfaSetting' => '<string>',
    'UserAttributes' => [
        [
            'Name' => '<string>',
            'Value' => '<string>',
        ],
        // ...
    ],
    'UserCreateDate' => <DateTime>,
    'UserLastModifiedDate' => <DateTime>,
    'UserMFASettingList' => ['<string>', ...],
    'UserStatus' => 'UNCONFIRMED|CONFIRMED|ARCHIVED|COMPROMISED|UNKNOWN|RESET_REQUIRED|FORCE_CHANGE_PASSWORD|EXTERNAL_PROVIDER',
    'Username' => '<string>',
]

Result Details

Members
Enabled
Type: boolean

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

MFAOptions
Type: Array of MFAOptionType structures

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.

PreferredMfaSetting
Type: string

The user's preferred MFA. Users can prefer SMS message, email message, or TOTP MFA.

UserAttributes
Type: Array of AttributeType structures

An array of name-value pairs of user attributes and their values, for example "email": "testuser@example.com".

UserCreateDate
Type: timestamp (string|DateTime or anything parsable by strtotime)

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

UserLastModifiedDate
Type: timestamp (string|DateTime or anything parsable by strtotime)

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

UserMFASettingList
Type: Array of strings

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

UserStatus
Type: string

The user's status. Can be one of the following:

  • UNCONFIRMED - User has been created but not confirmed.

  • CONFIRMED - User has been confirmed.

  • UNKNOWN - User status isn't known.

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

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

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

Username
Required: Yes
Type: string

The username of the user that you requested.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

UserNotFoundException:

This exception is thrown when a user isn't found.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

AdminInitiateAuth

$result = $client->adminInitiateAuth([/* ... */]);
$promise = $client->adminInitiateAuthAsync([/* ... */]);

Starts sign-in for applications with a server-side component, for example a traditional web application. This operation specifies the authentication flow that you'd like to begin. The authentication flow that you specify must be supported in your app client configuration. For more information about authentication flows, see Authentication flows.

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 Services 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.

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

Learn more

Parameter Syntax

$result = $client->adminInitiateAuth([
    'AnalyticsMetadata' => [
        'AnalyticsEndpointId' => '<string>',
    ],
    'AuthFlow' => 'USER_SRP_AUTH|REFRESH_TOKEN_AUTH|REFRESH_TOKEN|CUSTOM_AUTH|ADMIN_NO_SRP_AUTH|USER_PASSWORD_AUTH|ADMIN_USER_PASSWORD_AUTH|USER_AUTH', // REQUIRED
    'AuthParameters' => ['<string>', ...],
    'ClientId' => '<string>', // REQUIRED
    'ClientMetadata' => ['<string>', ...],
    'ContextData' => [
        'EncodedData' => '<string>',
        'HttpHeaders' => [ // REQUIRED
            [
                'headerName' => '<string>',
                'headerValue' => '<string>',
            ],
            // ...
        ],
        'IpAddress' => '<string>', // REQUIRED
        'ServerName' => '<string>', // REQUIRED
        'ServerPath' => '<string>', // REQUIRED
    ],
    'Session' => '<string>',
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
AnalyticsMetadata
Type: AnalyticsMetadataType structure

The analytics metadata for collecting Amazon Pinpoint metrics.

AuthFlow
Required: Yes
Type: string

The authentication flow that you want to initiate. Each AuthFlow has linked AuthParameters that you must submit. The following are some example flows and their parameters.

  • USER_AUTH: Request a preferred authentication type or review available authentication types. From the offered authentication types, select one in a challenge response and then authenticate with that method in an additional challenge response.

  • REFRESH_TOKEN_AUTH: Receive new ID and access tokens when you pass a REFRESH_TOKEN parameter with a valid refresh token as the value.

  • USER_SRP_AUTH: Receive secure remote password (SRP) variables for the next challenge, PASSWORD_VERIFIER, when you pass USERNAME and SRP_A parameters..

  • ADMIN_USER_PASSWORD_AUTH: Receive new tokens or the next challenge, for example SOFTWARE_TOKEN_MFA, when you pass USERNAME and PASSWORD parameters.

All flows

USER_AUTH

The entry point for sign-in with passwords, one-time passwords, and WebAuthN authenticators.

USER_SRP_AUTH

Username-password authentication with the Secure Remote Password (SRP) protocol. For more information, see Use SRP password verification in custom authentication flow.

REFRESH_TOKEN_AUTH and REFRESH_TOKEN

Provide a valid refresh token and receive new ID and access tokens. For more information, see Using the refresh token.

CUSTOM_AUTH

Custom authentication with Lambda triggers. For more information, see Custom authentication challenge Lambda triggers.

ADMIN_USER_PASSWORD_AUTH

Username-password authentication with the password sent directly in the request. For more information, see Admin authentication flow.

USER_PASSWORD_AUTH is a flow type of InitiateAuth and isn't valid for AdminInitiateAuth.

AuthParameters
Type: Associative array of custom strings keys (StringType) to strings

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_AUTH: USERNAME (required), PREFERRED_CHALLENGE. If you don't provide a value for PREFERRED_CHALLENGE, Amazon Cognito responds with the AvailableChallenges parameter that specifies the available sign-in methods.

  • 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 ADMIN_USER_PASSWORD_AUTH: USERNAME (required), PASSWORD (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).

For more information about SECRET_HASH, see Computing secret hash values. For information about DEVICE_KEY, see Working with user devices in your user pool.

ClientId
Required: Yes
Type: string

The ID of the app client where the user wants to sign in.

ClientMetadata
Type: Associative array of custom strings keys (StringType) to strings

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

  • Custom email sender

  • Custom SMS sender

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

When you use the ClientMetadata parameter, note 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 send sensitive information in this parameter.

ContextData
Type: ContextDataType structure

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.

For more information, see Collecting data for threat protection in applications.

Session
Type: string

The optional session ID from a ConfirmSignUp API request. You can sign in a user directly from the sign-up process with an AuthFlow of USER_AUTH and AuthParameters of EMAIL_OTP or SMS_OTP, depending on how your user pool sent the confirmation-code message.

UserPoolId
Required: Yes
Type: string

The ID of the user pool where the user wants to sign in.

Result Syntax

[
    'AuthenticationResult' => [
        'AccessToken' => '<string>',
        'ExpiresIn' => <integer>,
        'IdToken' => '<string>',
        'NewDeviceMetadata' => [
            'DeviceGroupKey' => '<string>',
            'DeviceKey' => '<string>',
        ],
        'RefreshToken' => '<string>',
        'TokenType' => '<string>',
    ],
    'ChallengeName' => 'SMS_MFA|EMAIL_OTP|SOFTWARE_TOKEN_MFA|SELECT_MFA_TYPE|MFA_SETUP|PASSWORD_VERIFIER|CUSTOM_CHALLENGE|SELECT_CHALLENGE|DEVICE_SRP_AUTH|DEVICE_PASSWORD_VERIFIER|ADMIN_NO_SRP_AUTH|NEW_PASSWORD_REQUIRED|SMS_OTP|PASSWORD|WEB_AUTHN|PASSWORD_SRP',
    'ChallengeParameters' => ['<string>', ...],
    'Session' => '<string>',
]

Result Details

Members
AuthenticationResult
Type: AuthenticationResultType structure

The outcome of successful authentication. This is only returned if the user pool has no additional challenges to return. If Amazon Cognito returns another challenge, the response includes ChallengeName, ChallengeParameters, and Session so that your user can answer the challenge.

ChallengeName
Type: 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.

  • WEB_AUTHN: Respond to the challenge with the results of a successful authentication with a passkey, or webauthN, factor. These are typically biometric devices or security keys.

  • PASSWORD: Respond with USER_PASSWORD_AUTH parameters: USERNAME (required), PASSWORD (required), SECRET_HASH (required if the app client is configured with a client secret), DEVICE_KEY.

  • PASSWORD_SRP: Respond with USER_SRP_AUTH parameters: USERNAME (required), SRP_A (required), SECRET_HASH (required if the app client is configured with a client secret), DEVICE_KEY.

  • SELECT_CHALLENGE: Respond to the challenge with USERNAME and an ANSWER that matches one of the challenge types in the AvailableChallenges response parameter.

  • 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 SMS message MFA, EMAIL_OTP for email message 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_CODEthat your user pool delivered in an SMS message.

  • EMAIL_OTP: Next challenge is to supply an EMAIL_OTP_CODE that your user pool delivered in an email message.

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

    Amazon Cognito only returns this challenge for users who have temporary passwords. Because of this, and because in some cases you can create users who don't have values for required attributes, take care to collect and submit required-attribute values for all users who don't have passwords. You can create a user in the Amazon Cognito console without, for example, a required birthdate attribute. The API response from Amazon Cognito won't prompt you to submit a birthdate for the user if they don't have a password.

    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 MFAS_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.

ChallengeParameters
Type: Associative array of custom strings keys (StringType) to strings

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.

Session
Type: string

The session that must be passed to challenge-response requests. If an AdminInitiateAuth or AdminRespondToAuthChallenge API request determines that the caller must pass another challenge, Amazon Cognito returns a session ID and the parameters of the next challenge. Pass this session Id in the Session parameter of AdminRespondToAuthChallenge.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

UnexpectedLambdaException:

This exception is thrown when Amazon Cognito encounters an unexpected exception with Lambda.

InvalidUserPoolConfigurationException:

This exception is thrown when the user pool configuration is not valid.

UserLambdaValidationException:

This exception is thrown when the Amazon Cognito service encounters a user validation exception with the Lambda service.

InvalidLambdaResponseException:

This exception is thrown when Amazon Cognito encounters an invalid Lambda response.

MFAMethodNotFoundException:

This exception is thrown when Amazon Cognito can't find a multi-factor authentication (MFA) method.

InvalidSmsRoleAccessPolicyException:

This exception is returned when the role provided for SMS configuration doesn't have permission to publish using Amazon SNS.

InvalidEmailRoleAccessPolicyException:

This exception is thrown when Amazon Cognito isn't allowed to use your email identity. HTTP status code: 400.

InvalidSmsRoleTrustRelationshipException:

This exception is thrown when the trust relationship is not valid for the role provided for SMS configuration. This can happen if you don't trust cognito-idp.amazonaws.com or the external ID provided in the role does not match what is provided in the SMS configuration for the user pool.

PasswordResetRequiredException:

This exception is thrown when a password reset is required.

UserNotFoundException:

This exception is thrown when a user isn't found.

UserNotConfirmedException:

This exception is thrown when a user isn't confirmed successfully.

AdminLinkProviderForUser

$result = $client->adminLinkProviderForUser([/* ... */]);
$promise = $client->adminLinkProviderForUserAsync([/* ... */]);

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.

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

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.

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

Learn more

Parameter Syntax

$result = $client->adminLinkProviderForUser([
    'DestinationUser' => [ // REQUIRED
        'ProviderAttributeName' => '<string>',
        'ProviderAttributeValue' => '<string>',
        'ProviderName' => '<string>',
    ],
    'SourceUser' => [ // REQUIRED
        'ProviderAttributeName' => '<string>',
        'ProviderAttributeValue' => '<string>',
        'ProviderName' => '<string>',
    ],
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
DestinationUser
Required: Yes
Type: ProviderUserIdentifierType structure

The existing user in the user pool that you want to assign to the external IdP user account. This user can be a local (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.

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

SourceUser
Required: Yes
Type: ProviderUserIdentifierType structure

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 OIDC, the ProviderAttributeName can be any mapped value from a claim in the ID token, or that your app retrieves from the userInfo endpoint. For SAML, the ProviderAttributeName can be any mapped value from a claim in the SAML assertion.

The following additional considerations apply to SourceUser for OIDC and SAML providers.

  • You must map the claim to a user pool attribute in your IdP configuration, and set the user pool attribute name as the value of ProviderAttributeName in your AdminLinkProviderForUser request. For example, email.

  • When you set ProviderAttributeName to Cognito_Subject, Amazon Cognito will automatically parse the default unique identifier found in the subject from the IdP token.

UserPoolId
Required: Yes
Type: string

The ID of the user pool where you want to link a federated identity.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

UserNotFoundException:

This exception is thrown when a user isn't found.

AliasExistsException:

This exception is thrown when a user tries to confirm the account with an email address or phone number that has already been supplied as an alias for a different user profile. This exception indicates that an account with this email address or phone already exists in a user pool that you've configured to use email address or phone number as a sign-in alias.

LimitExceededException:

This exception is thrown when a user exceeds the limit for a requested Amazon Web Services resource.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

AdminListDevices

$result = $client->adminListDevices([/* ... */]);
$promise = $client->adminListDevicesAsync([/* ... */]);

Lists a user's registered devices. Remembered devices are used in authentication services where you offer a "Remember me" option for users who you want to permit to sign in without MFA from a trusted device. Users can bypass MFA while your application performs device SRP authentication on the back end. For more information, see Working with devices.

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

Learn more

Parameter Syntax

$result = $client->adminListDevices([
    'Limit' => <integer>,
    'PaginationToken' => '<string>',
    'UserPoolId' => '<string>', // REQUIRED
    'Username' => '<string>', // REQUIRED
]);

Parameter Details

Members
Limit
Type: int

The maximum number of devices that you want Amazon Cognito to return in the response.

PaginationToken
Type: string

This API operation returns a limited number of results. The pagination token is an identifier that you can present in an additional API request with the same parameters. When you include the pagination token, Amazon Cognito returns the next set of items after the current list. Subsequent requests return a new pagination token. By use of this token, you can paginate through the full list of items.

UserPoolId
Required: Yes
Type: string

The ID of the user pool where the device owner is a user.

Username
Required: Yes
Type: string

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

Result Syntax

[
    'Devices' => [
        [
            'DeviceAttributes' => [
                [
                    'Name' => '<string>',
                    'Value' => '<string>',
                ],
                // ...
            ],
            'DeviceCreateDate' => <DateTime>,
            'DeviceKey' => '<string>',
            'DeviceLastAuthenticatedDate' => <DateTime>,
            'DeviceLastModifiedDate' => <DateTime>,
        ],
        // ...
    ],
    'PaginationToken' => '<string>',
]

Result Details

Members
Devices
Type: Array of DeviceType structures

An array of devices and their information. Each entry that's returned includes device information, last-accessed and created dates, and the device key.

PaginationToken
Type: string

The identifier that Amazon Cognito returned with the previous request to this operation. When you include a pagination token in your request, Amazon Cognito returns the next set of items in the list. By use of this token, you can paginate through the full list of items.

Errors

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidUserPoolConfigurationException:

This exception is thrown when the user pool configuration is not valid.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

AdminListGroupsForUser

$result = $client->adminListGroupsForUser([/* ... */]);
$promise = $client->adminListGroupsForUserAsync([/* ... */]);

Lists the groups that a user belongs to. User pool groups are identifiers that you can reference from the contents of ID and access tokens, and set preferred IAM roles for identity-pool authentication. For more information, see Adding groups to a user pool.

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

Learn more

Parameter Syntax

$result = $client->adminListGroupsForUser([
    'Limit' => <integer>,
    'NextToken' => '<string>',
    'UserPoolId' => '<string>', // REQUIRED
    'Username' => '<string>', // REQUIRED
]);

Parameter Details

Members
Limit
Type: int

The maximum number of groups that you want Amazon Cognito to return in the response.

NextToken
Type: string

This API operation returns a limited number of results. The pagination token is an identifier that you can present in an additional API request with the same parameters. When you include the pagination token, Amazon Cognito returns the next set of items after the current list. Subsequent requests return a new pagination token. By use of this token, you can paginate through the full list of items.

UserPoolId
Required: Yes
Type: string

The ID of the user pool where you want to view a user's groups.

Username
Required: Yes
Type: string

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

Result Syntax

[
    'Groups' => [
        [
            'CreationDate' => <DateTime>,
            'Description' => '<string>',
            'GroupName' => '<string>',
            'LastModifiedDate' => <DateTime>,
            'Precedence' => <integer>,
            'RoleArn' => '<string>',
            'UserPoolId' => '<string>',
        ],
        // ...
    ],
    'NextToken' => '<string>',
]

Result Details

Members
Groups
Type: Array of GroupType structures

An array of groups and information about them.

NextToken
Type: string

The identifier that Amazon Cognito returned with the previous request to this operation. When you include a pagination token in your request, Amazon Cognito returns the next set of items in the list. By use of this token, you can paginate through the full list of items.

Errors

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

UserNotFoundException:

This exception is thrown when a user isn't found.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

AdminListUserAuthEvents

$result = $client->adminListUserAuthEvents([/* ... */]);
$promise = $client->adminListUserAuthEventsAsync([/* ... */]);

Requests a history of user activity and any risks detected as part of Amazon Cognito threat protection. For more information, see Viewing user event history.

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

Learn more

Parameter Syntax

$result = $client->adminListUserAuthEvents([
    'MaxResults' => <integer>,
    'NextToken' => '<string>',
    'UserPoolId' => '<string>', // REQUIRED
    'Username' => '<string>', // REQUIRED
]);

Parameter Details

Members
MaxResults
Type: int

The maximum number of authentication events to return. Returns 60 events if you set MaxResults to 0, or if you don't include a MaxResults parameter.

NextToken
Type: string

This API operation returns a limited number of results. The pagination token is an identifier that you can present in an additional API request with the same parameters. When you include the pagination token, Amazon Cognito returns the next set of items after the current list. Subsequent requests return a new pagination token. By use of this token, you can paginate through the full list of items.

UserPoolId
Required: Yes
Type: string

The Id of the user pool that contains the user profile with the logged events.

Username
Required: Yes
Type: string

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

Result Syntax

[
    'AuthEvents' => [
        [
            'ChallengeResponses' => [
                [
                    'ChallengeName' => 'Password|Mfa',
                    'ChallengeResponse' => 'Success|Failure',
                ],
                // ...
            ],
            'CreationDate' => <DateTime>,
            'EventContextData' => [
                'City' => '<string>',
                'Country' => '<string>',
                'DeviceName' => '<string>',
                'IpAddress' => '<string>',
                'Timezone' => '<string>',
            ],
            'EventFeedback' => [
                'FeedbackDate' => <DateTime>,
                'FeedbackValue' => 'Valid|Invalid',
                'Provider' => '<string>',
            ],
            'EventId' => '<string>',
            'EventResponse' => 'Pass|Fail|InProgress',
            'EventRisk' => [
                'CompromisedCredentialsDetected' => true || false,
                'RiskDecision' => 'NoRisk|AccountTakeover|Block',
                'RiskLevel' => 'Low|Medium|High',
            ],
            'EventType' => 'SignIn|SignUp|ForgotPassword|PasswordChange|ResendCode',
        ],
        // ...
    ],
    'NextToken' => '<string>',
]

Result Details

Members
AuthEvents
Type: Array of AuthEventType structures

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

NextToken
Type: string

The identifier that Amazon Cognito returned with the previous request to this operation. When you include a pagination token in your request, Amazon Cognito returns the next set of items in the list. By use of this token, you can paginate through the full list of items.

Errors

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

UserNotFoundException:

This exception is thrown when a user isn't found.

UserPoolAddOnNotEnabledException:

This exception is thrown when user pool add-ons aren't enabled.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

AdminRemoveUserFromGroup

$result = $client->adminRemoveUserFromGroup([/* ... */]);
$promise = $client->adminRemoveUserFromGroupAsync([/* ... */]);

Given a username and a group name. removes them from the group. User pool groups are identifiers that you can reference from the contents of ID and access tokens, and set preferred IAM roles for identity-pool authentication. For more information, see Adding groups to a user pool.

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

Learn more

Parameter Syntax

$result = $client->adminRemoveUserFromGroup([
    'GroupName' => '<string>', // REQUIRED
    'UserPoolId' => '<string>', // REQUIRED
    'Username' => '<string>', // REQUIRED
]);

Parameter Details

Members
GroupName
Required: Yes
Type: string

The name of the group that you want to remove the user from, for example MyTestGroup.

UserPoolId
Required: Yes
Type: string

The ID of the user pool that contains the group and the user that you want to remove.

Username
Required: Yes
Type: string

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

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

UserNotFoundException:

This exception is thrown when a user isn't found.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

AdminResetUserPassword

$result = $client->adminResetUserPassword([/* ... */]);
$promise = $client->adminResetUserPasswordAsync([/* ... */]);

Resets the specified user's password in a user pool. This operation doesn't change the user's password, but sends a password-reset code. This operation is the administrative authentication API equivalent to ForgotPassword.

This operation deactivates a user's password, requiring them to change it. If a user tries to sign in after the API request, Amazon Cognito responds with a PasswordResetRequiredException error. Your app must then complete the forgot-password flow by prompting the user for their code and a new password, then submitting those values in a ConfirmForgotPassword request. 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.

To use this API operation, your user pool must have self-service account recovery configured. Use AdminSetUserPassword if you manage passwords as an administrator.

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 Services 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.

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

Learn more

Parameter Syntax

$result = $client->adminResetUserPassword([
    'ClientMetadata' => ['<string>', ...],
    'UserPoolId' => '<string>', // REQUIRED
    'Username' => '<string>', // REQUIRED
]);

Parameter Details

Members
ClientMetadata
Type: Associative array of custom strings keys (StringType) to strings

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. The AdminResetUserPassword API operation 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.

When you use the ClientMetadata parameter, note 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 send sensitive information in this parameter.

UserPoolId
Required: Yes
Type: string

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

Username
Required: Yes
Type: string

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

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

UnexpectedLambdaException:

This exception is thrown when Amazon Cognito encounters an unexpected exception with Lambda.

UserLambdaValidationException:

This exception is thrown when the Amazon Cognito service encounters a user validation exception with the Lambda service.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

InvalidLambdaResponseException:

This exception is thrown when Amazon Cognito encounters an invalid Lambda response.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

LimitExceededException:

This exception is thrown when a user exceeds the limit for a requested Amazon Web Services resource.

UserNotFoundException:

This exception is thrown when a user isn't found.

InvalidSmsRoleAccessPolicyException:

This exception is returned when the role provided for SMS configuration doesn't have permission to publish using Amazon SNS.

InvalidEmailRoleAccessPolicyException:

This exception is thrown when Amazon Cognito isn't allowed to use your email identity. HTTP status code: 400.

InvalidSmsRoleTrustRelationshipException:

This exception is thrown when the trust relationship is not valid for the role provided for SMS configuration. This can happen if you don't trust cognito-idp.amazonaws.com or the external ID provided in the role does not match what is provided in the SMS configuration for the user pool.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

AdminRespondToAuthChallenge

$result = $client->adminRespondToAuthChallenge([/* ... */]);
$promise = $client->adminRespondToAuthChallengeAsync([/* ... */]);

Some API operations in a user pool generate a challenge, like a prompt for an MFA code, for device authentication that bypasses MFA, or for a custom authentication challenge. An AdminRespondToAuthChallenge API request provides the answer to that challenge, like a code or a secure remote password (SRP). The parameters of a response to an authentication challenge vary with the type of challenge.

For more information about custom authentication challenges, see Custom authentication challenge Lambda triggers.

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 Services 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.

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

Learn more

Parameter Syntax

$result = $client->adminRespondToAuthChallenge([
    'AnalyticsMetadata' => [
        'AnalyticsEndpointId' => '<string>',
    ],
    'ChallengeName' => 'SMS_MFA|EMAIL_OTP|SOFTWARE_TOKEN_MFA|SELECT_MFA_TYPE|MFA_SETUP|PASSWORD_VERIFIER|CUSTOM_CHALLENGE|SELECT_CHALLENGE|DEVICE_SRP_AUTH|DEVICE_PASSWORD_VERIFIER|ADMIN_NO_SRP_AUTH|NEW_PASSWORD_REQUIRED|SMS_OTP|PASSWORD|WEB_AUTHN|PASSWORD_SRP', // REQUIRED
    'ChallengeResponses' => ['<string>', ...],
    'ClientId' => '<string>', // REQUIRED
    'ClientMetadata' => ['<string>', ...],
    'ContextData' => [
        'EncodedData' => '<string>',
        'HttpHeaders' => [ // REQUIRED
            [
                'headerName' => '<string>',
                'headerValue' => '<string>',
            ],
            // ...
        ],
        'IpAddress' => '<string>', // REQUIRED
        'ServerName' => '<string>', // REQUIRED
        'ServerPath' => '<string>', // REQUIRED
    ],
    'Session' => '<string>',
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
AnalyticsMetadata
Type: AnalyticsMetadataType structure

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

ChallengeName
Required: Yes
Type: string

The name of the challenge that you are responding to. You can find more information about values for ChallengeName in the response parameters of AdminInitiateAuth.

ChallengeResponses
Type: Associative array of custom strings keys (StringType) to strings

The responses to the challenge that you received in the previous request. Each challenge has its own required response parameters. The following examples are partial JSON request bodies that highlight challenge-response parameters.

You must provide a SECRET_HASH parameter in all challenge responses to an app client that has a client secret. Include a DEVICE_KEY for device authentication.

SELECT_CHALLENGE

"ChallengeName": "SELECT_CHALLENGE", "ChallengeResponses": { "USERNAME": "[username]", "ANSWER": "[Challenge name]"}

Available challenges are PASSWORD, PASSWORD_SRP, EMAIL_OTP, SMS_OTP, and WEB_AUTHN.

Complete authentication in the SELECT_CHALLENGE response for PASSWORD, PASSWORD_SRP, and WEB_AUTHN:

  • "ChallengeName": "SELECT_CHALLENGE", "ChallengeResponses": { "ANSWER": "WEB_AUTHN", "USERNAME": "[username]", "CREDENTIAL": "[AuthenticationResponseJSON]"}

    See AuthenticationResponseJSON.

  • "ChallengeName": "SELECT_CHALLENGE", "ChallengeResponses": { "ANSWER": "PASSWORD", "USERNAME": "[username]", "PASSWORD": "[password]"}

  • "ChallengeName": "SELECT_CHALLENGE", "ChallengeResponses": { "ANSWER": "PASSWORD_SRP", "USERNAME": "[username]", "SRP_A": "[SRP_A]"}

For SMS_OTP and EMAIL_OTP, respond with the username and answer. Your user pool will send a code for the user to submit in the next challenge response.

  • "ChallengeName": "SELECT_CHALLENGE", "ChallengeResponses": { "ANSWER": "SMS_OTP", "USERNAME": "[username]"}

  • "ChallengeName": "SELECT_CHALLENGE", "ChallengeResponses": { "ANSWER": "EMAIL_OTP", "USERNAME": "[username]"}

SMS_OTP

"ChallengeName": "SMS_OTP", "ChallengeResponses": {"SMS_OTP_CODE": "[code]", "USERNAME": "[username]"}

EMAIL_OTP

"ChallengeName": "EMAIL_OTP", "ChallengeResponses": {"EMAIL_OTP_CODE": "[code]", "USERNAME": "[username]"}

SMS_MFA

"ChallengeName": "SMS_MFA", "ChallengeResponses": {"SMS_MFA_CODE": "[code]", "USERNAME": "[username]"}

PASSWORD_VERIFIER

This challenge response is part of the SRP flow. Amazon Cognito requires that your application respond to this challenge within a few seconds. When the response time exceeds this period, your user pool returns a NotAuthorizedException error.

"ChallengeName": "PASSWORD_VERIFIER", "ChallengeResponses": {"PASSWORD_CLAIM_SIGNATURE": "[claim_signature]", "PASSWORD_CLAIM_SECRET_BLOCK": "[secret_block]", "TIMESTAMP": [timestamp], "USERNAME": "[username]"}

Add "DEVICE_KEY" when you sign in with a remembered device.

CUSTOM_CHALLENGE

"ChallengeName": "CUSTOM_CHALLENGE", "ChallengeResponses": {"USERNAME": "[username]", "ANSWER": "[challenge_answer]"}

Add "DEVICE_KEY" when you sign in with a remembered device.

NEW_PASSWORD_REQUIRED

"ChallengeName": "NEW_PASSWORD_REQUIRED", "ChallengeResponses": {"NEW_PASSWORD": "[new_password]", "USERNAME": "[username]"}

To set any required attributes that InitiateAuth returned in an requiredAttributes parameter, add "userAttributes.[attribute_name]": "[attribute_value]". This parameter can also set values for writable attributes that aren't required by your user pool.

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

"ChallengeName": "SOFTWARE_TOKEN_MFA", "ChallengeResponses": {"USERNAME": "[username]", "SOFTWARE_TOKEN_MFA_CODE": [authenticator_code]}

DEVICE_SRP_AUTH

"ChallengeName": "DEVICE_SRP_AUTH", "ChallengeResponses": {"USERNAME": "[username]", "DEVICE_KEY": "[device_key]", "SRP_A": "[srp_a]"}

DEVICE_PASSWORD_VERIFIER

"ChallengeName": "DEVICE_PASSWORD_VERIFIER", "ChallengeResponses": {"DEVICE_KEY": "[device_key]", "PASSWORD_CLAIM_SIGNATURE": "[claim_signature]", "PASSWORD_CLAIM_SECRET_BLOCK": "[secret_block]", "TIMESTAMP": [timestamp], "USERNAME": "[username]"}

MFA_SETUP

"ChallengeName": "MFA_SETUP", "ChallengeResponses": {"USERNAME": "[username]"}, "SESSION": "[Session ID from VerifySoftwareToken]"

SELECT_MFA_TYPE

"ChallengeName": "SELECT_MFA_TYPE", "ChallengeResponses": {"USERNAME": "[username]", "ANSWER": "[SMS_MFA or SOFTWARE_TOKEN_MFA]"}

For more information about SECRET_HASH, see Computing secret hash values. For information about DEVICE_KEY, see Working with user devices in your user pool.

ClientId
Required: Yes
Type: string

The ID of the app client where you initiated sign-in.

ClientMetadata
Type: Associative array of custom strings keys (StringType) to strings

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.

When you use the ClientMetadata parameter, note 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 send sensitive information in this parameter.

ContextData
Type: ContextDataType structure

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.

For more information, see Collecting data for threat protection in applications.

Session
Type: string

The session identifier that maintains the state of authentication requests and challenge responses. If an AdminInitiateAuth or AdminRespondToAuthChallenge API request results in a determination that your application must pass another challenge, Amazon Cognito returns a session with other challenge parameters. Send this session identifier, unmodified, to the next AdminRespondToAuthChallenge request.

UserPoolId
Required: Yes
Type: string

The ID of the user pool where you want to respond to an authentication challenge.

Result Syntax

[
    'AuthenticationResult' => [
        'AccessToken' => '<string>',
        'ExpiresIn' => <integer>,
        'IdToken' => '<string>',
        'NewDeviceMetadata' => [
            'DeviceGroupKey' => '<string>',
            'DeviceKey' => '<string>',
        ],
        'RefreshToken' => '<string>',
        'TokenType' => '<string>',
    ],
    'ChallengeName' => 'SMS_MFA|EMAIL_OTP|SOFTWARE_TOKEN_MFA|SELECT_MFA_TYPE|MFA_SETUP|PASSWORD_VERIFIER|CUSTOM_CHALLENGE|SELECT_CHALLENGE|DEVICE_SRP_AUTH|DEVICE_PASSWORD_VERIFIER|ADMIN_NO_SRP_AUTH|NEW_PASSWORD_REQUIRED|SMS_OTP|PASSWORD|WEB_AUTHN|PASSWORD_SRP',
    'ChallengeParameters' => ['<string>', ...],
    'Session' => '<string>',
]

Result Details

Members
AuthenticationResult
Type: AuthenticationResultType structure

The outcome of a successful authentication process. After your application has passed all challenges, Amazon Cognito returns an AuthenticationResult with the JSON web tokens (JWTs) that indicate successful sign-in.

ChallengeName
Type: string

The name of the challenge that you must next respond to. You can find more information about values for ChallengeName in the response parameters of AdminInitiateAuth.

ChallengeParameters
Type: Associative array of custom strings keys (StringType) to strings

The parameters that define your response to the next challenge. Take the values in ChallengeParameters and provide values for them in the ChallengeResponses of the next AdminRespondToAuthChallenge request.

Session
Type: string

The session identifier that maintains the state of authentication requests and challenge responses. If an AdminInitiateAuth or AdminRespondToAuthChallenge API request results in a determination that your application must pass another challenge, Amazon Cognito returns a session with other challenge parameters. Send this session identifier, unmodified, to the next AdminRespondToAuthChallenge request.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

CodeMismatchException:

This exception is thrown if the provided code doesn't match what the server was expecting.

ExpiredCodeException:

This exception is thrown if a code has expired.

UnexpectedLambdaException:

This exception is thrown when Amazon Cognito encounters an unexpected exception with Lambda.

InvalidPasswordException:

This exception is thrown when Amazon Cognito encounters an invalid password.

PasswordHistoryPolicyViolationException:

The message returned when a user's new password matches a previous password and doesn't comply with the password-history policy.

UserLambdaValidationException:

This exception is thrown when the Amazon Cognito service encounters a user validation exception with the Lambda service.

InvalidLambdaResponseException:

This exception is thrown when Amazon Cognito encounters an invalid Lambda response.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

InvalidUserPoolConfigurationException:

This exception is thrown when the user pool configuration is not valid.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

MFAMethodNotFoundException:

This exception is thrown when Amazon Cognito can't find a multi-factor authentication (MFA) method.

InvalidEmailRoleAccessPolicyException:

This exception is thrown when Amazon Cognito isn't allowed to use your email identity. HTTP status code: 400.

InvalidSmsRoleAccessPolicyException:

This exception is returned when the role provided for SMS configuration doesn't have permission to publish using Amazon SNS.

InvalidSmsRoleTrustRelationshipException:

This exception is thrown when the trust relationship is not valid for the role provided for SMS configuration. This can happen if you don't trust cognito-idp.amazonaws.com or the external ID provided in the role does not match what is provided in the SMS configuration for the user pool.

AliasExistsException:

This exception is thrown when a user tries to confirm the account with an email address or phone number that has already been supplied as an alias for a different user profile. This exception indicates that an account with this email address or phone already exists in a user pool that you've configured to use email address or phone number as a sign-in alias.

PasswordResetRequiredException:

This exception is thrown when a password reset is required.

UserNotFoundException:

This exception is thrown when a user isn't found.

UserNotConfirmedException:

This exception is thrown when a user isn't confirmed successfully.

SoftwareTokenMFANotFoundException:

This exception is thrown when the software token time-based one-time password (TOTP) multi-factor authentication (MFA) isn't activated for the user pool.

AdminSetUserMFAPreference

$result = $client->adminSetUserMFAPreference([/* ... */]);
$promise = $client->adminSetUserMFAPreferenceAsync([/* ... */]);

Sets 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.

This operation doesn't reset an existing TOTP MFA for a user. To register a new TOTP factor for a user, make an AssociateSoftwareToken request. For more information, see TOTP software token MFA.

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

Learn more

Parameter Syntax

$result = $client->adminSetUserMFAPreference([
    'EmailMfaSettings' => [
        'Enabled' => true || false,
        'PreferredMfa' => true || false,
    ],
    'SMSMfaSettings' => [
        'Enabled' => true || false,
        'PreferredMfa' => true || false,
    ],
    'SoftwareTokenMfaSettings' => [
        'Enabled' => true || false,
        'PreferredMfa' => true || false,
    ],
    'UserPoolId' => '<string>', // REQUIRED
    'Username' => '<string>', // REQUIRED
]);

Parameter Details

Members
EmailMfaSettings
Type: EmailMfaSettingsType structure

User preferences for email message MFA. Activates or deactivates email MFA and sets it as the preferred MFA method when multiple methods are available. To activate this setting, advanced security features must be active in your user pool.

SMSMfaSettings
Type: SMSMfaSettingsType structure

User preferences for SMS message MFA. Activates or deactivates SMS MFA and sets it as the preferred MFA method when multiple methods are available.

SoftwareTokenMfaSettings

User preferences for time-based one-time password (TOTP) MFA. Activates or deactivates TOTP MFA and sets it as the preferred MFA method when multiple methods are available.

UserPoolId
Required: Yes
Type: string

The ID of the user pool where you want to set a user's MFA preferences.

Username
Required: Yes
Type: string

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

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

PasswordResetRequiredException:

This exception is thrown when a password reset is required.

UserNotFoundException:

This exception is thrown when a user isn't found.

UserNotConfirmedException:

This exception is thrown when a user isn't confirmed successfully.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

AdminSetUserPassword

$result = $client->adminSetUserPassword([/* ... */]);
$promise = $client->adminSetUserPasswordAsync([/* ... */]);

Sets the specified user's password in a user pool. This operation administratively sets a temporary or permanent password for a user. With this operation, you can bypass self-service password changes and permit immediate sign-in with the password that you set. To do this, set Permanent to true.

You can also set a new temporary password in this request, send it to a user, and require them to choose a new password on their next sign-in. To do this, set Permanent to false.

If the password is temporary, the user's Status becomes FORCE_CHANGE_PASSWORD. When the user next tries to sign in, the InitiateAuth or AdminInitiateAuth response includes the NEW_PASSWORD_REQUIRED challenge. If the user doesn't sign in before the temporary password expires, they can no longer sign in and you must repeat this operation to set a temporary or permanent password for them.

After the user sets a new password, or if you set a permanent password, their status becomes Confirmed.

AdminSetUserPassword can set a password for the user profile that Amazon Cognito creates for third-party federated users. When you set a password, the federated user's status changes from EXTERNAL_PROVIDER to CONFIRMED. A user in this state can sign in as a federated user, and initiate authentication flows in the API like a linked native user. They can also modify their password and attributes in token-authenticated API requests like ChangePassword and UpdateUserAttributes. As a best security practice and to keep users in sync with your external IdP, don't set passwords on federated user profiles. To set up a federated user for native sign-in with a linked native user, refer to Linking federated users to an existing user profile.

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

Learn more

Parameter Syntax

$result = $client->adminSetUserPassword([
    'Password' => '<string>', // REQUIRED
    'Permanent' => true || false,
    'UserPoolId' => '<string>', // REQUIRED
    'Username' => '<string>', // REQUIRED
]);

Parameter Details

Members
Password
Required: Yes
Type: string

The new temporary or permanent password that you want to set for the user. You can't remove the password for a user who already has a password so that they can only sign in with passwordless methods. In this scenario, you must create a new user without a password.

Permanent
Type: boolean

Set to true to set a password that the user can immediately sign in with. Set to false to set a temporary password that the user must change on their next sign-in.

UserPoolId
Required: Yes
Type: string

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

Username
Required: Yes
Type: string

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

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

UserNotFoundException:

This exception is thrown when a user isn't found.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

InvalidPasswordException:

This exception is thrown when Amazon Cognito encounters an invalid password.

PasswordHistoryPolicyViolationException:

The message returned when a user's new password matches a previous password and doesn't comply with the password-history policy.

AdminSetUserSettings

$result = $client->adminSetUserSettings([/* ... */]);
$promise = $client->adminSetUserSettingsAsync([/* ... */]);

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.

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

Learn more

Parameter Syntax

$result = $client->adminSetUserSettings([
    'MFAOptions' => [ // REQUIRED
        [
            'AttributeName' => '<string>',
            'DeliveryMedium' => 'SMS|EMAIL',
        ],
        // ...
    ],
    'UserPoolId' => '<string>', // REQUIRED
    'Username' => '<string>', // REQUIRED
]);

Parameter Details

Members
MFAOptions
Required: Yes
Type: Array of MFAOptionType structures

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

UserPoolId
Required: Yes
Type: string

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

Username
Required: Yes
Type: string

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

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

UserNotFoundException:

This exception is thrown when a user isn't found.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

AdminUpdateAuthEventFeedback

$result = $client->adminUpdateAuthEventFeedback([/* ... */]);
$promise = $client->adminUpdateAuthEventFeedbackAsync([/* ... */]);

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 threat protection. To train the threat-protection model to recognize trusted and untrusted sign-in characteristics, configure threat protection in audit-only mode and provide a mechanism for users or administrators to submit feedback. Your feedback can tell Amazon Cognito that a risk rating was assigned at a level you don't agree with.

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

Learn more

Parameter Syntax

$result = $client->adminUpdateAuthEventFeedback([
    'EventId' => '<string>', // REQUIRED
    'FeedbackValue' => 'Valid|Invalid', // REQUIRED
    'UserPoolId' => '<string>', // REQUIRED
    'Username' => '<string>', // REQUIRED
]);

Parameter Details

Members
EventId
Required: Yes
Type: string

The authentication event ID. To query authentication events for a user, see AdminListUserAuthEvents.

FeedbackValue
Required: Yes
Type: string

The authentication event feedback value. When you provide a FeedbackValue value of valid, you tell Amazon Cognito that you trust a user session where Amazon Cognito has evaluated some level of risk. When you provide a FeedbackValue value of invalid, you tell Amazon Cognito that you don't trust a user session, or you don't believe that Amazon Cognito evaluated a high-enough risk level.

UserPoolId
Required: Yes
Type: string

The ID of the user pool where you want to submit authentication-event feedback.

Username
Required: Yes
Type: string

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

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

UserNotFoundException:

This exception is thrown when a user isn't found.

UserPoolAddOnNotEnabledException:

This exception is thrown when user pool add-ons aren't enabled.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

AdminUpdateDeviceStatus

$result = $client->adminUpdateDeviceStatus([/* ... */]);
$promise = $client->adminUpdateDeviceStatusAsync([/* ... */]);

Updates the status of a user's device so that it is marked as remembered or not remembered for the purpose of device authentication. Device authentication is a "remember me" mechanism that silently completes sign-in from trusted devices with a device key instead of a user-provided MFA code. This operation changes the status of a device without deleting it, so you can enable it again later. For more information about device authentication, see Working with devices.

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

Learn more

Parameter Syntax

$result = $client->adminUpdateDeviceStatus([
    'DeviceKey' => '<string>', // REQUIRED
    'DeviceRememberedStatus' => 'remembered|not_remembered',
    'UserPoolId' => '<string>', // REQUIRED
    'Username' => '<string>', // REQUIRED
]);

Parameter Details

Members
DeviceKey
Required: Yes
Type: string

The unique identifier, or device key, of the device that you want to update the status for.

DeviceRememberedStatus
Type: string

To enable device authentication with the specified device, set to remembered.To disable, set to not_remembered.

UserPoolId
Required: Yes
Type: string

The ID of the user pool where you want to change a user's device status.

Username
Required: Yes
Type: string

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

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidUserPoolConfigurationException:

This exception is thrown when the user pool configuration is not valid.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

UserNotFoundException:

This exception is thrown when a user isn't found.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

AdminUpdateUserAttributes

$result = $client->adminUpdateUserAttributes([/* ... */]);
$promise = $client->adminUpdateUserAttributesAsync([/* ... */]);

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 Services 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.

Updates the specified user's attributes. To delete an attribute from your user, submit the attribute in your API request with a blank value.

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

This operation can set a user's email address or phone number as verified and permit immediate sign-in in user pools that require verification of these attributes. To do this, set the email_verified or phone_number_verified attribute to true.

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

Learn more

Parameter Syntax

$result = $client->adminUpdateUserAttributes([
    'ClientMetadata' => ['<string>', ...],
    'UserAttributes' => [ // REQUIRED
        [
            'Name' => '<string>', // REQUIRED
            'Value' => '<string>',
        ],
        // ...
    ],
    'UserPoolId' => '<string>', // REQUIRED
    'Username' => '<string>', // REQUIRED
]);

Parameter Details

Members
ClientMetadata
Type: Associative array of custom strings keys (StringType) to strings

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.

When you use the ClientMetadata parameter, note 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 send sensitive information in this parameter.

UserAttributes
Required: Yes
Type: Array of AttributeType structures

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 skip the verification message and 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.

UserPoolId
Required: Yes
Type: string

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

Username
Required: Yes
Type: string

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

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

UnexpectedLambdaException:

This exception is thrown when Amazon Cognito encounters an unexpected exception with Lambda.

UserLambdaValidationException:

This exception is thrown when the Amazon Cognito service encounters a user validation exception with the Lambda service.

InvalidLambdaResponseException:

This exception is thrown when Amazon Cognito encounters an invalid Lambda response.

AliasExistsException:

This exception is thrown when a user tries to confirm the account with an email address or phone number that has already been supplied as an alias for a different user profile. This exception indicates that an account with this email address or phone already exists in a user pool that you've configured to use email address or phone number as a sign-in alias.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

UserNotFoundException:

This exception is thrown when a user isn't found.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

InvalidSmsRoleAccessPolicyException:

This exception is returned when the role provided for SMS configuration doesn't have permission to publish using Amazon SNS.

InvalidEmailRoleAccessPolicyException:

This exception is thrown when Amazon Cognito isn't allowed to use your email identity. HTTP status code: 400.

InvalidSmsRoleTrustRelationshipException:

This exception is thrown when the trust relationship is not valid for the role provided for SMS configuration. This can happen if you don't trust cognito-idp.amazonaws.com or the external ID provided in the role does not match what is provided in the SMS configuration for the user pool.

AdminUserGlobalSignOut

$result = $client->adminUserGlobalSignOut([/* ... */]);
$promise = $client->adminUserGlobalSignOutAsync([/* ... */]);

Invalidates the identity, access, and refresh tokens that Amazon Cognito issued to a user. Call this operation with your administrative credentials when your user signs out of your app. This results in the following behavior.

  • Amazon Cognito no longer accepts token-authorized user operations that you authorize with a signed-out user's access tokens. For more information, see Using the Amazon Cognito user pools API and user pool endpoints.

    Amazon Cognito returns an Access Token has been revoked error when your app attempts to authorize a user pools API request with a revoked access token that contains the scope aws.cognito.signin.user.admin.

  • Amazon Cognito no longer accepts a signed-out user's ID token in a GetId request to an identity pool with ServerSideTokenCheck enabled for its user pool IdP configuration in CognitoIdentityProvider.

  • Amazon Cognito no longer accepts a signed-out user's refresh tokens in refresh requests.

Other requests might be valid until your user's token expires. This operation doesn't clear the managed login session cookie. To clear the session for a user who signed in with managed login or the classic hosted UI, direct their browser session to the logout endpoint.

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

Learn more

Parameter Syntax

$result = $client->adminUserGlobalSignOut([
    'UserPoolId' => '<string>', // REQUIRED
    'Username' => '<string>', // REQUIRED
]);

Parameter Details

Members
UserPoolId
Required: Yes
Type: string

The ID of the user pool where you want to sign out a user.

Username
Required: Yes
Type: string

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

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

UserNotFoundException:

This exception is thrown when a user isn't found.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

AssociateSoftwareToken

$result = $client->associateSoftwareToken([/* ... */]);
$promise = $client->associateSoftwareTokenAsync([/* ... */]);

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.

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 in. 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.

Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.

Authorize this action with a signed-in user's access token. It must include the scope aws.cognito.signin.user.admin.

Parameter Syntax

$result = $client->associateSoftwareToken([
    'AccessToken' => '<string>',
    'Session' => '<string>',
]);

Parameter Details

Members
AccessToken
Type: string

A valid access token that Amazon Cognito issued to the user whose software token you want to generate. You can provide either an access token or a session ID in the request.

Session
Type: string

The session identifier that maintains the state of authentication requests and challenge responses. In AssociateSoftwareToken, this is the session ID from a successful sign-in. You can provide either an access token or a session ID in the request.

Result Syntax

[
    'SecretCode' => '<string>',
    'Session' => '<string>',
]

Result Details

Members
SecretCode
Type: string

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

Session
Type: string

The session identifier that maintains the state of authentication requests and challenge responses. This session ID is valid for the next request in this flow, VerifySoftwareToken.

Errors

ConcurrentModificationException:

This exception is thrown if two or more modifications are happening concurrently.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

SoftwareTokenMFANotFoundException:

This exception is thrown when the software token time-based one-time password (TOTP) multi-factor authentication (MFA) isn't activated for the user pool.

ForbiddenException:

This exception is thrown when WAF doesn't allow your request based on a web ACL that's associated with your user pool.

ChangePassword

$result = $client->changePassword([/* ... */]);
$promise = $client->changePasswordAsync([/* ... */]);

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

Authorize this action with a signed-in user's access token. It must include the scope aws.cognito.signin.user.admin.

Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.

Parameter Syntax

$result = $client->changePassword([
    'AccessToken' => '<string>', // REQUIRED
    'PreviousPassword' => '<string>',
    'ProposedPassword' => '<string>', // REQUIRED
]);

Parameter Details

Members
AccessToken
Required: Yes
Type: string

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

PreviousPassword
Type: string

The user's previous password. Required if the user has a password. If the user has no password and only signs in with passwordless authentication options, you can omit this parameter.

ProposedPassword
Required: Yes
Type: string

A new password that you prompted the user to enter in your application.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

InvalidPasswordException:

This exception is thrown when Amazon Cognito encounters an invalid password.

PasswordHistoryPolicyViolationException:

The message returned when a user's new password matches a previous password and doesn't comply with the password-history policy.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

LimitExceededException:

This exception is thrown when a user exceeds the limit for a requested Amazon Web Services resource.

PasswordResetRequiredException:

This exception is thrown when a password reset is required.

UserNotFoundException:

This exception is thrown when a user isn't found.

UserNotConfirmedException:

This exception is thrown when a user isn't confirmed successfully.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

ForbiddenException:

This exception is thrown when WAF doesn't allow your request based on a web ACL that's associated with your user pool.

CompleteWebAuthnRegistration

$result = $client->completeWebAuthnRegistration([/* ... */]);
$promise = $client->completeWebAuthnRegistrationAsync([/* ... */]);

Completes registration of a passkey authenticator for the current user. Your application provides data from a successful registration request with the data from the output of a StartWebAuthnRegistration.

Authorize this action with a signed-in user's access token. It must include the scope aws.cognito.signin.user.admin.

Parameter Syntax

$result = $client->completeWebAuthnRegistration([
    'AccessToken' => '<string>', // REQUIRED
    'Credential' => [ // REQUIRED
    ],
]);

Parameter Details

Members
AccessToken
Required: Yes
Type: string

A valid access token that Amazon Cognito issued to the user whose passkey registration you want to complete.

Credential
Required: Yes
Type: document (null|bool|string|numeric) or an (array|associative array) whose members are all valid documents

A RegistrationResponseJSON public-key credential response from the user's passkey provider.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ForbiddenException:

This exception is thrown when WAF doesn't allow your request based on a web ACL that's associated with your user pool.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

LimitExceededException:

This exception is thrown when a user exceeds the limit for a requested Amazon Web Services resource.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

WebAuthnNotEnabledException:

This exception is thrown when the passkey feature isn't enabled for the user pool.

WebAuthnChallengeNotFoundException:

This exception is thrown when the challenge from StartWebAuthn registration has expired.

WebAuthnRelyingPartyMismatchException:

This exception is thrown when the given passkey credential is associated with a different relying party ID than the user pool relying party ID.

WebAuthnClientMismatchException:

This exception is thrown when the access token is for a different client than the one in the original StartWebAuthnRegistration request.

WebAuthnOriginNotAllowedException:

This exception is thrown when the passkey credential's registration origin does not align with the user pool relying party id.

WebAuthnCredentialNotSupportedException:

This exception is thrown when a user presents passkey credentials from an unsupported device or provider.

ConfirmDevice

$result = $client->confirmDevice([/* ... */]);
$promise = $client->confirmDeviceAsync([/* ... */]);

Confirms a device that a user wants to remember. A remembered device is a "Remember me on this device" option for user pools that perform authentication with the device key of a trusted device in the back end, instead of a user-provided MFA code. For more information about device authentication, see Working with user devices in your user pool.

Authorize this action with a signed-in user's access token. It must include the scope aws.cognito.signin.user.admin.

Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.

Parameter Syntax

$result = $client->confirmDevice([
    'AccessToken' => '<string>', // REQUIRED
    'DeviceKey' => '<string>', // REQUIRED
    'DeviceName' => '<string>',
    'DeviceSecretVerifierConfig' => [
        'PasswordVerifier' => '<string>',
        'Salt' => '<string>',
    ],
]);

Parameter Details

Members
AccessToken
Required: Yes
Type: string

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

DeviceKey
Required: Yes
Type: string

The unique identifier, or device key, of the device that you want to update the status for.

DeviceName
Type: string

A friendly name for the device, for example MyMobilePhone.

DeviceSecretVerifierConfig

The configuration of the device secret verifier.

Result Syntax

[
    'UserConfirmationNecessary' => true || false,
]

Result Details

Members
UserConfirmationNecessary
Type: boolean

When true, your user must confirm that they want to remember the device. Prompt the user for an answer. You must then make an UpdateUserDevice request that sets the device to remembered or not_remembered.

When false, immediately sets the device as remembered and eligible for device authentication.

You can configure your user pool to always remember devices, in which case this response is false, or to allow users to opt in, in which case this response is true. Configure this option under Device tracking in the Sign-in menu of your user pool. You can also configure this option with the DeviceConfiguration parameter of a CreateUserPool or UpdateUserPool request.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

InvalidPasswordException:

This exception is thrown when Amazon Cognito encounters an invalid password.

InvalidLambdaResponseException:

This exception is thrown when Amazon Cognito encounters an invalid Lambda response.

UsernameExistsException:

This exception is thrown when Amazon Cognito encounters a user name that already exists in the user pool.

InvalidUserPoolConfigurationException:

This exception is thrown when the user pool configuration is not valid.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

PasswordResetRequiredException:

This exception is thrown when a password reset is required.

UserNotFoundException:

This exception is thrown when a user isn't found.

UserNotConfirmedException:

This exception is thrown when a user isn't confirmed successfully.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

ForbiddenException:

This exception is thrown when WAF doesn't allow your request based on a web ACL that's associated with your user pool.

ConfirmForgotPassword

$result = $client->confirmForgotPassword([/* ... */]);
$promise = $client->confirmForgotPasswordAsync([/* ... */]);

This public API operation accepts a confirmation code that Amazon Cognito sent to a user and accepts a new password for that user.

Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.

Parameter Syntax

$result = $client->confirmForgotPassword([
    'AnalyticsMetadata' => [
        'AnalyticsEndpointId' => '<string>',
    ],
    'ClientId' => '<string>', // REQUIRED
    'ClientMetadata' => ['<string>', ...],
    'ConfirmationCode' => '<string>', // REQUIRED
    'Password' => '<string>', // REQUIRED
    'SecretHash' => '<string>',
    'UserContextData' => [
        'EncodedData' => '<string>',
        'IpAddress' => '<string>',
    ],
    'Username' => '<string>', // REQUIRED
]);

Parameter Details

Members
AnalyticsMetadata
Type: AnalyticsMetadataType structure

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

ClientId
Required: Yes
Type: string

The ID of the app client where the user wants to reset their password. This parameter is an identifier of the client application that users are resetting their password from, but this operation resets users' passwords for all app clients in the user pool.

ClientMetadata
Type: Associative array of custom strings keys (StringType) to strings

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.

When you use the ClientMetadata parameter, note 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 send sensitive information in this parameter.

ConfirmationCode
Required: Yes
Type: string

The confirmation code that your user pool sent in response to an AdminResetUserPassword or a ForgotPassword request.

Password
Required: Yes
Type: string

The new password that your user wants to set.

SecretHash
Type: 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. For more information about SecretHash, see Computing secret hash values.

UserContextData
Type: UserContextDataType structure

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.

For more information, see Collecting data for threat protection in applications.

Username
Required: Yes
Type: string

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

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

UnexpectedLambdaException:

This exception is thrown when Amazon Cognito encounters an unexpected exception with Lambda.

UserLambdaValidationException:

This exception is thrown when the Amazon Cognito service encounters a user validation exception with the Lambda service.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

InvalidPasswordException:

This exception is thrown when Amazon Cognito encounters an invalid password.

PasswordHistoryPolicyViolationException:

The message returned when a user's new password matches a previous password and doesn't comply with the password-history policy.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

CodeMismatchException:

This exception is thrown if the provided code doesn't match what the server was expecting.

ExpiredCodeException:

This exception is thrown if a code has expired.

TooManyFailedAttemptsException:

This exception is thrown when the user has made too many failed attempts for a given action, such as sign-in.

InvalidLambdaResponseException:

This exception is thrown when Amazon Cognito encounters an invalid Lambda response.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

LimitExceededException:

This exception is thrown when a user exceeds the limit for a requested Amazon Web Services resource.

UserNotFoundException:

This exception is thrown when a user isn't found.

UserNotConfirmedException:

This exception is thrown when a user isn't confirmed successfully.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

ForbiddenException:

This exception is thrown when WAF doesn't allow your request based on a web ACL that's associated with your user pool.

ConfirmSignUp

$result = $client->confirmSignUp([/* ... */]);
$promise = $client->confirmSignUpAsync([/* ... */]);

This public API operation submits a code that Amazon Cognito sent to your user when they signed up in your user pool via the SignUp API operation. After your user enters their code, they confirm ownership of the email address or phone number that they provided, and their user account becomes active. Depending on your user pool configuration, your users will receive their confirmation code in an email or SMS message.

Local users who signed up in your user pool are the only type of user who can confirm sign-up with a code. Users who federate through an external identity provider (IdP) have already been confirmed by their IdP. Administrator-created users, users created with the AdminCreateUser API operation, confirm their accounts when they respond to their invitation email message and choose a password. They do not receive a confirmation code. Instead, they receive a temporary password.

Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.

Parameter Syntax

$result = $client->confirmSignUp([
    'AnalyticsMetadata' => [
        'AnalyticsEndpointId' => '<string>',
    ],
    'ClientId' => '<string>', // REQUIRED
    'ClientMetadata' => ['<string>', ...],
    'ConfirmationCode' => '<string>', // REQUIRED
    'ForceAliasCreation' => true || false,
    'SecretHash' => '<string>',
    'Session' => '<string>',
    'UserContextData' => [
        'EncodedData' => '<string>',
        'IpAddress' => '<string>',
    ],
    'Username' => '<string>', // REQUIRED
]);

Parameter Details

Members
AnalyticsMetadata
Type: AnalyticsMetadataType structure

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

ClientId
Required: Yes
Type: string

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

ClientMetadata
Type: Associative array of custom strings keys (StringType) to strings

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.

When you use the ClientMetadata parameter, note 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 send sensitive information in this parameter.

ConfirmationCode
Required: Yes
Type: string

The confirmation code that your user pool sent in response to the SignUp request.

ForceAliasCreation
Type: boolean

When true, forces user confirmation despite any existing aliases. Defaults to false. A value of true migrates the alias from an existing user to the new user if an existing user already has the phone number or email address as an alias.

Say, for example, that an existing user has an email attribute of bob@example.com and email is an alias in your user pool. If the new user also has an email of bob@example.com and your ConfirmSignUp response sets ForceAliasCreation to true, the new user can sign in with a username of bob@example.com and the existing user can no longer do so.

If false and an attribute belongs to an existing alias, this request returns an AliasExistsException error.

For more information about sign-in aliases, see Customizing sign-in attributes.

SecretHash
Type: 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. For more information about SecretHash, see Computing secret hash values.

Session
Type: string

The optional session ID from a SignUp API request. You can sign in a user directly from the sign-up process with the USER_AUTH authentication flow.

UserContextData
Type: UserContextDataType structure

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.

For more information, see Collecting data for threat protection in applications.

Username
Required: Yes
Type: string

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

Result Syntax

[
    'Session' => '<string>',
]

Result Details

Members
Session
Type: string

A session identifier that you can use to immediately sign in the confirmed user. You can automatically sign users in with the one-time password that they provided in a successful ConfirmSignUp request. To do this, pass the Session parameter from this response in the Session parameter of an InitiateAuth or AdminInitiateAuth request.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

UnexpectedLambdaException:

This exception is thrown when Amazon Cognito encounters an unexpected exception with Lambda.

UserLambdaValidationException:

This exception is thrown when the Amazon Cognito service encounters a user validation exception with the Lambda service.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

TooManyFailedAttemptsException:

This exception is thrown when the user has made too many failed attempts for a given action, such as sign-in.

CodeMismatchException:

This exception is thrown if the provided code doesn't match what the server was expecting.

ExpiredCodeException:

This exception is thrown if a code has expired.

InvalidLambdaResponseException:

This exception is thrown when Amazon Cognito encounters an invalid Lambda response.

AliasExistsException:

This exception is thrown when a user tries to confirm the account with an email address or phone number that has already been supplied as an alias for a different user profile. This exception indicates that an account with this email address or phone already exists in a user pool that you've configured to use email address or phone number as a sign-in alias.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

LimitExceededException:

This exception is thrown when a user exceeds the limit for a requested Amazon Web Services resource.

UserNotFoundException:

This exception is thrown when a user isn't found.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

ForbiddenException:

This exception is thrown when WAF doesn't allow your request based on a web ACL that's associated with your user pool.

CreateGroup

$result = $client->createGroup([/* ... */]);
$promise = $client->createGroupAsync([/* ... */]);

Creates a new group in the specified user pool. For more information about user pool groups see Adding groups to a user pool.

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

Learn more

Parameter Syntax

$result = $client->createGroup([
    'Description' => '<string>',
    'GroupName' => '<string>', // REQUIRED
    'Precedence' => <integer>,
    'RoleArn' => '<string>',
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
Description
Type: string

A description of the group that you're creating.

GroupName
Required: Yes
Type: string

A name for the group. This name must be unique in your user pool.

Precedence
Type: int

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.

RoleArn
Type: string

The Amazon Resource Name (ARN) for the IAM role that you want to associate with the group. A group role primarily declares a preferred role for the credentials that you get from an identity pool. Amazon Cognito ID tokens have a cognito:preferred_role claim that presents the highest-precedence group that a user belongs to. Both ID and access tokens also contain a cognito:groups claim that list all the groups that a user is a member of.

UserPoolId
Required: Yes
Type: string

The ID of the user pool where you want to create a user group.

Result Syntax

[
    'Group' => [
        'CreationDate' => <DateTime>,
        'Description' => '<string>',
        'GroupName' => '<string>',
        'LastModifiedDate' => <DateTime>,
        'Precedence' => <integer>,
        'RoleArn' => '<string>',
        'UserPoolId' => '<string>',
    ],
]

Result Details

Members
Group
Type: GroupType structure

The response object for a created group.

Errors

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

GroupExistsException:

This exception is thrown when Amazon Cognito encounters a group that already exists in the user pool.

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

LimitExceededException:

This exception is thrown when a user exceeds the limit for a requested Amazon Web Services resource.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

CreateIdentityProvider

$result = $client->createIdentityProvider([/* ... */]);
$promise = $client->createIdentityProviderAsync([/* ... */]);

Adds a configuration and trust relationship between a third-party identity provider (IdP) and a user pool. Amazon Cognito accepts sign-in with third-party identity providers through managed login and OIDC relying-party libraries. For more information, see Third-party IdP sign-in.

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

Learn more

Parameter Syntax

$result = $client->createIdentityProvider([
    'AttributeMapping' => ['<string>', ...],
    'IdpIdentifiers' => ['<string>', ...],
    'ProviderDetails' => ['<string>', ...], // REQUIRED
    'ProviderName' => '<string>', // REQUIRED
    'ProviderType' => 'SAML|Facebook|Google|LoginWithAmazon|SignInWithApple|OIDC', // REQUIRED
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
AttributeMapping
Type: Associative array of custom strings keys (AttributeMappingKeyType) to strings

A mapping of IdP attributes to standard and custom user pool attributes. Specify a user pool attribute as the key of the key-value pair, and the IdP attribute claim name as the value.

IdpIdentifiers
Type: Array of strings

An array of IdP identifiers, for example "IdPIdentifiers": [ "MyIdP", "MyIdP2" ]. Identifiers are friendly names that you can pass in the idp_identifier query parameter of requests to the Authorize endpoint to silently redirect to sign-in with the associated IdP. Identifiers in a domain format also enable the use of email-address matching with SAML providers.

ProviderDetails
Required: Yes
Type: Associative array of custom strings keys (StringType) to strings

The scopes, URLs, and identifiers for your external identity provider. The following examples describe the provider detail keys for each IdP type. These values and their schema are subject to change. Social IdP authorize_scopes values must match the values listed here.

OpenID Connect (OIDC)

Amazon Cognito accepts the following elements when it can't discover endpoint URLs from oidc_issuer: attributes_url, authorize_url, jwks_uri, token_url.

Create or update request: "ProviderDetails": { "attributes_request_method": "GET", "attributes_url": "https://auth.example.com/userInfo", "authorize_scopes": "openid profile email", "authorize_url": "https://auth.example.com/authorize", "client_id": "1example23456789", "client_secret": "provider-app-client-secret", "jwks_uri": "https://auth.example.com/.well-known/jwks.json", "oidc_issuer": "https://auth.example.com", "token_url": "https://example.com/token" }

Describe response: "ProviderDetails": { "attributes_request_method": "GET", "attributes_url": "https://auth.example.com/userInfo", "attributes_url_add_attributes": "false", "authorize_scopes": "openid profile email", "authorize_url": "https://auth.example.com/authorize", "client_id": "1example23456789", "client_secret": "provider-app-client-secret", "jwks_uri": "https://auth.example.com/.well-known/jwks.json", "oidc_issuer": "https://auth.example.com", "token_url": "https://example.com/token" }

SAML

Create or update request with Metadata URL: "ProviderDetails": { "IDPInit": "true", "IDPSignout": "true", "EncryptedResponses" : "true", "MetadataURL": "https://auth.example.com/sso/saml/metadata", "RequestSigningAlgorithm": "rsa-sha256" }

Create or update request with Metadata file: "ProviderDetails": { "IDPInit": "true", "IDPSignout": "true", "EncryptedResponses" : "true", "MetadataFile": "[metadata XML]", "RequestSigningAlgorithm": "rsa-sha256" }

The value of MetadataFile must be the plaintext metadata document with all quote (") characters escaped by backslashes.

Describe response: "ProviderDetails": { "IDPInit": "true", "IDPSignout": "true", "EncryptedResponses" : "true", "ActiveEncryptionCertificate": "[certificate]", "MetadataURL": "https://auth.example.com/sso/saml/metadata", "RequestSigningAlgorithm": "rsa-sha256", "SLORedirectBindingURI": "https://auth.example.com/slo/saml", "SSORedirectBindingURI": "https://auth.example.com/sso/saml" }

LoginWithAmazon

Create or update request: "ProviderDetails": { "authorize_scopes": "profile postal_code", "client_id": "amzn1.application-oa2-client.1example23456789", "client_secret": "provider-app-client-secret"

Describe response: "ProviderDetails": { "attributes_url": "https://api.amazon.com/user/profile", "attributes_url_add_attributes": "false", "authorize_scopes": "profile postal_code", "authorize_url": "https://www.amazon.com/ap/oa", "client_id": "amzn1.application-oa2-client.1example23456789", "client_secret": "provider-app-client-secret", "token_request_method": "POST", "token_url": "https://api.amazon.com/auth/o2/token" }

Google

Create or update request: "ProviderDetails": { "authorize_scopes": "email profile openid", "client_id": "1example23456789.apps.googleusercontent.com", "client_secret": "provider-app-client-secret" }

Describe response: "ProviderDetails": { "attributes_url": "https://people.googleapis.com/v1/people/me?personFields=", "attributes_url_add_attributes": "true", "authorize_scopes": "email profile openid", "authorize_url": "https://accounts.google.com/o/oauth2/v2/auth", "client_id": "1example23456789.apps.googleusercontent.com", "client_secret": "provider-app-client-secret", "oidc_issuer": "https://accounts.google.com", "token_request_method": "POST", "token_url": "https://www.googleapis.com/oauth2/v4/token" }

SignInWithApple

Create or update request: "ProviderDetails": { "authorize_scopes": "email name", "client_id": "com.example.cognito", "private_key": "1EXAMPLE", "key_id": "2EXAMPLE", "team_id": "3EXAMPLE" }

Describe response: "ProviderDetails": { "attributes_url_add_attributes": "false", "authorize_scopes": "email name", "authorize_url": "https://appleid.apple.com/auth/authorize", "client_id": "com.example.cognito", "key_id": "1EXAMPLE", "oidc_issuer": "https://appleid.apple.com", "team_id": "2EXAMPLE", "token_request_method": "POST", "token_url": "https://appleid.apple.com/auth/token" }

Facebook

Create or update request: "ProviderDetails": { "api_version": "v17.0", "authorize_scopes": "public_profile, email", "client_id": "1example23456789", "client_secret": "provider-app-client-secret" }

Describe response: "ProviderDetails": { "api_version": "v17.0", "attributes_url": "https://graph.facebook.com/v17.0/me?fields=", "attributes_url_add_attributes": "true", "authorize_scopes": "public_profile, email", "authorize_url": "https://www.facebook.com/v17.0/dialog/oauth", "client_id": "1example23456789", "client_secret": "provider-app-client-secret", "token_request_method": "GET", "token_url": "https://graph.facebook.com/v17.0/oauth/access_token" }

ProviderName
Required: Yes
Type: string

The name that you want to assign to the IdP. You can pass the identity provider name in the identity_provider query parameter of requests to the Authorize endpoint to silently redirect to sign-in with the associated IdP.

ProviderType
Required: Yes
Type: string

The type of IdP that you want to add. Amazon Cognito supports OIDC, SAML 2.0, Login With Amazon, Sign In With Apple, Google, and Facebook IdPs.

UserPoolId
Required: Yes
Type: string

The Id of the user pool where you want to create an IdP.

Result Syntax

[
    'IdentityProvider' => [
        'AttributeMapping' => ['<string>', ...],
        'CreationDate' => <DateTime>,
        'IdpIdentifiers' => ['<string>', ...],
        'LastModifiedDate' => <DateTime>,
        'ProviderDetails' => ['<string>', ...],
        'ProviderName' => '<string>',
        'ProviderType' => 'SAML|Facebook|Google|LoginWithAmazon|SignInWithApple|OIDC',
        'UserPoolId' => '<string>',
    ],
]

Result Details

Members
IdentityProvider
Required: Yes
Type: IdentityProviderType structure

The details of the new user pool IdP.

Errors

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

DuplicateProviderException:

This exception is thrown when the provider is already supported by the user pool.

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

LimitExceededException:

This exception is thrown when a user exceeds the limit for a requested Amazon Web Services resource.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

CreateManagedLoginBranding

$result = $client->createManagedLoginBranding([/* ... */]);
$promise = $client->createManagedLoginBrandingAsync([/* ... */]);

Creates a new set of branding settings for a user pool style and associates it with an app client. This operation is the programmatic option for the creation of a new style in the branding designer.

Provides values for UI customization in a Settings JSON object and image files in an Assets array. To send the JSON object Document type parameter in Settings, you might need to update to the most recent version of your Amazon Web Services SDK. To create a new style with default settings, set UseCognitoProvidedValues to true and don't provide values for any other options.

This operation has a 2-megabyte request-size limit and include the CSS settings and image assets for your app client. Your branding settings might exceed 2MB in size. Amazon Cognito doesn't require that you pass all parameters in one request and preserves existing style settings that you don't specify. If your request is larger than 2MB, separate it into multiple requests, each with a size smaller than the limit.

As a best practice, modify the output of DescribeManagedLoginBrandingByClient into the request parameters for this operation. To get all settings, set ReturnMergedResources to true. For more information, see API and SDK operations for managed login branding.

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

Learn more

Parameter Syntax

$result = $client->createManagedLoginBranding([
    'Assets' => [
        [
            'Bytes' => <string || resource || Psr\Http\Message\StreamInterface>,
            'Category' => 'FAVICON_ICO|FAVICON_SVG|EMAIL_GRAPHIC|SMS_GRAPHIC|AUTH_APP_GRAPHIC|PASSWORD_GRAPHIC|PASSKEY_GRAPHIC|PAGE_HEADER_LOGO|PAGE_HEADER_BACKGROUND|PAGE_FOOTER_LOGO|PAGE_FOOTER_BACKGROUND|PAGE_BACKGROUND|FORM_BACKGROUND|FORM_LOGO|IDP_BUTTON_ICON', // REQUIRED
            'ColorMode' => 'LIGHT|DARK|DYNAMIC', // REQUIRED
            'Extension' => 'ICO|JPEG|PNG|SVG|WEBP', // REQUIRED
            'ResourceId' => '<string>',
        ],
        // ...
    ],
    'ClientId' => '<string>', // REQUIRED
    'Settings' => [
    ],
    'UseCognitoProvidedValues' => true || false,
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
Assets
Type: Array of AssetType structures

An array of image files that you want to apply to roles like backgrounds, logos, and icons. Each object must also indicate whether it is for dark mode, light mode, or browser-adaptive mode.

ClientId
Required: Yes
Type: string

The app client that you want to create the branding style for. Each style is permanently linked to an app client. To change the style for an app client, delete the existing style with DeleteManagedLoginBranding and create a new one.

Settings
Type: document (null|bool|string|numeric) or an (array|associative array) whose members are all valid documents

A JSON file, encoded as a Document type, with the the settings that you want to apply to your style.

UseCognitoProvidedValues
Type: boolean

When true, applies the default branding style options. These default options are managed by Amazon Cognito. You can modify them later in the branding designer.

When you specify true for this option, you must also omit values for Settings and Assets in the request.

UserPoolId
Required: Yes
Type: string

The ID of the user pool where you want to create a new branding style.

Result Syntax

[
    'ManagedLoginBranding' => [
        'Assets' => [
            [
                'Bytes' => <string || resource || Psr\Http\Message\StreamInterface>,
                'Category' => 'FAVICON_ICO|FAVICON_SVG|EMAIL_GRAPHIC|SMS_GRAPHIC|AUTH_APP_GRAPHIC|PASSWORD_GRAPHIC|PASSKEY_GRAPHIC|PAGE_HEADER_LOGO|PAGE_HEADER_BACKGROUND|PAGE_FOOTER_LOGO|PAGE_FOOTER_BACKGROUND|PAGE_BACKGROUND|FORM_BACKGROUND|FORM_LOGO|IDP_BUTTON_ICON',
                'ColorMode' => 'LIGHT|DARK|DYNAMIC',
                'Extension' => 'ICO|JPEG|PNG|SVG|WEBP',
                'ResourceId' => '<string>',
            ],
            // ...
        ],
        'CreationDate' => <DateTime>,
        'LastModifiedDate' => <DateTime>,
        'ManagedLoginBrandingId' => '<string>',
        'Settings' => [
        ],
        'UseCognitoProvidedValues' => true || false,
        'UserPoolId' => '<string>',
    ],
]

Result Details

Members
ManagedLoginBranding
Type: ManagedLoginBrandingType structure

The details of the branding style that you created.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

ConcurrentModificationException:

This exception is thrown if two or more modifications are happening concurrently.

ManagedLoginBrandingExistsException:

This exception is thrown when you attempt to apply a managed login branding style to an app client that already has an assigned style.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

LimitExceededException:

This exception is thrown when a user exceeds the limit for a requested Amazon Web Services resource.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

CreateResourceServer

$result = $client->createResourceServer([/* ... */]);
$promise = $client->createResourceServerAsync([/* ... */]);

Creates a new OAuth2.0 resource server and defines custom scopes within it. Resource servers are associated with custom scopes and machine-to-machine (M2M) authorization. For more information, see Access control with resource servers.

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

Learn more

Parameter Syntax

$result = $client->createResourceServer([
    'Identifier' => '<string>', // REQUIRED
    'Name' => '<string>', // REQUIRED
    'Scopes' => [
        [
            'ScopeDescription' => '<string>', // REQUIRED
            'ScopeName' => '<string>', // REQUIRED
        ],
        // ...
    ],
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
Identifier
Required: Yes
Type: string

A unique resource server identifier for the resource server. The identifier can be an API friendly name like solar-system-data. You can also set an API URL like https://solar-system-data-api.example.com as your identifier.

Amazon Cognito represents scopes in the access token in the format $resource-server-identifier/$scope. Longer scope-identifier strings increase the size of your access tokens.

Name
Required: Yes
Type: string

A friendly name for the resource server.

Scopes
Type: Array of ResourceServerScopeType structures

A list of custom scopes. Each scope is a key-value map with the keys ScopeName and ScopeDescription. The name of a custom scope is a combination of ScopeName and the resource server Name in this request, for example MyResourceServerName/MyScopeName.

UserPoolId
Required: Yes
Type: string

The ID of the user pool where you want to create a resource server.

Result Syntax

[
    'ResourceServer' => [
        'Identifier' => '<string>',
        'Name' => '<string>',
        'Scopes' => [
            [
                'ScopeDescription' => '<string>',
                'ScopeName' => '<string>',
            ],
            // ...
        ],
        'UserPoolId' => '<string>',
    ],
]

Result Details

Members
ResourceServer
Required: Yes
Type: ResourceServerType structure

The details of the new resource server.

Errors

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

LimitExceededException:

This exception is thrown when a user exceeds the limit for a requested Amazon Web Services resource.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

CreateUserImportJob

$result = $client->createUserImportJob([/* ... */]);
$promise = $client->createUserImportJobAsync([/* ... */]);

Creates a user import job. You can import users into user pools from a comma-separated values (CSV) file without adding Amazon Cognito MAU costs to your Amazon Web Services bill. To generate a template for your import, see GetCSVHeader. To learn more about CSV import, see Importing users from a CSV file.

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

Learn more

Parameter Syntax

$result = $client->createUserImportJob([
    'CloudWatchLogsRoleArn' => '<string>', // REQUIRED
    'JobName' => '<string>', // REQUIRED
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
CloudWatchLogsRoleArn
Required: Yes
Type: string

You must specify an IAM role that has permission to log import-job results to Amazon CloudWatch Logs. This parameter is the ARN of that role.

JobName
Required: Yes
Type: string

A friendly name for the user import job.

UserPoolId
Required: Yes
Type: string

The ID of the user pool that you want to import users into.

Result Syntax

[
    'UserImportJob' => [
        'CloudWatchLogsRoleArn' => '<string>',
        'CompletionDate' => <DateTime>,
        'CompletionMessage' => '<string>',
        'CreationDate' => <DateTime>,
        'FailedUsers' => <integer>,
        'ImportedUsers' => <integer>,
        'JobId' => '<string>',
        'JobName' => '<string>',
        'PreSignedUrl' => '<string>',
        'SkippedUsers' => <integer>,
        'StartDate' => <DateTime>,
        'Status' => 'Created|Pending|InProgress|Stopping|Expired|Stopped|Failed|Succeeded',
        'UserPoolId' => '<string>',
    ],
]

Result Details

Members
UserImportJob
Type: UserImportJobType structure

The details of the user import job.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

PreconditionNotMetException:

This exception is thrown when a precondition is not met.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

LimitExceededException:

This exception is thrown when a user exceeds the limit for a requested Amazon Web Services resource.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

CreateUserPool

$result = $client->createUserPool([/* ... */]);
$promise = $client->createUserPoolAsync([/* ... */]);

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 Services 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.

Creates a new Amazon Cognito user pool. This operation sets basic and advanced configuration options. You can create a user pool in the Amazon Cognito console to your preferences and use the output of DescribeUserPool to generate requests from that baseline.

If you don't provide a value for an attribute, Amazon Cognito sets it to its default value.

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

Learn more

Parameter Syntax

$result = $client->createUserPool([
    'AccountRecoverySetting' => [
        'RecoveryMechanisms' => [
            [
                'Name' => 'verified_email|verified_phone_number|admin_only', // REQUIRED
                'Priority' => <integer>, // REQUIRED
            ],
            // ...
        ],
    ],
    'AdminCreateUserConfig' => [
        'AllowAdminCreateUserOnly' => true || false,
        'InviteMessageTemplate' => [
            'EmailMessage' => '<string>',
            'EmailSubject' => '<string>',
            'SMSMessage' => '<string>',
        ],
        'UnusedAccountValidityDays' => <integer>,
    ],
    'AliasAttributes' => ['<string>', ...],
    'AutoVerifiedAttributes' => ['<string>', ...],
    'DeletionProtection' => 'ACTIVE|INACTIVE',
    'DeviceConfiguration' => [
        'ChallengeRequiredOnNewDevice' => true || false,
        'DeviceOnlyRememberedOnUserPrompt' => true || false,
    ],
    'EmailConfiguration' => [
        'ConfigurationSet' => '<string>',
        'EmailSendingAccount' => 'COGNITO_DEFAULT|DEVELOPER',
        'From' => '<string>',
        'ReplyToEmailAddress' => '<string>',
        'SourceArn' => '<string>',
    ],
    'EmailVerificationMessage' => '<string>',
    'EmailVerificationSubject' => '<string>',
    'LambdaConfig' => [
        'CreateAuthChallenge' => '<string>',
        'CustomEmailSender' => [
            'LambdaArn' => '<string>', // REQUIRED
            'LambdaVersion' => 'V1_0', // REQUIRED
        ],
        'CustomMessage' => '<string>',
        'CustomSMSSender' => [
            'LambdaArn' => '<string>', // REQUIRED
            'LambdaVersion' => 'V1_0', // REQUIRED
        ],
        'DefineAuthChallenge' => '<string>',
        'KMSKeyID' => '<string>',
        'PostAuthentication' => '<string>',
        'PostConfirmation' => '<string>',
        'PreAuthentication' => '<string>',
        'PreSignUp' => '<string>',
        'PreTokenGeneration' => '<string>',
        'PreTokenGenerationConfig' => [
            'LambdaArn' => '<string>', // REQUIRED
            'LambdaVersion' => 'V1_0|V2_0', // REQUIRED
        ],
        'UserMigration' => '<string>',
        'VerifyAuthChallengeResponse' => '<string>',
    ],
    'MfaConfiguration' => 'OFF|ON|OPTIONAL',
    'Policies' => [
        'PasswordPolicy' => [
            'MinimumLength' => <integer>,
            'PasswordHistorySize' => <integer>,
            'RequireLowercase' => true || false,
            'RequireNumbers' => true || false,
            'RequireSymbols' => true || false,
            'RequireUppercase' => true || false,
            'TemporaryPasswordValidityDays' => <integer>,
        ],
        'SignInPolicy' => [
            'AllowedFirstAuthFactors' => ['<string>', ...],
        ],
    ],
    'PoolName' => '<string>', // REQUIRED
    'Schema' => [
        [
            'AttributeDataType' => 'String|Number|DateTime|Boolean',
            'DeveloperOnlyAttribute' => true || false,
            'Mutable' => true || false,
            'Name' => '<string>',
            'NumberAttributeConstraints' => [
                'MaxValue' => '<string>',
                'MinValue' => '<string>',
            ],
            'Required' => true || false,
            'StringAttributeConstraints' => [
                'MaxLength' => '<string>',
                'MinLength' => '<string>',
            ],
        ],
        // ...
    ],
    'SmsAuthenticationMessage' => '<string>',
    'SmsConfiguration' => [
        'ExternalId' => '<string>',
        'SnsCallerArn' => '<string>', // REQUIRED
        'SnsRegion' => '<string>',
    ],
    'SmsVerificationMessage' => '<string>',
    'UserAttributeUpdateSettings' => [
        'AttributesRequireVerificationBeforeUpdate' => ['<string>', ...],
    ],
    'UserPoolAddOns' => [
        'AdvancedSecurityAdditionalFlows' => [
            'CustomAuthMode' => 'AUDIT|ENFORCED',
        ],
        'AdvancedSecurityMode' => 'OFF|AUDIT|ENFORCED', // REQUIRED
    ],
    'UserPoolTags' => ['<string>', ...],
    'UserPoolTier' => 'LITE|ESSENTIALS|PLUS',
    'UsernameAttributes' => ['<string>', ...],
    'UsernameConfiguration' => [
        'CaseSensitive' => true || false, // REQUIRED
    ],
    'VerificationMessageTemplate' => [
        'DefaultEmailOption' => 'CONFIRM_WITH_LINK|CONFIRM_WITH_CODE',
        'EmailMessage' => '<string>',
        'EmailMessageByLink' => '<string>',
        'EmailSubject' => '<string>',
        'EmailSubjectByLink' => '<string>',
        'SmsMessage' => '<string>',
    ],
]);

Parameter Details

Members
AccountRecoverySetting
Type: AccountRecoverySettingType structure

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.

AdminCreateUserConfig
Type: AdminCreateUserConfigType structure

The configuration for AdminCreateUser requests. Includes the template for the invitation message for new users, the duration of temporary passwords, and permitting self-service sign-up.

AliasAttributes
Type: Array of strings

Attributes supported as an alias for this user pool. Possible values: phone_number, email, or preferred_username. For more information about alias attributes, see Customizing sign-in attributes.

AutoVerifiedAttributes
Type: Array of strings

The attributes that you want your user pool to automatically verify. Possible values: email, phone_number. For more information see Verifying contact information at sign-up.

DeletionProtection
Type: string

When active, DeletionProtection prevents accidental deletion of your user pool. Before you can delete a user pool that you have protected against deletion, you must deactivate this feature.

When you try to delete a protected user pool in a DeleteUserPool API request, Amazon Cognito returns an InvalidParameterException error. To delete a protected user pool, send a new DeleteUserPool request after you deactivate deletion protection in an UpdateUserPool API request.

DeviceConfiguration
Type: DeviceConfigurationType structure

The device-remembering configuration for a user pool. Device remembering or device tracking is a "Remember me on this device" option for user pools that perform authentication with the device key of a trusted device in the back end, instead of a user-provided MFA code. For more information about device authentication, see Working with user devices in your user pool. A null value indicates that you have deactivated device remembering in your user pool.

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

EmailConfiguration
Type: EmailConfigurationType structure

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.

EmailVerificationMessage
Type: string

This parameter is no longer used. See VerificationMessageTemplateType.

EmailVerificationSubject
Type: string

This parameter is no longer used. See VerificationMessageTemplateType.

LambdaConfig
Type: LambdaConfigType structure

A collection of user pool Lambda triggers. Amazon Cognito invokes triggers at several possible stages of authentication operations. Triggers can modify the outcome of the operations that invoked them.

MfaConfiguration
Type: string

Sets multi-factor authentication (MFA) to be on, off, or optional. When ON, all users must set up MFA before they can sign in. When OPTIONAL, your application must make a client-side determination of whether a user wants to register an MFA device. For user pools with adaptive authentication with threat protection, choose OPTIONAL.

Policies
Type: UserPoolPolicyType structure

The password policy and sign-in policy in the user pool. The password policy sets options like password complexity requirements and password history. The sign-in policy sets the options available to applications in choice-based authentication.

PoolName
Required: Yes
Type: string

A friendlhy name for your user pool.

Schema
Type: Array of SchemaAttributeType structures

An array of attributes for the new user pool. You can add custom attributes and modify the properties of default attributes. The specifications in this parameter set the required attributes in your user pool. For more information, see Working with user attributes.

SmsAuthenticationMessage
Type: string

A string representing the SMS authentication message.

SmsConfiguration
Type: SmsConfigurationType structure

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. For more information see SMS message settings.

SmsVerificationMessage
Type: string

This parameter is no longer used. See VerificationMessageTemplateType.

UserAttributeUpdateSettings

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.

UserPoolAddOns
Type: UserPoolAddOnsType structure

User pool add-ons. Contains settings for activation of advanced security features. To log user security information but take no action, set to AUDIT. To configure automatic security responses to risky traffic to your user pool, set to ENFORCED.

For more information, see Adding advanced security to a user pool.

UserPoolTags
Type: Associative array of custom strings keys (TagKeysType) to strings

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.

UserPoolTier
Type: string

The user pool feature plan, or tier. This parameter determines the eligibility of the user pool for features like managed login, access-token customization, and threat protection. Defaults to ESSENTIALS.

UsernameAttributes
Type: Array of strings

Specifies whether a user can use an email address or phone number as a username when they sign up. For more information, see Customizing sign-in attributes.

UsernameConfiguration
Type: UsernameConfigurationType structure

Sets the case sensitivity option for sign-in usernames. When CaseSensitive is false (case insensitive), users can sign in with any combination of capital and lowercase letters. For example, username, USERNAME, or UserName, or for email, email@example.com or EMaiL@eXamplE.Com. For most use cases, set case sensitivity to false as a best practice. When usernames and email addresses are case insensitive, Amazon Cognito treats any variation in case as the same user, and prevents a case variation from being assigned to the same attribute for a different user.

When CaseSensitive is true (case sensitive), Amazon Cognito interprets USERNAME and UserName as distinct users.

This configuration is immutable after you set it.

VerificationMessageTemplate

The template for the verification message that your user pool delivers to users who set an email address or phone number attribute.

Set the email message type that corresponds to your DefaultEmailOption selection. For CONFIRM_WITH_LINK, specify an EmailMessageByLink and leave EmailMessage blank. For CONFIRM_WITH_CODE, specify an EmailMessage and leave EmailMessageByLink blank. When you supply both parameters with either choice, Amazon Cognito returns an error.

Result Syntax

[
    'UserPool' => [
        'AccountRecoverySetting' => [
            'RecoveryMechanisms' => [
                [
                    'Name' => 'verified_email|verified_phone_number|admin_only',
                    'Priority' => <integer>,
                ],
                // ...
            ],
        ],
        'AdminCreateUserConfig' => [
            'AllowAdminCreateUserOnly' => true || false,
            'InviteMessageTemplate' => [
                'EmailMessage' => '<string>',
                'EmailSubject' => '<string>',
                'SMSMessage' => '<string>',
            ],
            'UnusedAccountValidityDays' => <integer>,
        ],
        'AliasAttributes' => ['<string>', ...],
        'Arn' => '<string>',
        'AutoVerifiedAttributes' => ['<string>', ...],
        'CreationDate' => <DateTime>,
        'CustomDomain' => '<string>',
        'DeletionProtection' => 'ACTIVE|INACTIVE',
        'DeviceConfiguration' => [
            'ChallengeRequiredOnNewDevice' => true || false,
            'DeviceOnlyRememberedOnUserPrompt' => true || false,
        ],
        'Domain' => '<string>',
        'EmailConfiguration' => [
            'ConfigurationSet' => '<string>',
            'EmailSendingAccount' => 'COGNITO_DEFAULT|DEVELOPER',
            'From' => '<string>',
            'ReplyToEmailAddress' => '<string>',
            'SourceArn' => '<string>',
        ],
        'EmailConfigurationFailure' => '<string>',
        'EmailVerificationMessage' => '<string>',
        'EmailVerificationSubject' => '<string>',
        'EstimatedNumberOfUsers' => <integer>,
        'Id' => '<string>',
        'LambdaConfig' => [
            'CreateAuthChallenge' => '<string>',
            'CustomEmailSender' => [
                'LambdaArn' => '<string>',
                'LambdaVersion' => 'V1_0',
            ],
            'CustomMessage' => '<string>',
            'CustomSMSSender' => [
                'LambdaArn' => '<string>',
                'LambdaVersion' => 'V1_0',
            ],
            'DefineAuthChallenge' => '<string>',
            'KMSKeyID' => '<string>',
            'PostAuthentication' => '<string>',
            'PostConfirmation' => '<string>',
            'PreAuthentication' => '<string>',
            'PreSignUp' => '<string>',
            'PreTokenGeneration' => '<string>',
            'PreTokenGenerationConfig' => [
                'LambdaArn' => '<string>',
                'LambdaVersion' => 'V1_0|V2_0',
            ],
            'UserMigration' => '<string>',
            'VerifyAuthChallengeResponse' => '<string>',
        ],
        'LastModifiedDate' => <DateTime>,
        'MfaConfiguration' => 'OFF|ON|OPTIONAL',
        'Name' => '<string>',
        'Policies' => [
            'PasswordPolicy' => [
                'MinimumLength' => <integer>,
                'PasswordHistorySize' => <integer>,
                'RequireLowercase' => true || false,
                'RequireNumbers' => true || false,
                'RequireSymbols' => true || false,
                'RequireUppercase' => true || false,
                'TemporaryPasswordValidityDays' => <integer>,
            ],
            'SignInPolicy' => [
                'AllowedFirstAuthFactors' => ['<string>', ...],
            ],
        ],
        'SchemaAttributes' => [
            [
                'AttributeDataType' => 'String|Number|DateTime|Boolean',
                'DeveloperOnlyAttribute' => true || false,
                'Mutable' => true || false,
                'Name' => '<string>',
                'NumberAttributeConstraints' => [
                    'MaxValue' => '<string>',
                    'MinValue' => '<string>',
                ],
                'Required' => true || false,
                'StringAttributeConstraints' => [
                    'MaxLength' => '<string>',
                    'MinLength' => '<string>',
                ],
            ],
            // ...
        ],
        'SmsAuthenticationMessage' => '<string>',
        'SmsConfiguration' => [
            'ExternalId' => '<string>',
            'SnsCallerArn' => '<string>',
            'SnsRegion' => '<string>',
        ],
        'SmsConfigurationFailure' => '<string>',
        'SmsVerificationMessage' => '<string>',
        'Status' => 'Enabled|Disabled',
        'UserAttributeUpdateSettings' => [
            'AttributesRequireVerificationBeforeUpdate' => ['<string>', ...],
        ],
        'UserPoolAddOns' => [
            'AdvancedSecurityAdditionalFlows' => [
                'CustomAuthMode' => 'AUDIT|ENFORCED',
            ],
            'AdvancedSecurityMode' => 'OFF|AUDIT|ENFORCED',
        ],
        'UserPoolTags' => ['<string>', ...],
        'UserPoolTier' => 'LITE|ESSENTIALS|PLUS',
        'UsernameAttributes' => ['<string>', ...],
        'UsernameConfiguration' => [
            'CaseSensitive' => true || false,
        ],
        'VerificationMessageTemplate' => [
            'DefaultEmailOption' => 'CONFIRM_WITH_LINK|CONFIRM_WITH_CODE',
            'EmailMessage' => '<string>',
            'EmailMessageByLink' => '<string>',
            'EmailSubject' => '<string>',
            'EmailSubjectByLink' => '<string>',
            'SmsMessage' => '<string>',
        ],
    ],
]

Result Details

Members
UserPool
Type: UserPoolType structure

The details of the created user pool.

Errors

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

LimitExceededException:

This exception is thrown when a user exceeds the limit for a requested Amazon Web Services resource.

InvalidSmsRoleAccessPolicyException:

This exception is returned when the role provided for SMS configuration doesn't have permission to publish using Amazon SNS.

InvalidSmsRoleTrustRelationshipException:

This exception is thrown when the trust relationship is not valid for the role provided for SMS configuration. This can happen if you don't trust cognito-idp.amazonaws.com or the external ID provided in the role does not match what is provided in the SMS configuration for the user pool.

InvalidEmailRoleAccessPolicyException:

This exception is thrown when Amazon Cognito isn't allowed to use your email identity. HTTP status code: 400.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

UserPoolTaggingException:

This exception is thrown when a user pool tag can't be set or updated.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

TierChangeNotAllowedException:

This exception is thrown when you've attempted to change your feature plan but the operation isn't permitted.

FeatureUnavailableInTierException:

This exception is thrown when a feature you attempted to configure isn't available in your current feature plan.

Examples

Example 1: Example user pool with email and username sign-in

The following example creates a user pool with all configurable properties set to an example value. The resulting user pool allows sign-in with username or email address, has optional MFA, and has a Lambda function assigned to each possible trigger.

$result = $client->createUserPool([
    'AccountRecoverySetting' => [
        'RecoveryMechanisms' => [
            [
                'Name' => 'verified_email',
                'Priority' => 1,
            ],
        ],
    ],
    'AdminCreateUserConfig' => [
        'AllowAdminCreateUserOnly' => ,
        'InviteMessageTemplate' => [
            'EmailMessage' => 'Your username is {username} and temporary password is {####}.',
            'EmailSubject' => 'Your sign-in information',
            'SMSMessage' => 'Your username is {username} and temporary password is {####}.',
        ],
    ],
    'AliasAttributes' => [
        'email',
    ],
    'AutoVerifiedAttributes' => [
        'email',
    ],
    'DeletionProtection' => 'ACTIVE',
    'DeviceConfiguration' => [
        'ChallengeRequiredOnNewDevice' => 1,
        'DeviceOnlyRememberedOnUserPrompt' => 1,
    ],
    'EmailConfiguration' => [
        'ConfigurationSet' => 'my-test-ses-configuration-set',
        'EmailSendingAccount' => 'DEVELOPER',
        'From' => 'support@example.com',
        'ReplyToEmailAddress' => 'support@example.com',
        'SourceArn' => 'arn:aws:ses:us-east-1:123456789012:identity/support@example.com',
    ],
    'EmailVerificationMessage' => 'Your verification code is {####}.',
    'EmailVerificationSubject' => 'Verify your email address',
    'LambdaConfig' => [
        'CustomEmailSender' => [
            'LambdaArn' => 'arn:aws:lambda:us-east-1:123456789012:function:MyFunction',
            'LambdaVersion' => 'V1_0',
        ],
        'CustomMessage' => 'arn:aws:lambda:us-east-1:123456789012:function:MyFunction',
        'CustomSMSSender' => [
            'LambdaArn' => 'arn:aws:lambda:us-east-1:123456789012:function:MyFunction',
            'LambdaVersion' => 'V1_0',
        ],
        'DefineAuthChallenge' => 'arn:aws:lambda:us-east-1:123456789012:function:MyFunction',
        'KMSKeyID' => 'arn:aws:kms:us-east-1:123456789012:key/a6c4f8e2-0c45-47db-925f-87854bc9e357',
        'PostAuthentication' => 'arn:aws:lambda:us-east-1:123456789012:function:MyFunction',
        'PostConfirmation' => 'arn:aws:lambda:us-east-1:123456789012:function:MyFunction',
        'PreAuthentication' => 'arn:aws:lambda:us-east-1:123456789012:function:MyFunction',
        'PreSignUp' => 'arn:aws:lambda:us-east-1:123456789012:function:MyFunction',
        'PreTokenGeneration' => 'arn:aws:lambda:us-east-1:123456789012:function:MyFunction',
        'UserMigration' => 'arn:aws:lambda:us-east-1:123456789012:function:MyFunction',
        'VerifyAuthChallengeResponse' => 'arn:aws:lambda:us-east-1:123456789012:function:MyFunction',
    ],
    'MfaConfiguration' => 'OPTIONAL',
    'Policies' => [
        'PasswordPolicy' => [
            'MinimumLength' => 6,
            'RequireLowercase' => 1,
            'RequireNumbers' => 1,
            'RequireSymbols' => 1,
            'RequireUppercase' => 1,
            'TemporaryPasswordValidityDays' => 7,
        ],
    ],
    'PoolName' => 'my-test-user-pool',
    'Schema' => [
        [
            'AttributeDataType' => 'Number',
            'DeveloperOnlyAttribute' => 1,
            'Mutable' => 1,
            'Name' => 'mydev',
            'NumberAttributeConstraints' => [
                'MaxValue' => '99',
                'MinValue' => '1',
            ],
            'Required' => ,
            'StringAttributeConstraints' => [
                'MaxLength' => '99',
                'MinLength' => '1',
            ],
        ],
    ],
    'SmsAuthenticationMessage' => 'Your verification code is {####}.',
    'SmsConfiguration' => [
        'ExternalId' => 'my-role-external-id',
        'SnsCallerArn' => 'arn:aws:iam::123456789012:role/service-role/test-cognito-SMS-Role',
    ],
    'SmsVerificationMessage' => 'Your verification code is {####}.',
    'UserAttributeUpdateSettings' => [
        'AttributesRequireVerificationBeforeUpdate' => [
            'email',
        ],
    ],
    'UserPoolAddOns' => [
        'AdvancedSecurityMode' => 'OFF',
    ],
    'UserPoolTags' => [
        'my-test-tag-key' => 'my-test-tag-key',
    ],
    'UsernameConfiguration' => [
        'CaseSensitive' => 1,
    ],
    'VerificationMessageTemplate' => [
        'DefaultEmailOption' => 'CONFIRM_WITH_CODE',
        'EmailMessage' => 'Your confirmation code is {####}',
        'EmailMessageByLink' => 'Choose this link to {##verify your email##}',
        'EmailSubject' => 'Here is your confirmation code',
        'EmailSubjectByLink' => 'Here is your confirmation link',
        'SmsMessage' => 'Your confirmation code is {####}',
    ],
]);

Result syntax:

[
    'UserPool' => [
        'AccountRecoverySetting' => [
            'RecoveryMechanisms' => [
                [
                    'Name' => 'verified_email',
                    'Priority' => 1,
                ],
            ],
        ],
        'AdminCreateUserConfig' => [
            'AllowAdminCreateUserOnly' => ,
            'InviteMessageTemplate' => [
                'EmailMessage' => 'Your username is {username} and temporary password is {####}.',
                'EmailSubject' => 'Your sign-in information',
                'SMSMessage' => 'Your username is {username} and temporary password is {####}.',
            ],
            'UnusedAccountValidityDays' => 7,
        ],
        'AliasAttributes' => [
            'email',
        ],
        'Arn' => 'arn:aws:cognito-idp:us-east-1:123456789012:userpool/us-east-1_EXAMPLE',
        'AutoVerifiedAttributes' => [
            'email',
        ],
        'CreationDate' => ,
        'DeletionProtection' => 'ACTIVE',
        'DeviceConfiguration' => [
            'ChallengeRequiredOnNewDevice' => 1,
            'DeviceOnlyRememberedOnUserPrompt' => 1,
        ],
        'EmailConfiguration' => [
            'ConfigurationSet' => 'my-test-ses-configuration-set',
            'EmailSendingAccount' => 'DEVELOPER',
            'From' => 'support@example.com',
            'ReplyToEmailAddress' => 'support@example.com',
            'SourceArn' => 'arn:aws:ses:us-east-1:123456789012:identity/support@example.com',
        ],
        'EmailVerificationMessage' => 'Your verification code is {####}.',
        'EmailVerificationSubject' => 'Verify your email address',
        'EstimatedNumberOfUsers' => 0,
        'Id' => 'us-east-1_EXAMPLE',
        'LambdaConfig' => [
            'CustomEmailSender' => [
                'LambdaArn' => 'arn:aws:lambda:us-east-1:123456789012:function:MyFunction',
                'LambdaVersion' => 'V1_0',
            ],
            'CustomMessage' => 'arn:aws:lambda:us-east-1:123456789012:function:MyFunction',
            'CustomSMSSender' => [
                'LambdaArn' => 'arn:aws:lambda:us-east-1:123456789012:function:MyFunction',
                'LambdaVersion' => 'V1_0',
            ],
            'DefineAuthChallenge' => 'arn:aws:lambda:us-east-1:123456789012:function:MyFunction',
            'KMSKeyID' => 'arn:aws:kms:us-east-1:767671399759:key/4d43904c-8edf-4bb4-9fca-fb1a80e41cbe',
            'PostAuthentication' => 'arn:aws:lambda:us-east-1:123456789012:function:MyFunction',
            'PostConfirmation' => 'arn:aws:lambda:us-east-1:123456789012:function:MyFunction',
            'PreAuthentication' => 'arn:aws:lambda:us-east-1:123456789012:function:MyFunction',
            'PreSignUp' => 'arn:aws:lambda:us-east-1:123456789012:function:MyFunction',
            'PreTokenGeneration' => 'arn:aws:lambda:us-east-1:123456789012:function:MyFunction',
            'UserMigration' => 'arn:aws:lambda:us-east-1:123456789012:function:MyFunction',
            'VerifyAuthChallengeResponse' => 'arn:aws:lambda:us-east-1:123456789012:function:MyFunction',
        ],
        'LastModifiedDate' => ,
        'MfaConfiguration' => 'OPTIONAL',
        'Name' => 'my-test-user-pool',
        'Policies' => [
            'PasswordPolicy' => [
                'MinimumLength' => 6,
                'RequireLowercase' => 1,
                'RequireNumbers' => 1,
                'RequireSymbols' => 1,
                'RequireUppercase' => 1,
                'TemporaryPasswordValidityDays' => 7,
            ],
        ],
        'SchemaAttributes' => [
            [
                'AttributeDataType' => 'String',
                'DeveloperOnlyAttribute' => ,
                'Mutable' => ,
                'Name' => 'sub',
                'Required' => 1,
                'StringAttributeConstraints' => [
                    'MaxLength' => '2048',
                    'MinLength' => '1',
                ],
            ],
            [
                'AttributeDataType' => 'String',
                'DeveloperOnlyAttribute' => ,
                'Mutable' => 1,
                'Name' => 'name',
                'Required' => ,
                'StringAttributeConstraints' => [
                    'MaxLength' => '2048',
                    'MinLength' => '0',
                ],
            ],
            [
                'AttributeDataType' => 'String',
                'DeveloperOnlyAttribute' => ,
                'Mutable' => 1,
                'Name' => 'given_name',
                'Required' => ,
                'StringAttributeConstraints' => [
                    'MaxLength' => '2048',
                    'MinLength' => '0',
                ],
            ],
            [
                'AttributeDataType' => 'String',
                'DeveloperOnlyAttribute' => ,
                'Mutable' => 1,
                'Name' => 'family_name',
                'Required' => ,
                'StringAttributeConstraints' => [
                    'MaxLength' => '2048',
                    'MinLength' => '0',
                ],
            ],
            [
                'AttributeDataType' => 'String',
                'DeveloperOnlyAttribute' => ,
                'Mutable' => 1,
                'Name' => 'middle_name',
                'Required' => ,
                'StringAttributeConstraints' => [
                    'MaxLength' => '2048',
                    'MinLength' => '0',
                ],
            ],
            [
                'AttributeDataType' => 'String',
                'DeveloperOnlyAttribute' => ,
                'Mutable' => 1,
                'Name' => 'nickname',
                'Required' => ,
                'StringAttributeConstraints' => [
                    'MaxLength' => '2048',
                    'MinLength' => '0',
                ],
            ],
            [
                'AttributeDataType' => 'String',
                'DeveloperOnlyAttribute' => ,
                'Mutable' => 1,
                'Name' => 'preferred_username',
                'Required' => ,
                'StringAttributeConstraints' => [
                    'MaxLength' => '2048',
                    'MinLength' => '0',
                ],
            ],
            [
                'AttributeDataType' => 'String',
                'DeveloperOnlyAttribute' => ,
                'Mutable' => 1,
                'Name' => 'profile',
                'Required' => ,
                'StringAttributeConstraints' => [
                    'MaxLength' => '2048',
                    'MinLength' => '0',
                ],
            ],
            [
                'AttributeDataType' => 'String',
                'DeveloperOnlyAttribute' => ,
                'Mutable' => 1,
                'Name' => 'picture',
                'Required' => ,
                'StringAttributeConstraints' => [
                    'MaxLength' => '2048',
                    'MinLength' => '0',
                ],
            ],
            [
                'AttributeDataType' => 'String',
                'DeveloperOnlyAttribute' => ,
                'Mutable' => 1,
                'Name' => 'website',
                'Required' => ,
                'StringAttributeConstraints' => [
                    'MaxLength' => '2048',
                    'MinLength' => '0',
                ],
            ],
            [
                'AttributeDataType' => 'String',
                'DeveloperOnlyAttribute' => ,
                'Mutable' => 1,
                'Name' => 'email',
                'Required' => ,
                'StringAttributeConstraints' => [
                    'MaxLength' => '2048',
                    'MinLength' => '0',
                ],
            ],
            [
                'AttributeDataType' => 'Boolean',
                'DeveloperOnlyAttribute' => ,
                'Mutable' => 1,
                'Name' => 'email_verified',
                'Required' => ,
            ],
            [
                'AttributeDataType' => 'String',
                'DeveloperOnlyAttribute' => ,
                'Mutable' => 1,
                'Name' => 'gender',
                'Required' => ,
                'StringAttributeConstraints' => [
                    'MaxLength' => '2048',
                    'MinLength' => '0',
                ],
            ],
            [
                'AttributeDataType' => 'String',
                'DeveloperOnlyAttribute' => ,
                'Mutable' => 1,
                'Name' => 'birthdate',
                'Required' => ,
                'StringAttributeConstraints' => [
                    'MaxLength' => '10',
                    'MinLength' => '10',
                ],
            ],
            [
                'AttributeDataType' => 'String',
                'DeveloperOnlyAttribute' => ,
                'Mutable' => 1,
                'Name' => 'zoneinfo',
                'Required' => ,
                'StringAttributeConstraints' => [
                    'MaxLength' => '2048',
                    'MinLength' => '0',
                ],
            ],
            [
                'AttributeDataType' => 'String',
                'DeveloperOnlyAttribute' => ,
                'Mutable' => 1,
                'Name' => 'locale',
                'Required' => ,
                'StringAttributeConstraints' => [
                    'MaxLength' => '2048',
                    'MinLength' => '0',
                ],
            ],
            [
                'AttributeDataType' => 'String',
                'DeveloperOnlyAttribute' => ,
                'Mutable' => 1,
                'Name' => 'phone_number',
                'Required' => ,
                'StringAttributeConstraints' => [
                    'MaxLength' => '2048',
                    'MinLength' => '0',
                ],
            ],
            [
                'AttributeDataType' => 'Boolean',
                'DeveloperOnlyAttribute' => ,
                'Mutable' => 1,
                'Name' => 'phone_number_verifie',
                'Required' => ,
            ],
            [
                'AttributeDataType' => 'String',
                'DeveloperOnlyAttribute' => ,
                'Mutable' => 1,
                'Name' => 'address',
                'Required' => ,
                'StringAttributeConstraints' => [
                    'MaxLength' => '2048',
                    'MinLength' => '0',
                ],
            ],
            [
                'AttributeDataType' => 'Number',
                'DeveloperOnlyAttribute' => ,
                'Mutable' => 1,
                'Name' => 'updated_at',
                'NumberAttributeConstraints' => [
                    'MinValue' => '0',
                ],
                'Required' => ,
            ],
            [
                'AttributeDataType' => 'Number',
                'DeveloperOnlyAttribute' => 1,
                'Mutable' => 1,
                'Name' => 'dev:custom:mydev',
                'NumberAttributeConstraints' => [
                    'MaxValue' => '99',
                    'MinValue' => '1',
                ],
                'Required' => ,
            ],
        ],
        'SmsAuthenticationMessage' => 'Your verification code is {####}.',
        'SmsConfiguration' => [
            'ExternalId' => 'my-role-external-id',
            'SnsCallerArn' => 'arn:aws:iam::123456789012:role/service-role/test-cognito-SMS-Role',
            'SnsRegion' => 'us-east-1',
        ],
        'SmsVerificationMessage' => 'Your verification code is {####}.',
        'UserAttributeUpdateSettings' => [
            'AttributesRequireVerificationBeforeUpdate' => [
                'email',
            ],
        ],
        'UserPoolAddOns' => [
            'AdvancedSecurityMode' => 'OFF',
        ],
        'UserPoolTags' => [
            'my-test-tag-key' => 'my-test-tag-value',
        ],
        'UsernameConfiguration' => [
            'CaseSensitive' => 1,
        ],
        'VerificationMessageTemplate' => [
            'DefaultEmailOption' => 'CONFIRM_WITH_CODE',
            'EmailMessage' => 'Your confirmation code is {####}',
            'EmailMessageByLink' => 'Choose this link to {##verify your email##}',
            'EmailSubject' => 'Here is your confirmation code',
            'EmailSubjectByLink' => 'Here is your confirmation link',
            'SmsMessage' => 'Your confirmation code is {####}',
        ],
    ],
]

CreateUserPoolClient

$result = $client->createUserPoolClient([/* ... */]);
$promise = $client->createUserPoolClientAsync([/* ... */]);

Creates an app client in a user pool. This operation sets basic and advanced configuration options. You can create an app client in the Amazon Cognito console to your preferences and use the output of DescribeUserPoolClient to generate requests from that baseline.

New app clients activate token revocation by default. For more information about revoking tokens, see RevokeToken.

If you don't provide a value for an attribute, Amazon Cognito sets it to its default value.

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

Learn more

Parameter Syntax

$result = $client->createUserPoolClient([
    'AccessTokenValidity' => <integer>,
    'AllowedOAuthFlows' => ['<string>', ...],
    'AllowedOAuthFlowsUserPoolClient' => true || false,
    'AllowedOAuthScopes' => ['<string>', ...],
    'AnalyticsConfiguration' => [
        'ApplicationArn' => '<string>',
        'ApplicationId' => '<string>',
        'ExternalId' => '<string>',
        'RoleArn' => '<string>',
        'UserDataShared' => true || false,
    ],
    'AuthSessionValidity' => <integer>,
    'CallbackURLs' => ['<string>', ...],
    'ClientName' => '<string>', // REQUIRED
    'DefaultRedirectURI' => '<string>',
    'EnablePropagateAdditionalUserContextData' => true || false,
    'EnableTokenRevocation' => true || false,
    'ExplicitAuthFlows' => ['<string>', ...],
    'GenerateSecret' => true || false,
    'IdTokenValidity' => <integer>,
    'LogoutURLs' => ['<string>', ...],
    'PreventUserExistenceErrors' => 'LEGACY|ENABLED',
    'ReadAttributes' => ['<string>', ...],
    'RefreshTokenValidity' => <integer>,
    'SupportedIdentityProviders' => ['<string>', ...],
    'TokenValidityUnits' => [
        'AccessToken' => 'seconds|minutes|hours|days',
        'IdToken' => 'seconds|minutes|hours|days',
        'RefreshToken' => 'seconds|minutes|hours|days',
    ],
    'UserPoolId' => '<string>', // REQUIRED
    'WriteAttributes' => ['<string>', ...],
]);

Parameter Details

Members
AccessTokenValidity
Type: int

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.

If you don't specify otherwise in the configuration of your app client, your access tokens are valid for one hour.

AllowedOAuthFlows
Type: Array of strings

The OAuth grant types that you want your app client to generate. To create an app client that generates client credentials grants, you must add client_credentials as the only allowed OAuth flow.

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.

AllowedOAuthFlowsUserPoolClient
Type: boolean

Set to true to use OAuth 2.0 features in your user pool app client.

AllowedOAuthFlowsUserPoolClient must be true before you can configure the following features in your app client.

  • CallBackURLs: Callback URLs.

  • LogoutURLs: Sign-out redirect URLs.

  • AllowedOAuthScopes: OAuth 2.0 scopes.

  • AllowedOAuthFlows: Support for authorization code, implicit, and client credentials OAuth 2.0 grants.

To use OAuth 2.0 features, configure one of these features in the Amazon Cognito console or set AllowedOAuthFlowsUserPoolClient to true in a CreateUserPoolClient or UpdateUserPoolClient API request. If you don't set a value for AllowedOAuthFlowsUserPoolClient in a request with the CLI or SDKs, it defaults to false.

AllowedOAuthScopes
Type: Array of strings

The OAuth 2.0 scopes that you want to permit your app client to authorize. Scopes govern access control to user pool self-service API operations, user data from the userInfo endpoint, and third-party APIs. 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.

AnalyticsConfiguration
Type: AnalyticsConfigurationType structure

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

In Amazon Web Services Regions where Amazon Pinpoint isn't available, user pools might not have access to analytics or might be configurable with campaigns in the US East (N. Virginia) Region. For more information, see Using Amazon Pinpoint analytics.

AuthSessionValidity
Type: int

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.

CallbackURLs
Type: Array of strings

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

A redirect URI must:

  • Be an absolute URI.

  • Be registered with the authorization server. Amazon Cognito doesn't accept authorization requests with redirect_uri values that aren't in the list of CallbackURLs that you provide in this parameter.

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

ClientName
Required: Yes
Type: string

A friendly name for the app client that you want to create.

DefaultRedirectURI
Type: string

The default redirect URI. In app clients with one assigned IdP, replaces redirect_uri in authentication requests. Must be in the CallbackURLs list.

EnablePropagateAdditionalUserContextData
Type: 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.

EnableTokenRevocation
Type: 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.

ExplicitAuthFlows
Type: Array of strings

The authentication flows that you want your user pool client to support. For each app client in your user pool, you can sign in your users with any combination of one or more flows, including with a user name and Secure Remote Password (SRP), a user name and password, or a custom authentication process that you define with Lambda functions.

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

Valid values include:

  • ALLOW_USER_AUTH: Enable selection-based sign-in with USER_AUTH. This setting covers username-password, secure remote password (SRP), passwordless, and passkey authentication. This authentiation flow can do username-password and SRP authentication without other ExplicitAuthFlows permitting them. For example users can complete an SRP challenge through USER_AUTH without the flow USER_SRP_AUTH being active for the app client. This flow doesn't include CUSTOM_AUTH.

  • 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, your app passes a user name and password to Amazon Cognito in the request, instead of using the Secure Remote Password (SRP) protocol to securely transmit the password.

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

In some environments, you will see the values ADMIN_NO_SRP_AUTH, CUSTOM_AUTH_FLOW_ONLY, or USER_PASSWORD_AUTH. You can't assign these legacy ExplicitAuthFlows values to user pool clients at the same time as values that begin with ALLOW_, like ALLOW_USER_SRP_AUTH.

GenerateSecret
Type: boolean

When true, generates a client secret for the app client. Client secrets are used with server-side and machine-to-machine applications. For more information, see App client types.

IdTokenValidity
Type: int

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 IdTokenValidity in an API request is hours. Valid range is displayed below in seconds.

If you don't specify otherwise in the configuration of your app client, your ID tokens are valid for one hour.

LogoutURLs
Type: Array of strings

A list of allowed logout URLs for managed login authentication. For more information, see Logout endpoint.

PreventUserExistenceErrors
Type: 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.

Defaults to LEGACY when you don't provide a value.

ReadAttributes
Type: Array of strings

The list of user attributes that you want your app client to have read access to. After your user authenticates in your app, their access token authorizes them to read their own attribute value for any attribute in this list. An example of this kind of activity is when your user selects a link to view their profile information. Your app makes a GetUser API request to retrieve and display your user's profile data.

When you don't specify the ReadAttributes for your app client, your app can read the values of email_verified, phone_number_verified, and the Standard attributes of your user pool. When your user pool app client has read access to these default attributes, ReadAttributes doesn't return any information. Amazon Cognito only populates ReadAttributes in the API response if you have specified your own custom set of read attributes.

RefreshTokenValidity
Type: int

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.

If you don't specify otherwise in the configuration of your app client, your refresh tokens are valid for 30 days.

SupportedIdentityProviders
Type: Array of strings

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.

This setting applies to providers that you can access with managed login. The removal of COGNITO from this list doesn't prevent authentication operations for local users with the user pools API in an Amazon Web Services SDK. The only way to prevent API-based authentication is to block access with a WAF rule.

TokenValidityUnits
Type: TokenValidityUnitsType structure

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

UserPoolId
Required: Yes
Type: string

The ID of the user pool where you want to create an app client.

WriteAttributes
Type: Array of strings

The list of user attributes that you want your app client to have write access to. After your user authenticates in your app, their access token authorizes them to set or modify their own attribute value for any attribute in this list. An example of this kind of activity is when you present your user with a form to update their profile information and they change their last name. Your app then makes an UpdateUserAttributes API request and sets family_name to the new value.

When you don't specify the WriteAttributes for your app client, your app can write the values of the Standard attributes of your user pool. When your user pool has write access to these default attributes, WriteAttributes doesn't return any information. Amazon Cognito only populates WriteAttributes in the API response if you have specified your own custom set of write attributes.

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.

Result Syntax

[
    'UserPoolClient' => [
        'AccessTokenValidity' => <integer>,
        'AllowedOAuthFlows' => ['<string>', ...],
        'AllowedOAuthFlowsUserPoolClient' => true || false,
        'AllowedOAuthScopes' => ['<string>', ...],
        'AnalyticsConfiguration' => [
            'ApplicationArn' => '<string>',
            'ApplicationId' => '<string>',
            'ExternalId' => '<string>',
            'RoleArn' => '<string>',
            'UserDataShared' => true || false,
        ],
        'AuthSessionValidity' => <integer>,
        'CallbackURLs' => ['<string>', ...],
        'ClientId' => '<string>',
        'ClientName' => '<string>',
        'ClientSecret' => '<string>',
        'CreationDate' => <DateTime>,
        'DefaultRedirectURI' => '<string>',
        'EnablePropagateAdditionalUserContextData' => true || false,
        'EnableTokenRevocation' => true || false,
        'ExplicitAuthFlows' => ['<string>', ...],
        'IdTokenValidity' => <integer>,
        'LastModifiedDate' => <DateTime>,
        'LogoutURLs' => ['<string>', ...],
        'PreventUserExistenceErrors' => 'LEGACY|ENABLED',
        'ReadAttributes' => ['<string>', ...],
        'RefreshTokenValidity' => <integer>,
        'SupportedIdentityProviders' => ['<string>', ...],
        'TokenValidityUnits' => [
            'AccessToken' => 'seconds|minutes|hours|days',
            'IdToken' => 'seconds|minutes|hours|days',
            'RefreshToken' => 'seconds|minutes|hours|days',
        ],
        'UserPoolId' => '<string>',
        'WriteAttributes' => ['<string>', ...],
    ],
]

Result Details

Members
UserPoolClient
Type: UserPoolClientType structure

The details of the new app client.

Errors

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

LimitExceededException:

This exception is thrown when a user exceeds the limit for a requested Amazon Web Services resource.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

ScopeDoesNotExistException:

This exception is thrown when the specified scope doesn't exist.

InvalidOAuthFlowException:

This exception is thrown when the specified OAuth flow is not valid.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

Examples

Example 1: Example user pool app client with email and username sign-in

The following example creates an app client with all configurable properties set to an example value. The resulting user pool client connects to an analytics client, allows sign-in with username and password, and has two external identity providers associated with it.

$result = $client->createUserPoolClient([
    'AccessTokenValidity' => 6,
    'AllowedOAuthFlows' => [
        'code',
    ],
    'AllowedOAuthFlowsUserPoolClient' => 1,
    'AllowedOAuthScopes' => [
        'aws.cognito.signin.user.admin',
        'openid',
    ],
    'AnalyticsConfiguration' => [
        'ApplicationId' => 'd70b2ba36a8c4dc5a04a0451a31a1e12',
        'ExternalId' => 'my-external-id',
        'RoleArn' => 'arn:aws:iam::123456789012:role/test-cognitouserpool-role',
        'UserDataShared' => 1,
    ],
    'CallbackURLs' => [
        'https://example.com',
        'http://localhost',
        'myapp://example',
    ],
    'ClientName' => 'my-test-app-client',
    'DefaultRedirectURI' => 'https://example.com',
    'ExplicitAuthFlows' => [
        'ALLOW_ADMIN_USER_PASSWORD_AUTH',
        'ALLOW_USER_PASSWORD_AUTH',
        'ALLOW_REFRESH_TOKEN_AUTH',
    ],
    'GenerateSecret' => 1,
    'IdTokenValidity' => 6,
    'LogoutURLs' => [
        'https://example.com/logout',
    ],
    'PreventUserExistenceErrors' => 'ENABLED',
    'ReadAttributes' => [
        'email',
        'address',
        'preferred_username',
    ],
    'RefreshTokenValidity' => 6,
    'SupportedIdentityProviders' => [
        'SignInWithApple',
        'MySSO',
    ],
    'TokenValidityUnits' => [
        'AccessToken' => 'hours',
        'IdToken' => 'minutes',
        'RefreshToken' => 'days',
    ],
    'UserPoolId' => 'us-east-1_EXAMPLE',
    'WriteAttributes' => [
        'family_name',
        'email',
    ],
]);

Result syntax:

[
    'UserPoolClient' => [
        'AccessTokenValidity' => 6,
        'AllowedOAuthFlows' => [
            'code',
        ],
        'AllowedOAuthFlowsUserPoolClient' => 1,
        'AllowedOAuthScopes' => [
            'aws.cognito.signin.user.admin',
            'openid',
        ],
        'AnalyticsConfiguration' => [
            'ApplicationId' => 'd70b2ba36a8c4dc5a04a0451a31a1e12',
            'ExternalId' => 'my-external-id',
            'RoleArn' => 'arn:aws:iam::123456789012:role/test-cognitouserpool-role',
            'UserDataShared' => 1,
        ],
        'AuthSessionValidity' => 3,
        'CallbackURLs' => [
            'https://example.com',
            'http://localhost',
            'myapp://example',
        ],
        'ClientId' => '26cb2c60kq7nbmas7rbme9b6pp',
        'ClientName' => 'my-test-app-client',
        'ClientSecret' => '13ka4h7u28d9oo44tqpq9djqsfvhvu8rk4d2ighvpu0k8fj1c2r9',
        'CreationDate' => ,
        'DefaultRedirectURI' => 'https://example.com',
        'EnablePropagateAdditionalUserContextData' => ,
        'EnableTokenRevocation' => 1,
        'ExplicitAuthFlows' => [
            'ALLOW_USER_PASSWORD_AUTH',
            'ALLOW_ADMIN_USER_PASSWORD_AUTH',
            'ALLOW_REFRESH_TOKEN_AUTH',
        ],
        'IdTokenValidity' => 6,
        'LastModifiedDate' => ,
        'LogoutURLs' => [
            'https://example.com/logout',
        ],
        'PreventUserExistenceErrors' => 'ENABLED',
        'ReadAttributes' => [
            'address',
            'preferred_username',
            'email',
        ],
        'RefreshTokenValidity' => 6,
        'SupportedIdentityProviders' => [
            'SignInWithApple',
            'MySSO',
        ],
        'TokenValidityUnits' => [
            'AccessToken' => 'hours',
            'IdToken' => 'minutes',
            'RefreshToken' => 'days',
        ],
        'UserPoolId' => 'us-east-1_EXAMPLE',
        'WriteAttributes' => [
            'family_name',
            'email',
        ],
    ],
]

CreateUserPoolDomain

$result = $client->createUserPoolDomain([/* ... */]);
$promise = $client->createUserPoolDomainAsync([/* ... */]);

A user pool domain hosts managed login, an authorization server and web server for authentication in your application. This operation creates a new user pool prefix or custom domain and sets the managed login branding version. Set the branding version to 1 for hosted UI (classic) or 2 for managed login. When you choose a custom domain, you must provide an SSL certificate in the US East (N. Virginia) Amazon Web Services Region in your request.

Your prefix domain might take up to one minute to take effect. Your custom domain is online within five minutes, but it can take up to one hour to distribute your SSL certificate.

For more information about adding a custom domain to your user pool, see Configuring a user pool domain.

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

Learn more

Parameter Syntax

$result = $client->createUserPoolDomain([
    'CustomDomainConfig' => [
        'CertificateArn' => '<string>', // REQUIRED
    ],
    'Domain' => '<string>', // REQUIRED
    'ManagedLoginVersion' => <integer>,
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
CustomDomainConfig
Type: CustomDomainConfigType structure

The configuration for a custom domain. Configures your domain with an Certificate Manager certificate in the us-east-1 Region.

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

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

Domain
Required: Yes
Type: string

The domain string. For custom domains, this is the fully-qualified domain name, such as auth.example.com. For prefix domains, this is the prefix alone, such as myprefix. A prefix value of myprefix for a user pool in the us-east-1 Region results in a domain of myprefix.auth.us-east-1.amazoncognito.com.

ManagedLoginVersion
Type: int

The version of managed login branding that you want to apply to your domain. A value of 1 indicates hosted UI (classic) and a version of 2 indicates managed login.

Managed login requires that your user pool be configured for any feature plan other than Lite.

UserPoolId
Required: Yes
Type: string

The ID of the user pool where you want to add a domain.

Result Syntax

[
    'CloudFrontDomain' => '<string>',
    'ManagedLoginVersion' => <integer>,
]

Result Details

Members
CloudFrontDomain
Type: 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. Amazon Cognito returns this value if you set a custom domain with CustomDomainConfig. If you set an Amazon Cognito prefix domain, this operation returns a blank response.

ManagedLoginVersion
Type: int

The version of managed login branding applied your domain. A value of 1 indicates hosted UI (classic) and a version of 2 indicates managed login.

Errors

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

LimitExceededException:

This exception is thrown when a user exceeds the limit for a requested Amazon Web Services resource.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

FeatureUnavailableInTierException:

This exception is thrown when a feature you attempted to configure isn't available in your current feature plan.

DeleteGroup

$result = $client->deleteGroup([/* ... */]);
$promise = $client->deleteGroupAsync([/* ... */]);

Deletes a group from the specified user pool. When you delete a group, that group no longer contributes to users' cognito:preferred_group or cognito:groups claims, and no longer influence access-control decision that are based on group membership. For more information about user pool groups, see Adding groups to a user pool.

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

Learn more

Parameter Syntax

$result = $client->deleteGroup([
    'GroupName' => '<string>', // REQUIRED
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
GroupName
Required: Yes
Type: string

The name of the group that you want to delete.

UserPoolId
Required: Yes
Type: string

The ID of the user pool where you want to delete the group.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

DeleteIdentityProvider

$result = $client->deleteIdentityProvider([/* ... */]);
$promise = $client->deleteIdentityProviderAsync([/* ... */]);

Deletes a user pool identity provider (IdP). After you delete an IdP, users can no longer sign in to your user pool through that IdP. For more information about user pool IdPs, see Third-party IdP sign-in.

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

Learn more

Parameter Syntax

$result = $client->deleteIdentityProvider([
    'ProviderName' => '<string>', // REQUIRED
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
ProviderName
Required: Yes
Type: string

The name of the IdP that you want to delete.

UserPoolId
Required: Yes
Type: string

The ID of the user pool where you want to delete the identity provider.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

UnsupportedIdentityProviderException:

This exception is thrown when the specified identifier isn't supported.

ConcurrentModificationException:

This exception is thrown if two or more modifications are happening concurrently.

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

DeleteManagedLoginBranding

$result = $client->deleteManagedLoginBranding([/* ... */]);
$promise = $client->deleteManagedLoginBrandingAsync([/* ... */]);

Deletes a managed login branding style. When you delete a style, you delete the branding association for an app client. When an app client doesn't have a style assigned, your managed login pages for that app client are nonfunctional until you create a new style or switch the domain branding version.

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

Learn more

Parameter Syntax

$result = $client->deleteManagedLoginBranding([
    'ManagedLoginBrandingId' => '<string>', // REQUIRED
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
ManagedLoginBrandingId
Required: Yes
Type: string

The ID of the managed login branding style that you want to delete.

UserPoolId
Required: Yes
Type: string

The ID of the user pool that contains the managed login branding style that you want to delete.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

ConcurrentModificationException:

This exception is thrown if two or more modifications are happening concurrently.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

DeleteResourceServer

$result = $client->deleteResourceServer([/* ... */]);
$promise = $client->deleteResourceServerAsync([/* ... */]);

Deletes a resource server. After you delete a resource server, users can no longer generate access tokens with scopes that are associate with that resource server.

Resource servers are associated with custom scopes and machine-to-machine (M2M) authorization. For more information, see Access control with resource servers.

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

Learn more

Parameter Syntax

$result = $client->deleteResourceServer([
    'Identifier' => '<string>', // REQUIRED
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
Identifier
Required: Yes
Type: string

The identifier of the resource server that you want to delete.

UserPoolId
Required: Yes
Type: string

The ID of the user pool where you want to delete the resource server.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

DeleteUser

$result = $client->deleteUser([/* ... */]);
$promise = $client->deleteUserAsync([/* ... */]);

Self-deletes a user profile. A deleted user profile can no longer be used to sign in and can't be restored.

Authorize this action with a signed-in user's access token. It must include the scope aws.cognito.signin.user.admin.

Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.

Parameter Syntax

$result = $client->deleteUser([
    'AccessToken' => '<string>', // REQUIRED
]);

Parameter Details

Members
AccessToken
Required: Yes
Type: string

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

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

PasswordResetRequiredException:

This exception is thrown when a password reset is required.

UserNotFoundException:

This exception is thrown when a user isn't found.

UserNotConfirmedException:

This exception is thrown when a user isn't confirmed successfully.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

ForbiddenException:

This exception is thrown when WAF doesn't allow your request based on a web ACL that's associated with your user pool.

DeleteUserAttributes

$result = $client->deleteUserAttributes([/* ... */]);
$promise = $client->deleteUserAttributesAsync([/* ... */]);

Self-deletes attributes for a user. For example, your application can submit a request to this operation when a user wants to remove their birthdate attribute value.

Authorize this action with a signed-in user's access token. It must include the scope aws.cognito.signin.user.admin.

Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.

Parameter Syntax

$result = $client->deleteUserAttributes([
    'AccessToken' => '<string>', // REQUIRED
    'UserAttributeNames' => ['<string>', ...], // REQUIRED
]);

Parameter Details

Members
AccessToken
Required: Yes
Type: string

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

UserAttributeNames
Required: Yes
Type: Array of strings

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, for example custom:department.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

PasswordResetRequiredException:

This exception is thrown when a password reset is required.

UserNotFoundException:

This exception is thrown when a user isn't found.

UserNotConfirmedException:

This exception is thrown when a user isn't confirmed successfully.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

ForbiddenException:

This exception is thrown when WAF doesn't allow your request based on a web ACL that's associated with your user pool.

DeleteUserPool

$result = $client->deleteUserPool([/* ... */]);
$promise = $client->deleteUserPoolAsync([/* ... */]);

Deletes a user pool. After you delete a user pool, users can no longer sign in to any associated applications.

Parameter Syntax

$result = $client->deleteUserPool([
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
UserPoolId
Required: Yes
Type: string

The ID of the user pool that you want to delete.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

UserImportInProgressException:

This exception is thrown when you're trying to modify a user pool while a user import job is in progress for that pool.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

DeleteUserPoolClient

$result = $client->deleteUserPoolClient([/* ... */]);
$promise = $client->deleteUserPoolClientAsync([/* ... */]);

Deletes a user pool app client. After you delete an app client, users can no longer sign in to the associated application.

Parameter Syntax

$result = $client->deleteUserPoolClient([
    'ClientId' => '<string>', // REQUIRED
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
ClientId
Required: Yes
Type: string

The ID of the user pool app client that you want to delete.

UserPoolId
Required: Yes
Type: string

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

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

ConcurrentModificationException:

This exception is thrown if two or more modifications are happening concurrently.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

DeleteUserPoolDomain

$result = $client->deleteUserPoolDomain([/* ... */]);
$promise = $client->deleteUserPoolDomainAsync([/* ... */]);

Given a user pool ID and domain identifier, deletes a user pool domain. After you delete a user pool domain, your managed login pages and authorization server are no longer available.

Parameter Syntax

$result = $client->deleteUserPoolDomain([
    'Domain' => '<string>', // REQUIRED
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
Domain
Required: Yes
Type: string

The domain that you want to delete. 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
Required: Yes
Type: string

The ID of the user pool where you want to delete the domain.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

DeleteWebAuthnCredential

$result = $client->deleteWebAuthnCredential([/* ... */]);
$promise = $client->deleteWebAuthnCredentialAsync([/* ... */]);

Deletes a registered passkey, or webauthN, authenticator for the currently signed-in user.

Authorize this action with a signed-in user's access token. It must include the scope aws.cognito.signin.user.admin.

Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.

Parameter Syntax

$result = $client->deleteWebAuthnCredential([
    'AccessToken' => '<string>', // REQUIRED
    'CredentialId' => '<string>', // REQUIRED
]);

Parameter Details

Members
AccessToken
Required: Yes
Type: string

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

CredentialId
Required: Yes
Type: string

The unique identifier of the passkey that you want to delete. Look up registered devices with ListWebAuthnCredentials.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ForbiddenException:

This exception is thrown when WAF doesn't allow your request based on a web ACL that's associated with your user pool.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

DescribeIdentityProvider

$result = $client->describeIdentityProvider([/* ... */]);
$promise = $client->describeIdentityProviderAsync([/* ... */]);

Given a user pool ID and identity provider (IdP) name, returns details about the IdP.

Parameter Syntax

$result = $client->describeIdentityProvider([
    'ProviderName' => '<string>', // REQUIRED
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
ProviderName
Required: Yes
Type: string

The name of the IdP that you want to describe.

UserPoolId
Required: Yes
Type: string

The ID of the user pool that has the IdP that you want to describe..

Result Syntax

[
    'IdentityProvider' => [
        'AttributeMapping' => ['<string>', ...],
        'CreationDate' => <DateTime>,
        'IdpIdentifiers' => ['<string>', ...],
        'LastModifiedDate' => <DateTime>,
        'ProviderDetails' => ['<string>', ...],
        'ProviderName' => '<string>',
        'ProviderType' => 'SAML|Facebook|Google|LoginWithAmazon|SignInWithApple|OIDC',
        'UserPoolId' => '<string>',
    ],
]

Result Details

Members
IdentityProvider
Required: Yes
Type: IdentityProviderType structure

The details of the requested IdP.

Errors

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

DescribeManagedLoginBranding

$result = $client->describeManagedLoginBranding([/* ... */]);
$promise = $client->describeManagedLoginBrandingAsync([/* ... */]);

Given the ID of a managed login branding style, returns detailed information about the style.

Parameter Syntax

$result = $client->describeManagedLoginBranding([
    'ManagedLoginBrandingId' => '<string>', // REQUIRED
    'ReturnMergedResources' => true || false,
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
ManagedLoginBrandingId
Required: Yes
Type: string

The ID of the managed login branding style that you want to get more information about.

ReturnMergedResources
Type: boolean

When true, returns values for branding options that are unchanged from Amazon Cognito defaults. When false or when you omit this parameter, returns only values that you customized in your branding style.

UserPoolId
Required: Yes
Type: string

The ID of the user pool that contains the managed login branding style that you want to get information about.

Result Syntax

[
    'ManagedLoginBranding' => [
        'Assets' => [
            [
                'Bytes' => <string || resource || Psr\Http\Message\StreamInterface>,
                'Category' => 'FAVICON_ICO|FAVICON_SVG|EMAIL_GRAPHIC|SMS_GRAPHIC|AUTH_APP_GRAPHIC|PASSWORD_GRAPHIC|PASSKEY_GRAPHIC|PAGE_HEADER_LOGO|PAGE_HEADER_BACKGROUND|PAGE_FOOTER_LOGO|PAGE_FOOTER_BACKGROUND|PAGE_BACKGROUND|FORM_BACKGROUND|FORM_LOGO|IDP_BUTTON_ICON',
                'ColorMode' => 'LIGHT|DARK|DYNAMIC',
                'Extension' => 'ICO|JPEG|PNG|SVG|WEBP',
                'ResourceId' => '<string>',
            ],
            // ...
        ],
        'CreationDate' => <DateTime>,
        'LastModifiedDate' => <DateTime>,
        'ManagedLoginBrandingId' => '<string>',
        'Settings' => [
        ],
        'UseCognitoProvidedValues' => true || false,
        'UserPoolId' => '<string>',
    ],
]

Result Details

Members
ManagedLoginBranding
Type: ManagedLoginBrandingType structure

The details of the requested branding style.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

DescribeManagedLoginBrandingByClient

$result = $client->describeManagedLoginBrandingByClient([/* ... */]);
$promise = $client->describeManagedLoginBrandingByClientAsync([/* ... */]);

Given the ID of a user pool app client, returns detailed information about the style assigned to the app client.

Parameter Syntax

$result = $client->describeManagedLoginBrandingByClient([
    'ClientId' => '<string>', // REQUIRED
    'ReturnMergedResources' => true || false,
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
ClientId
Required: Yes
Type: string

The app client that's assigned to the branding style that you want more information about.

ReturnMergedResources
Type: boolean

When true, returns values for branding options that are unchanged from Amazon Cognito defaults. When false or when you omit this parameter, returns only values that you customized in your branding style.

UserPoolId
Required: Yes
Type: string

The ID of the user pool that contains the app client where you want more information about the managed login branding style.

Result Syntax

[
    'ManagedLoginBranding' => [
        'Assets' => [
            [
                'Bytes' => <string || resource || Psr\Http\Message\StreamInterface>,
                'Category' => 'FAVICON_ICO|FAVICON_SVG|EMAIL_GRAPHIC|SMS_GRAPHIC|AUTH_APP_GRAPHIC|PASSWORD_GRAPHIC|PASSKEY_GRAPHIC|PAGE_HEADER_LOGO|PAGE_HEADER_BACKGROUND|PAGE_FOOTER_LOGO|PAGE_FOOTER_BACKGROUND|PAGE_BACKGROUND|FORM_BACKGROUND|FORM_LOGO|IDP_BUTTON_ICON',
                'ColorMode' => 'LIGHT|DARK|DYNAMIC',
                'Extension' => 'ICO|JPEG|PNG|SVG|WEBP',
                'ResourceId' => '<string>',
            ],
            // ...
        ],
        'CreationDate' => <DateTime>,
        'LastModifiedDate' => <DateTime>,
        'ManagedLoginBrandingId' => '<string>',
        'Settings' => [
        ],
        'UseCognitoProvidedValues' => true || false,
        'UserPoolId' => '<string>',
    ],
]

Result Details

Members
ManagedLoginBranding
Type: ManagedLoginBrandingType structure

The details of the requested branding style.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

DescribeResourceServer

$result = $client->describeResourceServer([/* ... */]);
$promise = $client->describeResourceServerAsync([/* ... */]);

Describes a resource server. For more information about resource servers, see Access control with resource servers.

Parameter Syntax

$result = $client->describeResourceServer([
    'Identifier' => '<string>', // REQUIRED
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
Identifier
Required: Yes
Type: string

A unique resource server identifier for the resource server. The identifier can be an API friendly name like solar-system-data. You can also set an API URL like https://solar-system-data-api.example.com as your identifier.

Amazon Cognito represents scopes in the access token in the format $resource-server-identifier/$scope. Longer scope-identifier strings increase the size of your access tokens.

UserPoolId
Required: Yes
Type: string

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

Result Syntax

[
    'ResourceServer' => [
        'Identifier' => '<string>',
        'Name' => '<string>',
        'Scopes' => [
            [
                'ScopeDescription' => '<string>',
                'ScopeName' => '<string>',
            ],
            // ...
        ],
        'UserPoolId' => '<string>',
    ],
]

Result Details

Members
ResourceServer
Required: Yes
Type: ResourceServerType structure

The details of the requested resource server.

Errors

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

DescribeRiskConfiguration

$result = $client->describeRiskConfiguration([/* ... */]);
$promise = $client->describeRiskConfigurationAsync([/* ... */]);

Given an app client or user pool ID where threat protection is configured, describes the risk configuration. This operation returns details about adaptive authentication, compromised credentials, and IP-address allow- and denylists. For more information about threat protection, see Threat protection.

Parameter Syntax

$result = $client->describeRiskConfiguration([
    'ClientId' => '<string>',
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
ClientId
Type: string

The ID of the app client with the risk configuration that you want to inspect. You can apply default risk configuration at the user pool level and further customize it from user pool defaults at the app-client level. Specify ClientId to inspect client-level configuration, or UserPoolId to inspect pool-level configuration.

UserPoolId
Required: Yes
Type: string

The ID of the user pool with the risk configuration that you want to inspect. You can apply default risk configuration at the user pool level and further customize it from user pool defaults at the app-client level. Specify ClientId to inspect client-level configuration, or UserPoolId to inspect pool-level configuration.

Result Syntax

[
    'RiskConfiguration' => [
        'AccountTakeoverRiskConfiguration' => [
            'Actions' => [
                'HighAction' => [
                    'EventAction' => 'BLOCK|MFA_IF_CONFIGURED|MFA_REQUIRED|NO_ACTION',
                    'Notify' => true || false,
                ],
                'LowAction' => [
                    'EventAction' => 'BLOCK|MFA_IF_CONFIGURED|MFA_REQUIRED|NO_ACTION',
                    'Notify' => true || false,
                ],
                'MediumAction' => [
                    'EventAction' => 'BLOCK|MFA_IF_CONFIGURED|MFA_REQUIRED|NO_ACTION',
                    'Notify' => true || false,
                ],
            ],
            'NotifyConfiguration' => [
                'BlockEmail' => [
                    'HtmlBody' => '<string>',
                    'Subject' => '<string>',
                    'TextBody' => '<string>',
                ],
                'From' => '<string>',
                'MfaEmail' => [
                    'HtmlBody' => '<string>',
                    'Subject' => '<string>',
                    'TextBody' => '<string>',
                ],
                'NoActionEmail' => [
                    'HtmlBody' => '<string>',
                    'Subject' => '<string>',
                    'TextBody' => '<string>',
                ],
                'ReplyTo' => '<string>',
                'SourceArn' => '<string>',
            ],
        ],
        'ClientId' => '<string>',
        'CompromisedCredentialsRiskConfiguration' => [
            'Actions' => [
                'EventAction' => 'BLOCK|NO_ACTION',
            ],
            'EventFilter' => ['<string>', ...],
        ],
        'LastModifiedDate' => <DateTime>,
        'RiskExceptionConfiguration' => [
            'BlockedIPRangeList' => ['<string>', ...],
            'SkippedIPRangeList' => ['<string>', ...],
        ],
        'UserPoolId' => '<string>',
    ],
]

Result Details

Members
RiskConfiguration
Required: Yes
Type: RiskConfigurationType structure

The details of the requested risk configuration.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

UserPoolAddOnNotEnabledException:

This exception is thrown when user pool add-ons aren't enabled.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

DescribeUserImportJob

$result = $client->describeUserImportJob([/* ... */]);
$promise = $client->describeUserImportJobAsync([/* ... */]);

Describes a user import job. For more information about user CSV import, see Importing users from a CSV file.

Parameter Syntax

$result = $client->describeUserImportJob([
    'JobId' => '<string>', // REQUIRED
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
JobId
Required: Yes
Type: string

The Id of the user import job that you want to describe.

UserPoolId
Required: Yes
Type: string

The ID of the user pool that's associated with the import job.

Result Syntax

[
    'UserImportJob' => [
        'CloudWatchLogsRoleArn' => '<string>',
        'CompletionDate' => <DateTime>,
        'CompletionMessage' => '<string>',
        'CreationDate' => <DateTime>,
        'FailedUsers' => <integer>,
        'ImportedUsers' => <integer>,
        'JobId' => '<string>',
        'JobName' => '<string>',
        'PreSignedUrl' => '<string>',
        'SkippedUsers' => <integer>,
        'StartDate' => <DateTime>,
        'Status' => 'Created|Pending|InProgress|Stopping|Expired|Stopped|Failed|Succeeded',
        'UserPoolId' => '<string>',
    ],
]

Result Details

Members
UserImportJob
Type: UserImportJobType structure

The details of the user import job.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

DescribeUserPool

$result = $client->describeUserPool([/* ... */]);
$promise = $client->describeUserPoolAsync([/* ... */]);

Given a user pool ID, returns configuration information. This operation is useful when you want to inspect an existing user pool and programmatically replicate the configuration to another user pool.

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

Learn more

Parameter Syntax

$result = $client->describeUserPool([
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
UserPoolId
Required: Yes
Type: string

The ID of the user pool you want to describe.

Result Syntax

[
    'UserPool' => [
        'AccountRecoverySetting' => [
            'RecoveryMechanisms' => [
                [
                    'Name' => 'verified_email|verified_phone_number|admin_only',
                    'Priority' => <integer>,
                ],
                // ...
            ],
        ],
        'AdminCreateUserConfig' => [
            'AllowAdminCreateUserOnly' => true || false,
            'InviteMessageTemplate' => [
                'EmailMessage' => '<string>',
                'EmailSubject' => '<string>',
                'SMSMessage' => '<string>',
            ],
            'UnusedAccountValidityDays' => <integer>,
        ],
        'AliasAttributes' => ['<string>', ...],
        'Arn' => '<string>',
        'AutoVerifiedAttributes' => ['<string>', ...],
        'CreationDate' => <DateTime>,
        'CustomDomain' => '<string>',
        'DeletionProtection' => 'ACTIVE|INACTIVE',
        'DeviceConfiguration' => [
            'ChallengeRequiredOnNewDevice' => true || false,
            'DeviceOnlyRememberedOnUserPrompt' => true || false,
        ],
        'Domain' => '<string>',
        'EmailConfiguration' => [
            'ConfigurationSet' => '<string>',
            'EmailSendingAccount' => 'COGNITO_DEFAULT|DEVELOPER',
            'From' => '<string>',
            'ReplyToEmailAddress' => '<string>',
            'SourceArn' => '<string>',
        ],
        'EmailConfigurationFailure' => '<string>',
        'EmailVerificationMessage' => '<string>',
        'EmailVerificationSubject' => '<string>',
        'EstimatedNumberOfUsers' => <integer>,
        'Id' => '<string>',
        'LambdaConfig' => [
            'CreateAuthChallenge' => '<string>',
            'CustomEmailSender' => [
                'LambdaArn' => '<string>',
                'LambdaVersion' => 'V1_0',
            ],
            'CustomMessage' => '<string>',
            'CustomSMSSender' => [
                'LambdaArn' => '<string>',
                'LambdaVersion' => 'V1_0',
            ],
            'DefineAuthChallenge' => '<string>',
            'KMSKeyID' => '<string>',
            'PostAuthentication' => '<string>',
            'PostConfirmation' => '<string>',
            'PreAuthentication' => '<string>',
            'PreSignUp' => '<string>',
            'PreTokenGeneration' => '<string>',
            'PreTokenGenerationConfig' => [
                'LambdaArn' => '<string>',
                'LambdaVersion' => 'V1_0|V2_0',
            ],
            'UserMigration' => '<string>',
            'VerifyAuthChallengeResponse' => '<string>',
        ],
        'LastModifiedDate' => <DateTime>,
        'MfaConfiguration' => 'OFF|ON|OPTIONAL',
        'Name' => '<string>',
        'Policies' => [
            'PasswordPolicy' => [
                'MinimumLength' => <integer>,
                'PasswordHistorySize' => <integer>,
                'RequireLowercase' => true || false,
                'RequireNumbers' => true || false,
                'RequireSymbols' => true || false,
                'RequireUppercase' => true || false,
                'TemporaryPasswordValidityDays' => <integer>,
            ],
            'SignInPolicy' => [
                'AllowedFirstAuthFactors' => ['<string>', ...],
            ],
        ],
        'SchemaAttributes' => [
            [
                'AttributeDataType' => 'String|Number|DateTime|Boolean',
                'DeveloperOnlyAttribute' => true || false,
                'Mutable' => true || false,
                'Name' => '<string>',
                'NumberAttributeConstraints' => [
                    'MaxValue' => '<string>',
                    'MinValue' => '<string>',
                ],
                'Required' => true || false,
                'StringAttributeConstraints' => [
                    'MaxLength' => '<string>',
                    'MinLength' => '<string>',
                ],
            ],
            // ...
        ],
        'SmsAuthenticationMessage' => '<string>',
        'SmsConfiguration' => [
            'ExternalId' => '<string>',
            'SnsCallerArn' => '<string>',
            'SnsRegion' => '<string>',
        ],
        'SmsConfigurationFailure' => '<string>',
        'SmsVerificationMessage' => '<string>',
        'Status' => 'Enabled|Disabled',
        'UserAttributeUpdateSettings' => [
            'AttributesRequireVerificationBeforeUpdate' => ['<string>', ...],
        ],
        'UserPoolAddOns' => [
            'AdvancedSecurityAdditionalFlows' => [
                'CustomAuthMode' => 'AUDIT|ENFORCED',
            ],
            'AdvancedSecurityMode' => 'OFF|AUDIT|ENFORCED',
        ],
        'UserPoolTags' => ['<string>', ...],
        'UserPoolTier' => 'LITE|ESSENTIALS|PLUS',
        'UsernameAttributes' => ['<string>', ...],
        'UsernameConfiguration' => [
            'CaseSensitive' => true || false,
        ],
        'VerificationMessageTemplate' => [
            'DefaultEmailOption' => 'CONFIRM_WITH_LINK|CONFIRM_WITH_CODE',
            'EmailMessage' => '<string>',
            'EmailMessageByLink' => '<string>',
            'EmailSubject' => '<string>',
            'EmailSubjectByLink' => '<string>',
            'SmsMessage' => '<string>',
        ],
    ],
]

Result Details

Members
UserPool
Type: UserPoolType structure

The details of the requested user pool.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

UserPoolTaggingException:

This exception is thrown when a user pool tag can't be set or updated.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

DescribeUserPoolClient

$result = $client->describeUserPoolClient([/* ... */]);
$promise = $client->describeUserPoolClientAsync([/* ... */]);

Given an app client ID, returns configuration information. This operation is useful when you want to inspect an existing app client and programmatically replicate the configuration to another app client. For more information about app clients, see App clients.

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

Learn more

Parameter Syntax

$result = $client->describeUserPoolClient([
    'ClientId' => '<string>', // REQUIRED
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
ClientId
Required: Yes
Type: string

The ID of the app client that you want to describe.

UserPoolId
Required: Yes
Type: string

The ID of the user pool that contains the app client you want to describe.

Result Syntax

[
    'UserPoolClient' => [
        'AccessTokenValidity' => <integer>,
        'AllowedOAuthFlows' => ['<string>', ...],
        'AllowedOAuthFlowsUserPoolClient' => true || false,
        'AllowedOAuthScopes' => ['<string>', ...],
        'AnalyticsConfiguration' => [
            'ApplicationArn' => '<string>',
            'ApplicationId' => '<string>',
            'ExternalId' => '<string>',
            'RoleArn' => '<string>',
            'UserDataShared' => true || false,
        ],
        'AuthSessionValidity' => <integer>,
        'CallbackURLs' => ['<string>', ...],
        'ClientId' => '<string>',
        'ClientName' => '<string>',
        'ClientSecret' => '<string>',
        'CreationDate' => <DateTime>,
        'DefaultRedirectURI' => '<string>',
        'EnablePropagateAdditionalUserContextData' => true || false,
        'EnableTokenRevocation' => true || false,
        'ExplicitAuthFlows' => ['<string>', ...],
        'IdTokenValidity' => <integer>,
        'LastModifiedDate' => <DateTime>,
        'LogoutURLs' => ['<string>', ...],
        'PreventUserExistenceErrors' => 'LEGACY|ENABLED',
        'ReadAttributes' => ['<string>', ...],
        'RefreshTokenValidity' => <integer>,
        'SupportedIdentityProviders' => ['<string>', ...],
        'TokenValidityUnits' => [
            'AccessToken' => 'seconds|minutes|hours|days',
            'IdToken' => 'seconds|minutes|hours|days',
            'RefreshToken' => 'seconds|minutes|hours|days',
        ],
        'UserPoolId' => '<string>',
        'WriteAttributes' => ['<string>', ...],
    ],
]

Result Details

Members
UserPoolClient
Type: UserPoolClientType structure

The details of the request app client.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

DescribeUserPoolDomain

$result = $client->describeUserPoolDomain([/* ... */]);
$promise = $client->describeUserPoolDomainAsync([/* ... */]);

Given a user pool domain name, returns information about the domain configuration.

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

Learn more

Parameter Syntax

$result = $client->describeUserPoolDomain([
    'Domain' => '<string>', // REQUIRED
]);

Parameter Details

Members
Domain
Required: Yes
Type: string

The domain that you want to describe. 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.

Result Syntax

[
    'DomainDescription' => [
        'AWSAccountId' => '<string>',
        'CloudFrontDistribution' => '<string>',
        'CustomDomainConfig' => [
            'CertificateArn' => '<string>',
        ],
        'Domain' => '<string>',
        'ManagedLoginVersion' => <integer>,
        'S3Bucket' => '<string>',
        'Status' => 'CREATING|DELETING|UPDATING|ACTIVE|FAILED',
        'UserPoolId' => '<string>',
        'Version' => '<string>',
    ],
]

Result Details

Members
DomainDescription
Type: DomainDescriptionType structure

The details of the requested user pool domain.

Errors

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

ForgetDevice

$result = $client->forgetDevice([/* ... */]);
$promise = $client->forgetDeviceAsync([/* ... */]);

Forgets the specified device. For more information about device authentication, see Working with user devices in your user pool.

Authorize this action with a signed-in user's access token. It must include the scope aws.cognito.signin.user.admin.

Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.

Parameter Syntax

$result = $client->forgetDevice([
    'AccessToken' => '<string>',
    'DeviceKey' => '<string>', // REQUIRED
]);

Parameter Details

Members
AccessToken
Type: string

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

DeviceKey
Required: Yes
Type: string

The device key.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

InvalidUserPoolConfigurationException:

This exception is thrown when the user pool configuration is not valid.

PasswordResetRequiredException:

This exception is thrown when a password reset is required.

UserNotFoundException:

This exception is thrown when a user isn't found.

UserNotConfirmedException:

This exception is thrown when a user isn't confirmed successfully.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

ForbiddenException:

This exception is thrown when WAF doesn't allow your request based on a web ACL that's associated with your user pool.

ForgotPassword

$result = $client->forgotPassword([/* ... */]);
$promise = $client->forgotPasswordAsync([/* ... */]);

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. To use the confirmation code for resetting the password, call ConfirmForgotPassword.

If neither a verified phone number nor a verified email exists, this API returns InvalidParameterException. If your app client has a client secret and you don't provide a SECRET_HASH parameter, this API returns NotAuthorizedException.

To use this API operation, your user pool must have self-service account recovery configured. Use AdminSetUserPassword if you manage passwords as an administrator.

Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.

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 Services 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.

Parameter Syntax

$result = $client->forgotPassword([
    'AnalyticsMetadata' => [
        'AnalyticsEndpointId' => '<string>',
    ],
    'ClientId' => '<string>', // REQUIRED
    'ClientMetadata' => ['<string>', ...],
    'SecretHash' => '<string>',
    'UserContextData' => [
        'EncodedData' => '<string>',
        'IpAddress' => '<string>',
    ],
    'Username' => '<string>', // REQUIRED
]);

Parameter Details

Members
AnalyticsMetadata
Type: AnalyticsMetadataType structure

The Amazon Pinpoint analytics metadata that contributes to your metrics for ForgotPassword calls.

ClientId
Required: Yes
Type: string

The ID of the client associated with the user pool.

ClientMetadata
Type: Associative array of custom strings keys (StringType) to strings

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.

When you use the ClientMetadata parameter, note 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 send sensitive information in this parameter.

SecretHash
Type: 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. For more information about SecretHash, see Computing secret hash values.

UserContextData
Type: UserContextDataType structure

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.

For more information, see Collecting data for threat protection in applications.

Username
Required: Yes
Type: string

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

Result Syntax

[
    'CodeDeliveryDetails' => [
        'AttributeName' => '<string>',
        'DeliveryMedium' => 'SMS|EMAIL',
        'Destination' => '<string>',
    ],
]

Result Details

Members
CodeDeliveryDetails
Type: CodeDeliveryDetailsType structure

The code delivery details returned by the server in response to the request to reset a password.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

UnexpectedLambdaException:

This exception is thrown when Amazon Cognito encounters an unexpected exception with Lambda.

UserLambdaValidationException:

This exception is thrown when the Amazon Cognito service encounters a user validation exception with the Lambda service.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

InvalidLambdaResponseException:

This exception is thrown when Amazon Cognito encounters an invalid Lambda response.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

LimitExceededException:

This exception is thrown when a user exceeds the limit for a requested Amazon Web Services resource.

InvalidSmsRoleAccessPolicyException:

This exception is returned when the role provided for SMS configuration doesn't have permission to publish using Amazon SNS.

InvalidSmsRoleTrustRelationshipException:

This exception is thrown when the trust relationship is not valid for the role provided for SMS configuration. This can happen if you don't trust cognito-idp.amazonaws.com or the external ID provided in the role does not match what is provided in the SMS configuration for the user pool.

InvalidEmailRoleAccessPolicyException:

This exception is thrown when Amazon Cognito isn't allowed to use your email identity. HTTP status code: 400.

CodeDeliveryFailureException:

This exception is thrown when a verification code fails to deliver successfully.

UserNotFoundException:

This exception is thrown when a user isn't found.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

ForbiddenException:

This exception is thrown when WAF doesn't allow your request based on a web ACL that's associated with your user pool.

GetCSVHeader

$result = $client->getCSVHeader([/* ... */]);
$promise = $client->getCSVHeaderAsync([/* ... */]);

Gets the header information for the comma-separated value (CSV) file to be used as input for the user import job.

Parameter Syntax

$result = $client->getCSVHeader([
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
UserPoolId
Required: Yes
Type: string

The ID of the user pool that the users are to be imported into.

Result Syntax

[
    'CSVHeader' => ['<string>', ...],
    'UserPoolId' => '<string>',
]

Result Details

Members
CSVHeader
Type: Array of strings

The header information of the CSV file for the user import job.

UserPoolId
Type: string

The ID of the user pool that the users are to be imported into.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

GetDevice

$result = $client->getDevice([/* ... */]);
$promise = $client->getDeviceAsync([/* ... */]);

Gets the device. For more information about device authentication, see Working with user devices in your user pool.

Authorize this action with a signed-in user's access token. It must include the scope aws.cognito.signin.user.admin.

Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.

Parameter Syntax

$result = $client->getDevice([
    'AccessToken' => '<string>',
    'DeviceKey' => '<string>', // REQUIRED
]);

Parameter Details

Members
AccessToken
Type: string

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

DeviceKey
Required: Yes
Type: string

The device key.

Result Syntax

[
    'Device' => [
        'DeviceAttributes' => [
            [
                'Name' => '<string>',
                'Value' => '<string>',
            ],
            // ...
        ],
        'DeviceCreateDate' => <DateTime>,
        'DeviceKey' => '<string>',
        'DeviceLastAuthenticatedDate' => <DateTime>,
        'DeviceLastModifiedDate' => <DateTime>,
    ],
]

Result Details

Members
Device
Required: Yes
Type: DeviceType structure

The device.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

InvalidUserPoolConfigurationException:

This exception is thrown when the user pool configuration is not valid.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

PasswordResetRequiredException:

This exception is thrown when a password reset is required.

UserNotFoundException:

This exception is thrown when a user isn't found.

UserNotConfirmedException:

This exception is thrown when a user isn't confirmed successfully.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

ForbiddenException:

This exception is thrown when WAF doesn't allow your request based on a web ACL that's associated with your user pool.

GetGroup

$result = $client->getGroup([/* ... */]);
$promise = $client->getGroupAsync([/* ... */]);

Gets a group.

Calling this action requires developer credentials.

Parameter Syntax

$result = $client->getGroup([
    'GroupName' => '<string>', // REQUIRED
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
GroupName
Required: Yes
Type: string

The name of the group.

UserPoolId
Required: Yes
Type: string

The ID of the user pool.

Result Syntax

[
    'Group' => [
        'CreationDate' => <DateTime>,
        'Description' => '<string>',
        'GroupName' => '<string>',
        'LastModifiedDate' => <DateTime>,
        'Precedence' => <integer>,
        'RoleArn' => '<string>',
        'UserPoolId' => '<string>',
    ],
]

Result Details

Members
Group
Type: GroupType structure

The group object for the group.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

GetIdentityProviderByIdentifier

$result = $client->getIdentityProviderByIdentifier([/* ... */]);
$promise = $client->getIdentityProviderByIdentifierAsync([/* ... */]);

Gets the specified IdP.

Parameter Syntax

$result = $client->getIdentityProviderByIdentifier([
    'IdpIdentifier' => '<string>', // REQUIRED
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
IdpIdentifier
Required: Yes
Type: string

The IdP identifier.

UserPoolId
Required: Yes
Type: string

The user pool ID.

Result Syntax

[
    'IdentityProvider' => [
        'AttributeMapping' => ['<string>', ...],
        'CreationDate' => <DateTime>,
        'IdpIdentifiers' => ['<string>', ...],
        'LastModifiedDate' => <DateTime>,
        'ProviderDetails' => ['<string>', ...],
        'ProviderName' => '<string>',
        'ProviderType' => 'SAML|Facebook|Google|LoginWithAmazon|SignInWithApple|OIDC',
        'UserPoolId' => '<string>',
    ],
]

Result Details

Members
IdentityProvider
Required: Yes
Type: IdentityProviderType structure

The identity provider details.

Errors

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

GetLogDeliveryConfiguration

$result = $client->getLogDeliveryConfiguration([/* ... */]);
$promise = $client->getLogDeliveryConfigurationAsync([/* ... */]);

Gets the logging configuration of a user pool.

Parameter Syntax

$result = $client->getLogDeliveryConfiguration([
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
UserPoolId
Required: Yes
Type: string

The ID of the user pool that has the logging configuration that you want to view.

Result Syntax

[
    'LogDeliveryConfiguration' => [
        'LogConfigurations' => [
            [
                'CloudWatchLogsConfiguration' => [
                    'LogGroupArn' => '<string>',
                ],
                'EventSource' => 'userNotification|userAuthEvents',
                'FirehoseConfiguration' => [
                    'StreamArn' => '<string>',
                ],
                'LogLevel' => 'ERROR|INFO',
                'S3Configuration' => [
                    'BucketArn' => '<string>',
                ],
            ],
            // ...
        ],
        'UserPoolId' => '<string>',
    ],
]

Result Details

Members
LogDeliveryConfiguration

The logging configuration of the requested user pool.

Errors

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

GetSigningCertificate

$result = $client->getSigningCertificate([/* ... */]);
$promise = $client->getSigningCertificateAsync([/* ... */]);

This method takes a user pool ID, and returns the signing certificate. The issued certificate is valid for 10 years from the date of issue.

Amazon Cognito issues and assigns a new signing certificate annually. This process returns a new value in the response to GetSigningCertificate, but doesn't invalidate the original certificate.

Parameter Syntax

$result = $client->getSigningCertificate([
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
UserPoolId
Required: Yes
Type: string

The user pool ID.

Result Syntax

[
    'Certificate' => '<string>',
]

Result Details

Members
Certificate
Type: string

The signing certificate.

Errors

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

GetUICustomization

$result = $client->getUICustomization([/* ... */]);
$promise = $client->getUICustomizationAsync([/* ... */]);

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.

Parameter Syntax

$result = $client->getUICustomization([
    'ClientId' => '<string>',
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
ClientId
Type: string

The client ID for the client app.

UserPoolId
Required: Yes
Type: string

The ID of the user pool.

Result Syntax

[
    'UICustomization' => [
        'CSS' => '<string>',
        'CSSVersion' => '<string>',
        'ClientId' => '<string>',
        'CreationDate' => <DateTime>,
        'ImageUrl' => '<string>',
        'LastModifiedDate' => <DateTime>,
        'UserPoolId' => '<string>',
    ],
]

Result Details

Members
UICustomization
Required: Yes
Type: UICustomizationType structure

The UI customization information.

Errors

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

GetUser

$result = $client->getUser([/* ... */]);
$promise = $client->getUserAsync([/* ... */]);

Gets the user attributes and metadata for a user.

Authorize this action with a signed-in user's access token. It must include the scope aws.cognito.signin.user.admin.

Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.

Parameter Syntax

$result = $client->getUser([
    'AccessToken' => '<string>', // REQUIRED
]);

Parameter Details

Members
AccessToken
Required: Yes
Type: string

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

Result Syntax

[
    'MFAOptions' => [
        [
            'AttributeName' => '<string>',
            'DeliveryMedium' => 'SMS|EMAIL',
        ],
        // ...
    ],
    'PreferredMfaSetting' => '<string>',
    'UserAttributes' => [
        [
            'Name' => '<string>',
            'Value' => '<string>',
        ],
        // ...
    ],
    'UserMFASettingList' => ['<string>', ...],
    'Username' => '<string>',
]

Result Details

Members
MFAOptions
Type: Array of MFAOptionType structures

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.

PreferredMfaSetting
Type: string

The user's preferred MFA setting.

UserAttributes
Required: Yes
Type: Array of AttributeType structures

An array of name-value pairs representing user attributes.

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

UserMFASettingList
Type: Array of strings

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

Username
Required: Yes
Type: string

The username of the user that you requested.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

PasswordResetRequiredException:

This exception is thrown when a password reset is required.

UserNotFoundException:

This exception is thrown when a user isn't found.

UserNotConfirmedException:

This exception is thrown when a user isn't confirmed successfully.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

ForbiddenException:

This exception is thrown when WAF doesn't allow your request based on a web ACL that's associated with your user pool.

GetUserAttributeVerificationCode

$result = $client->getUserAttributeVerificationCode([/* ... */]);
$promise = $client->getUserAttributeVerificationCodeAsync([/* ... */]);

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.

Authorize this action with a signed-in user's access token. It must include the scope aws.cognito.signin.user.admin.

Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.

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 Services 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.

Parameter Syntax

$result = $client->getUserAttributeVerificationCode([
    'AccessToken' => '<string>', // REQUIRED
    'AttributeName' => '<string>', // REQUIRED
    'ClientMetadata' => ['<string>', ...],
]);

Parameter Details

Members
AccessToken
Required: Yes
Type: string

A non-expired access token for the user whose attribute verification code you want to generate.

AttributeName
Required: Yes
Type: string

The attribute name returned by the server response to get the user attribute verification code.

ClientMetadata
Type: Associative array of custom strings keys (StringType) to strings

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.

When you use the ClientMetadata parameter, note 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 send sensitive information in this parameter.

Result Syntax

[
    'CodeDeliveryDetails' => [
        'AttributeName' => '<string>',
        'DeliveryMedium' => 'SMS|EMAIL',
        'Destination' => '<string>',
    ],
]

Result Details

Members
CodeDeliveryDetails
Type: CodeDeliveryDetailsType structure

The code delivery details returned by the server in response to the request to get the user attribute verification code.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

UnexpectedLambdaException:

This exception is thrown when Amazon Cognito encounters an unexpected exception with Lambda.

UserLambdaValidationException:

This exception is thrown when the Amazon Cognito service encounters a user validation exception with the Lambda service.

InvalidLambdaResponseException:

This exception is thrown when Amazon Cognito encounters an invalid Lambda response.

InvalidSmsRoleAccessPolicyException:

This exception is returned when the role provided for SMS configuration doesn't have permission to publish using Amazon SNS.

InvalidSmsRoleTrustRelationshipException:

This exception is thrown when the trust relationship is not valid for the role provided for SMS configuration. This can happen if you don't trust cognito-idp.amazonaws.com or the external ID provided in the role does not match what is provided in the SMS configuration for the user pool.

InvalidEmailRoleAccessPolicyException:

This exception is thrown when Amazon Cognito isn't allowed to use your email identity. HTTP status code: 400.

CodeDeliveryFailureException:

This exception is thrown when a verification code fails to deliver successfully.

LimitExceededException:

This exception is thrown when a user exceeds the limit for a requested Amazon Web Services resource.

PasswordResetRequiredException:

This exception is thrown when a password reset is required.

UserNotFoundException:

This exception is thrown when a user isn't found.

UserNotConfirmedException:

This exception is thrown when a user isn't confirmed successfully.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

ForbiddenException:

This exception is thrown when WAF doesn't allow your request based on a web ACL that's associated with your user pool.

GetUserAuthFactors

$result = $client->getUserAuthFactors([/* ... */]);
$promise = $client->getUserAuthFactorsAsync([/* ... */]);

Lists the authentication options for the currently signed-in user. Returns the following:

  1. The user's multi-factor authentication (MFA) preferences.

  2. The user's options in the USER_AUTH flow that they can select in a SELECT_CHALLENGE response or request in a PREFERRED_CHALLENGErequest.

Parameter Syntax

$result = $client->getUserAuthFactors([
    'AccessToken' => '<string>', // REQUIRED
]);

Parameter Details

Members
AccessToken
Required: Yes
Type: string

A valid access token that Amazon Cognito issued to the user whose authentication factors you want to view.

Result Syntax

[
    'ConfiguredUserAuthFactors' => ['<string>', ...],
    'PreferredMfaSetting' => '<string>',
    'UserMFASettingList' => ['<string>', ...],
    'Username' => '<string>',
]

Result Details

Members
ConfiguredUserAuthFactors
Type: Array of strings

The authentication types that are available to the user with USER_AUTH sign-in.

PreferredMfaSetting
Type: string

The user's preferred MFA setting.

UserMFASettingList
Type: Array of strings

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

Username
Required: Yes
Type: string

The username of the currently sign-in user.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

PasswordResetRequiredException:

This exception is thrown when a password reset is required.

UserNotFoundException:

This exception is thrown when a user isn't found.

UserNotConfirmedException:

This exception is thrown when a user isn't confirmed successfully.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

ForbiddenException:

This exception is thrown when WAF doesn't allow your request based on a web ACL that's associated with your user pool.

GetUserPoolMfaConfig

$result = $client->getUserPoolMfaConfig([/* ... */]);
$promise = $client->getUserPoolMfaConfigAsync([/* ... */]);

Gets the user pool multi-factor authentication (MFA) configuration.

Parameter Syntax

$result = $client->getUserPoolMfaConfig([
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
UserPoolId
Required: Yes
Type: string

The user pool ID.

Result Syntax

[
    'EmailMfaConfiguration' => [
        'Message' => '<string>',
        'Subject' => '<string>',
    ],
    'MfaConfiguration' => 'OFF|ON|OPTIONAL',
    'SmsMfaConfiguration' => [
        'SmsAuthenticationMessage' => '<string>',
        'SmsConfiguration' => [
            'ExternalId' => '<string>',
            'SnsCallerArn' => '<string>',
            'SnsRegion' => '<string>',
        ],
    ],
    'SoftwareTokenMfaConfiguration' => [
        'Enabled' => true || false,
    ],
    'WebAuthnConfiguration' => [
        'RelyingPartyId' => '<string>',
        'UserVerification' => 'required|preferred',
    ],
]

Result Details

Members
EmailMfaConfiguration
Type: EmailMfaConfigType structure

Shows user pool email message configuration for MFA. Includes the subject and body of the email message template for MFA messages. To activate this setting, advanced security features must be active in your user pool.

MfaConfiguration
Type: 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.

SmsMfaConfiguration
Type: SmsMfaConfigType structure

Shows user pool SMS message configuration for MFA. Includes the message template and the SMS message sending configuration for Amazon SNS.

SoftwareTokenMfaConfiguration
Type: SoftwareTokenMfaConfigType structure

Shows user pool configuration for time-based one-time password (TOTP) MFA. Includes TOTP enabled or disabled state.

WebAuthnConfiguration
Type: WebAuthnConfigurationType structure

Shows user pool configuration for MFA with passkeys from biometric devices and security keys.

Errors

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

GlobalSignOut

$result = $client->globalSignOut([/* ... */]);
$promise = $client->globalSignOutAsync([/* ... */]);

Invalidates the identity, access, and refresh tokens that Amazon Cognito issued to a user. Call this operation when your user signs out of your app. This results in the following behavior.

  • Amazon Cognito no longer accepts token-authorized user operations that you authorize with a signed-out user's access tokens. For more information, see Using the Amazon Cognito user pools API and user pool endpoints.

    Amazon Cognito returns an Access Token has been revoked error when your app attempts to authorize a user pools API request with a revoked access token that contains the scope aws.cognito.signin.user.admin.

  • Amazon Cognito no longer accepts a signed-out user's ID token in a GetId request to an identity pool with ServerSideTokenCheck enabled for its user pool IdP configuration in CognitoIdentityProvider.

  • Amazon Cognito no longer accepts a signed-out user's refresh tokens in refresh requests.

Other requests might be valid until your user's token expires. This operation doesn't clear the managed login session cookie. To clear the session for a user who signed in with managed login or the classic hosted UI, direct their browser session to the logout endpoint.

Authorize this action with a signed-in user's access token. It must include the scope aws.cognito.signin.user.admin.

Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.

Parameter Syntax

$result = $client->globalSignOut([
    'AccessToken' => '<string>', // REQUIRED
]);

Parameter Details

Members
AccessToken
Required: Yes
Type: string

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

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

PasswordResetRequiredException:

This exception is thrown when a password reset is required.

UserNotConfirmedException:

This exception is thrown when a user isn't confirmed successfully.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

ForbiddenException:

This exception is thrown when WAF doesn't allow your request based on a web ACL that's associated with your user pool.

InitiateAuth

$result = $client->initiateAuth([/* ... */]);
$promise = $client->initiateAuthAsync([/* ... */]);

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.

Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.

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 Services 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.

Parameter Syntax

$result = $client->initiateAuth([
    'AnalyticsMetadata' => [
        'AnalyticsEndpointId' => '<string>',
    ],
    'AuthFlow' => 'USER_SRP_AUTH|REFRESH_TOKEN_AUTH|REFRESH_TOKEN|CUSTOM_AUTH|ADMIN_NO_SRP_AUTH|USER_PASSWORD_AUTH|ADMIN_USER_PASSWORD_AUTH|USER_AUTH', // REQUIRED
    'AuthParameters' => ['<string>', ...],
    'ClientId' => '<string>', // REQUIRED
    'ClientMetadata' => ['<string>', ...],
    'Session' => '<string>',
    'UserContextData' => [
        'EncodedData' => '<string>',
        'IpAddress' => '<string>',
    ],
]);

Parameter Details

Members
AnalyticsMetadata
Type: AnalyticsMetadataType structure

The Amazon Pinpoint analytics metadata that contributes to your metrics for InitiateAuth calls.

AuthFlow
Required: Yes
Type: string

The authentication flow that you want to initiate. Each AuthFlow has linked AuthParameters that you must submit. The following are some example flows and their parameters.

  • USER_AUTH: Request a preferred authentication type or review available authentication types. From the offered authentication types, select one in a challenge response and then authenticate with that method in an additional challenge response.

  • REFRESH_TOKEN_AUTH: Receive new ID and access tokens when you pass a REFRESH_TOKEN parameter with a valid refresh token as the value.

  • USER_SRP_AUTH: Receive secure remote password (SRP) variables for the next challenge, PASSWORD_VERIFIER, when you pass USERNAME and SRP_A parameters.

  • USER_PASSWORD_AUTH: Receive new tokens or the next challenge, for example SOFTWARE_TOKEN_MFA, when you pass USERNAME and PASSWORD parameters.

All flows

USER_AUTH

The entry point for sign-in with passwords, one-time passwords, and WebAuthN authenticators.

USER_SRP_AUTH

Username-password authentication with the Secure Remote Password (SRP) protocol. For more information, see Use SRP password verification in custom authentication flow.

REFRESH_TOKEN_AUTH and REFRESH_TOKEN

Provide a valid refresh token and receive new ID and access tokens. For more information, see Using the refresh token.

CUSTOM_AUTH

Custom authentication with Lambda triggers. For more information, see Custom authentication challenge Lambda triggers.

USER_PASSWORD_AUTH

Username-password authentication with the password sent directly in the request. For more information, see Admin authentication flow.

ADMIN_USER_PASSWORD_AUTH is a flow type of AdminInitiateAuth and isn't valid for InitiateAuth. ADMIN_NO_SRP_AUTH is a legacy server-side username-password flow and isn't valid for InitiateAuth.

AuthParameters
Type: Associative array of custom strings keys (StringType) to strings

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_AUTH: USERNAME (required), PREFERRED_CHALLENGE. If you don't provide a value for PREFERRED_CHALLENGE, Amazon Cognito responds with the AvailableChallenges parameter that specifies the available sign-in methods.

  • 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 USER_PASSWORD_AUTH: USERNAME (required), PASSWORD (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).

For more information about SECRET_HASH, see Computing secret hash values. For information about DEVICE_KEY, see Working with user devices in your user pool.

ClientId
Required: Yes
Type: string

The app client ID.

ClientMetadata
Type: Associative array of custom strings keys (StringType) to strings

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

  • Custom email sender

  • Custom SMS sender

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

When you use the ClientMetadata parameter, note 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 send sensitive information in this parameter.

Session
Type: string

The optional session ID from a ConfirmSignUp API request. You can sign in a user directly from the sign-up process with the USER_AUTH authentication flow.

UserContextData
Type: UserContextDataType structure

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.

For more information, see Collecting data for threat protection in applications.

Result Syntax

[
    'AuthenticationResult' => [
        'AccessToken' => '<string>',
        'ExpiresIn' => <integer>,
        'IdToken' => '<string>',
        'NewDeviceMetadata' => [
            'DeviceGroupKey' => '<string>',
            'DeviceKey' => '<string>',
        ],
        'RefreshToken' => '<string>',
        'TokenType' => '<string>',
    ],
    'AvailableChallenges' => ['<string>', ...],
    'ChallengeName' => 'SMS_MFA|EMAIL_OTP|SOFTWARE_TOKEN_MFA|SELECT_MFA_TYPE|MFA_SETUP|PASSWORD_VERIFIER|CUSTOM_CHALLENGE|SELECT_CHALLENGE|DEVICE_SRP_AUTH|DEVICE_PASSWORD_VERIFIER|ADMIN_NO_SRP_AUTH|NEW_PASSWORD_REQUIRED|SMS_OTP|PASSWORD|WEB_AUTHN|PASSWORD_SRP',
    'ChallengeParameters' => ['<string>', ...],
    'Session' => '<string>',
]

Result Details

Members
AuthenticationResult
Type: AuthenticationResultType structure

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.

AvailableChallenges
Type: Array of strings

This response parameter prompts a user to select from multiple available challenges that they can complete authentication with. For example, they might be able to continue with passwordless authentication or with a one-time password from an SMS message.

ChallengeName
Type: string

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

Valid values include the following:

All of the following challenges require USERNAME and SECRET_HASH (if applicable) in the parameters.

  • WEB_AUTHN: Respond to the challenge with the results of a successful authentication with a passkey, or webauthN, factor. These are typically biometric devices or security keys.

  • PASSWORD: Respond with USER_PASSWORD_AUTH parameters: USERNAME (required), PASSWORD (required), SECRET_HASH (required if the app client is configured with a client secret), DEVICE_KEY.

  • PASSWORD_SRP: Respond with USER_SRP_AUTH parameters: USERNAME (required), SRP_A (required), SECRET_HASH (required if the app client is configured with a client secret), DEVICE_KEY.

  • SELECT_CHALLENGE: Respond to the challenge with USERNAME and an ANSWER that matches one of the challenge types in the AvailableChallenges response parameter.

  • SMS_MFA: Next challenge is to supply an SMS_MFA_CODEthat your user pool delivered in an SMS message.

  • EMAIL_OTP: Next challenge is to supply an EMAIL_OTP_CODE that your user pool delivered in an email message.

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

    Amazon Cognito only returns this challenge for users who have temporary passwords. Because of this, and because in some cases you can create users who don't have values for required attributes, take care to collect and submit required-attribute values for all users who don't have passwords. You can create a user in the Amazon Cognito console without, for example, a required birthdate attribute. The API response from Amazon Cognito won't prompt you to submit a birthdate for the user if they don't have a password.

    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 MFAS_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.

ChallengeParameters
Type: Associative array of custom strings keys (StringType) to strings

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. They also require SECRET_HASH if your app client has a client secret.

Session
Type: 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. Include this session identifier in a RespondToAuthChallenge API request.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

UnexpectedLambdaException:

This exception is thrown when Amazon Cognito encounters an unexpected exception with Lambda.

InvalidUserPoolConfigurationException:

This exception is thrown when the user pool configuration is not valid.

UserLambdaValidationException:

This exception is thrown when the Amazon Cognito service encounters a user validation exception with the Lambda service.

InvalidLambdaResponseException:

This exception is thrown when Amazon Cognito encounters an invalid Lambda response.

PasswordResetRequiredException:

This exception is thrown when a password reset is required.

UserNotFoundException:

This exception is thrown when a user isn't found.

UserNotConfirmedException:

This exception is thrown when a user isn't confirmed successfully.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

InvalidSmsRoleAccessPolicyException:

This exception is returned when the role provided for SMS configuration doesn't have permission to publish using Amazon SNS.

InvalidEmailRoleAccessPolicyException:

This exception is thrown when Amazon Cognito isn't allowed to use your email identity. HTTP status code: 400.

InvalidSmsRoleTrustRelationshipException:

This exception is thrown when the trust relationship is not valid for the role provided for SMS configuration. This can happen if you don't trust cognito-idp.amazonaws.com or the external ID provided in the role does not match what is provided in the SMS configuration for the user pool.

ForbiddenException:

This exception is thrown when WAF doesn't allow your request based on a web ACL that's associated with your user pool.

Examples

Example 1: Example username and password sign-in for a user who has TOTP MFA

The following example signs in the user mytestuser with analytics data, client metadata, and user context data for advanced security.

$result = $client->initiateAuth([
    'AnalyticsMetadata' => [
        'AnalyticsEndpointId' => 'd70b2ba36a8c4dc5a04a0451a31a1e12',
    ],
    'AuthFlow' => 'USER_PASSWORD_AUTH',
    'AuthParameters' => [
        'PASSWORD' => 'This-is-my-test-99!',
        'SECRET_HASH' => 'oT5ZkS8ctnrhYeeGsGTvOzPhoc/Jd1cO5fueBWFVmp8=',
        'USERNAME' => 'mytestuser',
    ],
    'ClientId' => '1example23456789',
    'ClientMetadata' => [
        'MyTestKey' => 'MyTestValue',
    ],
    'UserContextData' => [
        'EncodedData' => 'AmazonCognitoAdvancedSecurityData_object',
        'IpAddress' => '192.0.2.1',
    ],
]);

Result syntax:

[
    'ChallengeName' => 'SOFTWARE_TOKEN_MFA',
    'ChallengeParameters' => [
        'FRIENDLY_DEVICE_NAME' => 'mytestauthenticator',
        'USER_ID_FOR_SRP' => 'mytestuser',
    ],
    'Session' => 'AYABeC1-y8qooiuysEv0uM4wAqQAHQABAAdTZXJ2aWNlABBDb2duaXRvVXNlclBvb2xzAAEAB2F3cy1rbXMAS2Fybjphd3M6a21zOnVzLXdlc3QtMjowMTU3MzY3MjcxOTg6a2V5LzI5OTFhNGE5LTM5YTAtNDQ0Mi04MWU4LWRkYjY4NTllMTg2MQC4AQIBAHhjxv5lVLhE2_WNrC1zuomqn08qDUUp3z9v4EGAjazZ-wGP3HuBF5Izvxf-9WkCT5uyAAAAfjB8BgkqhkiG9w0BBwagbzBtAgEAMGgGCSqGSIb3DQEHATAeBglghkgBZQMEAS4wEQQMeQoT5e6Dpfh52caqAgEQgDvuL8uLMhPt0WmQpZnkNED1gob6xbqt5LaQo_H4L5CuT4Kj499dGCoZ1q1trmlZSRgRm0wwGGG8lFU37QIAAAAADAAAEAAAAAAAAAAAAAAAAADuLe9_UJ4oZAMsQYr0ntiT_____wAAAAEAAAAAAAAAAAAAAAEAAADnLDGmKBQtsCafNokRmPLgl2itBKuKR2dfZBQb5ucCYkzThM5HOfQUSEL-A3dZzfYDC0IODsrcMkrbeeVyMJk-FCzsxS9Og8BEBVnvi9WjZkPJ4mF0YS6FUXnoPSBV5oUqGzRaT-tJ169SUFZAUfFM1fGeJ8T57-QdCxjyISRCWV1VG5_7TiCioyRGfWwzNVWh7exJortF3ccfOyiEyxeqJ2VJvJq3m_w8NP24_PMDpktpRMKftObIMlD5ewRTNCdrUXQ1BW5KIxhJLGjYfRzJDZuKzmEgS-VHsKz0z76w-AlAgdfvdAjflLnsgduU5kUX4YP6jqnetg',
]

ListDevices

$result = $client->listDevices([/* ... */]);
$promise = $client->listDevicesAsync([/* ... */]);

Lists the sign-in devices that Amazon Cognito has registered to the current user. For more information about device authentication, see Working with user devices in your user pool.

Authorize this action with a signed-in user's access token. It must include the scope aws.cognito.signin.user.admin.

Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.

Parameter Syntax

$result = $client->listDevices([
    'AccessToken' => '<string>', // REQUIRED
    'Limit' => <integer>,
    'PaginationToken' => '<string>',
]);

Parameter Details

Members
AccessToken
Required: Yes
Type: string

A valid access token that Amazon Cognito issued to the user whose list of devices you want to view.

Limit
Type: int

The limit of the device request.

PaginationToken
Type: string

This API operation returns a limited number of results. The pagination token is an identifier that you can present in an additional API request with the same parameters. When you include the pagination token, Amazon Cognito returns the next set of items after the current list. Subsequent requests return a new pagination token. By use of this token, you can paginate through the full list of items.

Result Syntax

[
    'Devices' => [
        [
            'DeviceAttributes' => [
                [
                    'Name' => '<string>',
                    'Value' => '<string>',
                ],
                // ...
            ],
            'DeviceCreateDate' => <DateTime>,
            'DeviceKey' => '<string>',
            'DeviceLastAuthenticatedDate' => <DateTime>,
            'DeviceLastModifiedDate' => <DateTime>,
        ],
        // ...
    ],
    'PaginationToken' => '<string>',
]

Result Details

Members
Devices
Type: Array of DeviceType structures

The devices returned in the list devices response.

PaginationToken
Type: string

The identifier that Amazon Cognito returned with the previous request to this operation. When you include a pagination token in your request, Amazon Cognito returns the next set of items in the list. By use of this token, you can paginate through the full list of items.

Errors

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

InvalidUserPoolConfigurationException:

This exception is thrown when the user pool configuration is not valid.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

PasswordResetRequiredException:

This exception is thrown when a password reset is required.

UserNotFoundException:

This exception is thrown when a user isn't found.

UserNotConfirmedException:

This exception is thrown when a user isn't confirmed successfully.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

ForbiddenException:

This exception is thrown when WAF doesn't allow your request based on a web ACL that's associated with your user pool.

ListGroups

$result = $client->listGroups([/* ... */]);
$promise = $client->listGroupsAsync([/* ... */]);

Lists the groups associated with a user pool.

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

Learn more

Parameter Syntax

$result = $client->listGroups([
    'Limit' => <integer>,
    'NextToken' => '<string>',
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
Limit
Type: int

The limit of the request to list groups.

NextToken
Type: 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.

UserPoolId
Required: Yes
Type: string

The ID of the user pool.

Result Syntax

[
    'Groups' => [
        [
            'CreationDate' => <DateTime>,
            'Description' => '<string>',
            'GroupName' => '<string>',
            'LastModifiedDate' => <DateTime>,
            'Precedence' => <integer>,
            'RoleArn' => '<string>',
            'UserPoolId' => '<string>',
        ],
        // ...
    ],
    'NextToken' => '<string>',
]

Result Details

Members
Groups
Type: Array of GroupType structures

The group objects for the groups.

NextToken
Type: 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.

Errors

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

ListIdentityProviders

$result = $client->listIdentityProviders([/* ... */]);
$promise = $client->listIdentityProvidersAsync([/* ... */]);

Lists information about all IdPs for a user pool.

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

Learn more

Parameter Syntax

$result = $client->listIdentityProviders([
    'MaxResults' => <integer>,
    'NextToken' => '<string>',
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
MaxResults
Type: int

The maximum number of IdPs to return.

NextToken
Type: string

A pagination token.

UserPoolId
Required: Yes
Type: string

The user pool ID.

Result Syntax

[
    'NextToken' => '<string>',
    'Providers' => [
        [
            'CreationDate' => <DateTime>,
            'LastModifiedDate' => <DateTime>,
            'ProviderName' => '<string>',
            'ProviderType' => 'SAML|Facebook|Google|LoginWithAmazon|SignInWithApple|OIDC',
        ],
        // ...
    ],
]

Result Details

Members
NextToken
Type: string

A pagination token.

Providers
Required: Yes
Type: Array of ProviderDescription structures

A list of IdP objects.

Errors

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

ListResourceServers

$result = $client->listResourceServers([/* ... */]);
$promise = $client->listResourceServersAsync([/* ... */]);

Lists the resource servers for a user pool.

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

Learn more

Parameter Syntax

$result = $client->listResourceServers([
    'MaxResults' => <integer>,
    'NextToken' => '<string>',
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
MaxResults
Type: int

The maximum number of resource servers to return.

NextToken
Type: string

A pagination token.

UserPoolId
Required: Yes
Type: string

The ID of the user pool.

Result Syntax

[
    'NextToken' => '<string>',
    'ResourceServers' => [
        [
            'Identifier' => '<string>',
            'Name' => '<string>',
            'Scopes' => [
                [
                    'ScopeDescription' => '<string>',
                    'ScopeName' => '<string>',
                ],
                // ...
            ],
            'UserPoolId' => '<string>',
        ],
        // ...
    ],
]

Result Details

Members
NextToken
Type: string

A pagination token.

ResourceServers
Required: Yes
Type: Array of ResourceServerType structures

The resource servers.

Errors

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

ListTagsForResource

$result = $client->listTagsForResource([/* ... */]);
$promise = $client->listTagsForResourceAsync([/* ... */]);

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.

Parameter Syntax

$result = $client->listTagsForResource([
    'ResourceArn' => '<string>', // REQUIRED
]);

Parameter Details

Members
ResourceArn
Required: Yes
Type: string

The Amazon Resource Name (ARN) of the user pool that the tags are assigned to.

Result Syntax

[
    'Tags' => ['<string>', ...],
]

Result Details

Members
Tags
Type: Associative array of custom strings keys (TagKeysType) to strings

The tags that are assigned to the user pool.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

ListUserImportJobs

$result = $client->listUserImportJobs([/* ... */]);
$promise = $client->listUserImportJobsAsync([/* ... */]);

Lists user import jobs for a user pool.

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

Learn more

Parameter Syntax

$result = $client->listUserImportJobs([
    'MaxResults' => <integer>, // REQUIRED
    'PaginationToken' => '<string>',
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
MaxResults
Required: Yes
Type: int

The maximum number of import jobs you want the request to return.

PaginationToken
Type: string

This API operation returns a limited number of results. The pagination token is an identifier that you can present in an additional API request with the same parameters. When you include the pagination token, Amazon Cognito returns the next set of items after the current list. Subsequent requests return a new pagination token. By use of this token, you can paginate through the full list of items.

UserPoolId
Required: Yes
Type: string

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

Result Syntax

[
    'PaginationToken' => '<string>',
    'UserImportJobs' => [
        [
            'CloudWatchLogsRoleArn' => '<string>',
            'CompletionDate' => <DateTime>,
            'CompletionMessage' => '<string>',
            'CreationDate' => <DateTime>,
            'FailedUsers' => <integer>,
            'ImportedUsers' => <integer>,
            'JobId' => '<string>',
            'JobName' => '<string>',
            'PreSignedUrl' => '<string>',
            'SkippedUsers' => <integer>,
            'StartDate' => <DateTime>,
            'Status' => 'Created|Pending|InProgress|Stopping|Expired|Stopped|Failed|Succeeded',
            'UserPoolId' => '<string>',
        ],
        // ...
    ],
]

Result Details

Members
PaginationToken
Type: string

The identifier that Amazon Cognito returned with the previous request to this operation. When you include a pagination token in your request, Amazon Cognito returns the next set of items in the list. By use of this token, you can paginate through the full list of items.

UserImportJobs
Type: Array of UserImportJobType structures

The user import jobs.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

ListUserPoolClients

$result = $client->listUserPoolClients([/* ... */]);
$promise = $client->listUserPoolClientsAsync([/* ... */]);

Lists the clients that have been created for the specified user pool.

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

Learn more

Parameter Syntax

$result = $client->listUserPoolClients([
    'MaxResults' => <integer>,
    'NextToken' => '<string>',
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
MaxResults
Type: int

The maximum number of results you want the request to return when listing the user pool clients.

NextToken
Type: 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.

UserPoolId
Required: Yes
Type: string

The ID of the user pool where you want to list user pool clients.

Result Syntax

[
    'NextToken' => '<string>',
    'UserPoolClients' => [
        [
            'ClientId' => '<string>',
            'ClientName' => '<string>',
            'UserPoolId' => '<string>',
        ],
        // ...
    ],
]

Result Details

Members
NextToken
Type: 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.

UserPoolClients
Type: Array of UserPoolClientDescription structures

The user pool clients in the response that lists user pool clients.

Errors

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

ListUserPools

$result = $client->listUserPools([/* ... */]);
$promise = $client->listUserPoolsAsync([/* ... */]);

Lists the user pools associated with an Amazon Web Services account.

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

Learn more

Parameter Syntax

$result = $client->listUserPools([
    'MaxResults' => <integer>, // REQUIRED
    'NextToken' => '<string>',
]);

Parameter Details

Members
MaxResults
Required: Yes
Type: int

The maximum number of results you want the request to return when listing the user pools.

NextToken
Type: 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.

Result Syntax

[
    'NextToken' => '<string>',
    'UserPools' => [
        [
            'CreationDate' => <DateTime>,
            'Id' => '<string>',
            'LambdaConfig' => [
                'CreateAuthChallenge' => '<string>',
                'CustomEmailSender' => [
                    'LambdaArn' => '<string>',
                    'LambdaVersion' => 'V1_0',
                ],
                'CustomMessage' => '<string>',
                'CustomSMSSender' => [
                    'LambdaArn' => '<string>',
                    'LambdaVersion' => 'V1_0',
                ],
                'DefineAuthChallenge' => '<string>',
                'KMSKeyID' => '<string>',
                'PostAuthentication' => '<string>',
                'PostConfirmation' => '<string>',
                'PreAuthentication' => '<string>',
                'PreSignUp' => '<string>',
                'PreTokenGeneration' => '<string>',
                'PreTokenGenerationConfig' => [
                    'LambdaArn' => '<string>',
                    'LambdaVersion' => 'V1_0|V2_0',
                ],
                'UserMigration' => '<string>',
                'VerifyAuthChallengeResponse' => '<string>',
            ],
            'LastModifiedDate' => <DateTime>,
            'Name' => '<string>',
            'Status' => 'Enabled|Disabled',
        ],
        // ...
    ],
]

Result Details

Members
NextToken
Type: 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.

UserPools
Type: Array of UserPoolDescriptionType structures

The user pools from the response to list users.

Errors

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

ListUsers

$result = $client->listUsers([/* ... */]);
$promise = $client->listUsersAsync([/* ... */]);

Lists users and their basic details in a user pool.

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

Learn more

Parameter Syntax

$result = $client->listUsers([
    'AttributesToGet' => ['<string>', ...],
    'Filter' => '<string>',
    'Limit' => <integer>,
    'PaginationToken' => '<string>',
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
AttributesToGet
Type: Array of strings

A JSON array of user attribute names, for example given_name, that you want Amazon Cognito to include in the response for each user. When you don't provide an AttributesToGet parameter, Amazon Cognito returns all attributes for each user.

Use AttributesToGet with required attributes in your user pool, or in conjunction with Filter. Amazon Cognito returns an error if not all users in the results have set a value for the attribute you request. Attributes that you can't filter on, including custom attributes, must have a value set in every user profile before an AttributesToGet parameter returns results.

Filter
Type: 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.

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.

Limit
Type: int

Maximum number of users to be returned.

PaginationToken
Type: string

This API operation returns a limited number of results. The pagination token is an identifier that you can present in an additional API request with the same parameters. When you include the pagination token, Amazon Cognito returns the next set of items after the current list. Subsequent requests return a new pagination token. By use of this token, you can paginate through the full list of items.

UserPoolId
Required: Yes
Type: string

The ID of the user pool on which the search should be performed.

Result Syntax

[
    'PaginationToken' => '<string>',
    'Users' => [
        [
            'Attributes' => [
                [
                    'Name' => '<string>',
                    'Value' => '<string>',
                ],
                // ...
            ],
            'Enabled' => true || false,
            'MFAOptions' => [
                [
                    'AttributeName' => '<string>',
                    'DeliveryMedium' => 'SMS|EMAIL',
                ],
                // ...
            ],
            'UserCreateDate' => <DateTime>,
            'UserLastModifiedDate' => <DateTime>,
            'UserStatus' => 'UNCONFIRMED|CONFIRMED|ARCHIVED|COMPROMISED|UNKNOWN|RESET_REQUIRED|FORCE_CHANGE_PASSWORD|EXTERNAL_PROVIDER',
            'Username' => '<string>',
        ],
        // ...
    ],
]

Result Details

Members
PaginationToken
Type: string

The identifier that Amazon Cognito returned with the previous request to this operation. When you include a pagination token in your request, Amazon Cognito returns the next set of items in the list. By use of this token, you can paginate through the full list of items.

Users
Type: Array of UserType structures

A list of the user pool users, and their attributes, that match your query.

Amazon Cognito creates a profile in your user pool for each native user in your user pool, and each unique user ID from your third-party identity providers (IdPs). When you link users with the AdminLinkProviderForUser API operation, the output of ListUsers displays both the IdP user and the native user that you linked. You can identify IdP users in the Users object of this API response by the IdP prefix that Amazon Cognito appends to Username.

Errors

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

Examples

Example 1: A ListUsers request for the next 3 users whose email address starts with "testuser."

This request submits a value for all possible parameters for ListUsers. By iterating the PaginationToken, you can page through and collect all users in a user pool.

$result = $client->listUsers([
    'AttributesToGet' => [
        'email',
        'sub',
    ],
    'Filter' => '"email"^="testuser"',
    'Limit' => 3,
    'PaginationToken' => 'abcd1234EXAMPLE',
    'UserPoolId' => 'us-east-1_EXAMPLE',
]);

Result syntax:

[
    'PaginationToken' => 'efgh5678EXAMPLE',
    'Users' => [
        [
            'Attributes' => [
                [
                    'Name' => 'sub',
                    'Value' => 'eaad0219-2117-439f-8d46-4db20e59268f',
                ],
                [
                    'Name' => 'email',
                    'Value' => 'testuser@example.com',
                ],
            ],
            'Enabled' => 1,
            'UserCreateDate' => ,
            'UserLastModifiedDate' => ,
            'UserStatus' => 'CONFIRMED',
            'Username' => 'testuser',
        ],
        [
            'Attributes' => [
                [
                    'Name' => 'sub',
                    'Value' => '3b994cfd-0b07-4581-be46-3c82f9a70c90',
                ],
                [
                    'Name' => 'email',
                    'Value' => 'testuser2@example.com',
                ],
            ],
            'Enabled' => 1,
            'UserCreateDate' => ,
            'UserLastModifiedDate' => ,
            'UserStatus' => 'UNCONFIRMED',
            'Username' => 'testuser2',
        ],
        [
            'Attributes' => [
                [
                    'Name' => 'sub',
                    'Value' => '5929e0d1-4c34-42d1-9b79-a5ecacfe66f7',
                ],
                [
                    'Name' => 'email',
                    'Value' => 'testuser3@example.com',
                ],
            ],
            'Enabled' => 1,
            'UserCreateDate' => ,
            'UserLastModifiedDate' => ,
            'UserStatus' => 'UNCONFIRMED',
            'Username' => 'testuser3@example.com',
        ],
    ],
]

ListUsersInGroup

$result = $client->listUsersInGroup([/* ... */]);
$promise = $client->listUsersInGroupAsync([/* ... */]);

Lists the users in the specified group.

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

Learn more

Parameter Syntax

$result = $client->listUsersInGroup([
    'GroupName' => '<string>', // REQUIRED
    'Limit' => <integer>,
    'NextToken' => '<string>',
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
GroupName
Required: Yes
Type: string

The name of the group.

Limit
Type: int

The maximum number of users that you want to retrieve before pagination.

NextToken
Type: 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.

UserPoolId
Required: Yes
Type: string

The ID of the user pool.

Result Syntax

[
    'NextToken' => '<string>',
    'Users' => [
        [
            'Attributes' => [
                [
                    'Name' => '<string>',
                    'Value' => '<string>',
                ],
                // ...
            ],
            'Enabled' => true || false,
            'MFAOptions' => [
                [
                    'AttributeName' => '<string>',
                    'DeliveryMedium' => 'SMS|EMAIL',
                ],
                // ...
            ],
            'UserCreateDate' => <DateTime>,
            'UserLastModifiedDate' => <DateTime>,
            'UserStatus' => 'UNCONFIRMED|CONFIRMED|ARCHIVED|COMPROMISED|UNKNOWN|RESET_REQUIRED|FORCE_CHANGE_PASSWORD|EXTERNAL_PROVIDER',
            'Username' => '<string>',
        ],
        // ...
    ],
]

Result Details

Members
NextToken
Type: string

An identifier that you can use in a later request to return the next set of items in the list.

Users
Type: Array of UserType structures

A list of users in the group, and their attributes.

Errors

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

ListWebAuthnCredentials

$result = $client->listWebAuthnCredentials([/* ... */]);
$promise = $client->listWebAuthnCredentialsAsync([/* ... */]);

Generates a list of the current user's registered passkey, or webauthN, credentials.

Parameter Syntax

$result = $client->listWebAuthnCredentials([
    'AccessToken' => '<string>', // REQUIRED
    'MaxResults' => <integer>,
    'NextToken' => '<string>',
]);

Parameter Details

Members
AccessToken
Required: Yes
Type: string

A valid access token that Amazon Cognito issued to the user whose registered passkeys you want to list.

MaxResults
Type: int

The maximum number of the user's passkey credentials that you want to return.

NextToken
Type: 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.

Result Syntax

[
    'Credentials' => [
        [
            'AuthenticatorAttachment' => '<string>',
            'AuthenticatorTransports' => ['<string>', ...],
            'CreatedAt' => <DateTime>,
            'CredentialId' => '<string>',
            'FriendlyCredentialName' => '<string>',
            'RelyingPartyId' => '<string>',
        ],
        // ...
    ],
    'NextToken' => '<string>',
]

Result Details

Members
Credentials
Required: Yes
Type: Array of WebAuthnCredentialDescription structures

A list of registered passkeys for a user.

NextToken
Type: string

An identifier that you can use in a later request to return the next set of items in the list.

Errors

ForbiddenException:

This exception is thrown when WAF doesn't allow your request based on a web ACL that's associated with your user pool.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

ResendConfirmationCode

$result = $client->resendConfirmationCode([/* ... */]);
$promise = $client->resendConfirmationCodeAsync([/* ... */]);

Resends the confirmation (for confirmation of registration) to a specific user in the user pool.

Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.

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 Services 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.

Parameter Syntax

$result = $client->resendConfirmationCode([
    'AnalyticsMetadata' => [
        'AnalyticsEndpointId' => '<string>',
    ],
    'ClientId' => '<string>', // REQUIRED
    'ClientMetadata' => ['<string>', ...],
    'SecretHash' => '<string>',
    'UserContextData' => [
        'EncodedData' => '<string>',
        'IpAddress' => '<string>',
    ],
    'Username' => '<string>', // REQUIRED
]);

Parameter Details

Members
AnalyticsMetadata
Type: AnalyticsMetadataType structure

The Amazon Pinpoint analytics metadata that contributes to your metrics for ResendConfirmationCode calls.

ClientId
Required: Yes
Type: string

The ID of the client associated with the user pool.

ClientMetadata
Type: Associative array of custom strings keys (StringType) to strings

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.

When you use the ClientMetadata parameter, note 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 send sensitive information in this parameter.

SecretHash
Type: 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. For more information about SecretHash, see Computing secret hash values.

UserContextData
Type: UserContextDataType structure

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.

For more information, see Collecting data for threat protection in applications.

Username
Required: Yes
Type: string

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

Result Syntax

[
    'CodeDeliveryDetails' => [
        'AttributeName' => '<string>',
        'DeliveryMedium' => 'SMS|EMAIL',
        'Destination' => '<string>',
    ],
]

Result Details

Members
CodeDeliveryDetails
Type: CodeDeliveryDetailsType structure

The code delivery details returned by the server in response to the request to resend the confirmation code.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

UnexpectedLambdaException:

This exception is thrown when Amazon Cognito encounters an unexpected exception with Lambda.

UserLambdaValidationException:

This exception is thrown when the Amazon Cognito service encounters a user validation exception with the Lambda service.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

InvalidLambdaResponseException:

This exception is thrown when Amazon Cognito encounters an invalid Lambda response.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

LimitExceededException:

This exception is thrown when a user exceeds the limit for a requested Amazon Web Services resource.

InvalidSmsRoleAccessPolicyException:

This exception is returned when the role provided for SMS configuration doesn't have permission to publish using Amazon SNS.

InvalidSmsRoleTrustRelationshipException:

This exception is thrown when the trust relationship is not valid for the role provided for SMS configuration. This can happen if you don't trust cognito-idp.amazonaws.com or the external ID provided in the role does not match what is provided in the SMS configuration for the user pool.

InvalidEmailRoleAccessPolicyException:

This exception is thrown when Amazon Cognito isn't allowed to use your email identity. HTTP status code: 400.

CodeDeliveryFailureException:

This exception is thrown when a verification code fails to deliver successfully.

UserNotFoundException:

This exception is thrown when a user isn't found.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

ForbiddenException:

This exception is thrown when WAF doesn't allow your request based on a web ACL that's associated with your user pool.

RespondToAuthChallenge

$result = $client->respondToAuthChallenge([/* ... */]);
$promise = $client->respondToAuthChallengeAsync([/* ... */]);

Some API operations in a user pool generate a challenge, like a prompt for an MFA code, for device authentication that bypasses MFA, or for a custom authentication challenge. A RespondToAuthChallenge API request provides the answer to that challenge, like a code or a secure remote password (SRP). The parameters of a response to an authentication challenge vary with the type of challenge.

For more information about custom authentication challenges, see Custom authentication challenge Lambda triggers.

Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.

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 Services 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.

Parameter Syntax

$result = $client->respondToAuthChallenge([
    'AnalyticsMetadata' => [
        'AnalyticsEndpointId' => '<string>',
    ],
    'ChallengeName' => 'SMS_MFA|EMAIL_OTP|SOFTWARE_TOKEN_MFA|SELECT_MFA_TYPE|MFA_SETUP|PASSWORD_VERIFIER|CUSTOM_CHALLENGE|SELECT_CHALLENGE|DEVICE_SRP_AUTH|DEVICE_PASSWORD_VERIFIER|ADMIN_NO_SRP_AUTH|NEW_PASSWORD_REQUIRED|SMS_OTP|PASSWORD|WEB_AUTHN|PASSWORD_SRP', // REQUIRED
    'ChallengeResponses' => ['<string>', ...],
    'ClientId' => '<string>', // REQUIRED
    'ClientMetadata' => ['<string>', ...],
    'Session' => '<string>',
    'UserContextData' => [
        'EncodedData' => '<string>',
        'IpAddress' => '<string>',
    ],
]);

Parameter Details

Members
AnalyticsMetadata
Type: AnalyticsMetadataType structure

The Amazon Pinpoint analytics metadata that contributes to your metrics for RespondToAuthChallenge calls.

ChallengeName
Required: Yes
Type: string

The challenge name. For more information, see InitiateAuth.

ADMIN_NO_SRP_AUTH isn't a valid value.

ChallengeResponses
Type: Associative array of custom strings keys (StringType) to strings

The responses to the challenge that you received in the previous request. Each challenge has its own required response parameters. The following examples are partial JSON request bodies that highlight challenge-response parameters.

You must provide a SECRET_HASH parameter in all challenge responses to an app client that has a client secret. Include a DEVICE_KEY for device authentication.

SELECT_CHALLENGE

"ChallengeName": "SELECT_CHALLENGE", "ChallengeResponses": { "USERNAME": "[username]", "ANSWER": "[Challenge name]"}

Available challenges are PASSWORD, PASSWORD_SRP, EMAIL_OTP, SMS_OTP, and WEB_AUTHN.

Complete authentication in the SELECT_CHALLENGE response for PASSWORD, PASSWORD_SRP, and WEB_AUTHN:

  • "ChallengeName": "SELECT_CHALLENGE", "ChallengeResponses": { "ANSWER": "WEB_AUTHN", "USERNAME": "[username]", "CREDENTIAL": "[AuthenticationResponseJSON]"}

    See AuthenticationResponseJSON.

  • "ChallengeName": "SELECT_CHALLENGE", "ChallengeResponses": { "ANSWER": "PASSWORD", "USERNAME": "[username]", "PASSWORD": "[password]"}

  • "ChallengeName": "SELECT_CHALLENGE", "ChallengeResponses": { "ANSWER": "PASSWORD_SRP", "USERNAME": "[username]", "SRP_A": "[SRP_A]"}

For SMS_OTP and EMAIL_OTP, respond with the username and answer. Your user pool will send a code for the user to submit in the next challenge response.

  • "ChallengeName": "SELECT_CHALLENGE", "ChallengeResponses": { "ANSWER": "SMS_OTP", "USERNAME": "[username]"}

  • "ChallengeName": "SELECT_CHALLENGE", "ChallengeResponses": { "ANSWER": "EMAIL_OTP", "USERNAME": "[username]"}

SMS_OTP

"ChallengeName": "SMS_OTP", "ChallengeResponses": {"SMS_OTP_CODE": "[code]", "USERNAME": "[username]"}

EMAIL_OTP

"ChallengeName": "EMAIL_OTP", "ChallengeResponses": {"EMAIL_OTP_CODE": "[code]", "USERNAME": "[username]"}

SMS_MFA

"ChallengeName": "SMS_MFA", "ChallengeResponses": {"SMS_MFA_CODE": "[code]", "USERNAME": "[username]"}

PASSWORD_VERIFIER

This challenge response is part of the SRP flow. Amazon Cognito requires that your application respond to this challenge within a few seconds. When the response time exceeds this period, your user pool returns a NotAuthorizedException error.

"ChallengeName": "PASSWORD_VERIFIER", "ChallengeResponses": {"PASSWORD_CLAIM_SIGNATURE": "[claim_signature]", "PASSWORD_CLAIM_SECRET_BLOCK": "[secret_block]", "TIMESTAMP": [timestamp], "USERNAME": "[username]"}

Add "DEVICE_KEY" when you sign in with a remembered device.

CUSTOM_CHALLENGE

"ChallengeName": "CUSTOM_CHALLENGE", "ChallengeResponses": {"USERNAME": "[username]", "ANSWER": "[challenge_answer]"}

Add "DEVICE_KEY" when you sign in with a remembered device.

NEW_PASSWORD_REQUIRED

"ChallengeName": "NEW_PASSWORD_REQUIRED", "ChallengeResponses": {"NEW_PASSWORD": "[new_password]", "USERNAME": "[username]"}

To set any required attributes that InitiateAuth returned in an requiredAttributes parameter, add "userAttributes.[attribute_name]": "[attribute_value]". This parameter can also set values for writable attributes that aren't required by your user pool.

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

"ChallengeName": "SOFTWARE_TOKEN_MFA", "ChallengeResponses": {"USERNAME": "[username]", "SOFTWARE_TOKEN_MFA_CODE": [authenticator_code]}

DEVICE_SRP_AUTH

"ChallengeName": "DEVICE_SRP_AUTH", "ChallengeResponses": {"USERNAME": "[username]", "DEVICE_KEY": "[device_key]", "SRP_A": "[srp_a]"}

DEVICE_PASSWORD_VERIFIER

"ChallengeName": "DEVICE_PASSWORD_VERIFIER", "ChallengeResponses": {"DEVICE_KEY": "[device_key]", "PASSWORD_CLAIM_SIGNATURE": "[claim_signature]", "PASSWORD_CLAIM_SECRET_BLOCK": "[secret_block]", "TIMESTAMP": [timestamp], "USERNAME": "[username]"}

MFA_SETUP

"ChallengeName": "MFA_SETUP", "ChallengeResponses": {"USERNAME": "[username]"}, "SESSION": "[Session ID from VerifySoftwareToken]"

SELECT_MFA_TYPE

"ChallengeName": "SELECT_MFA_TYPE", "ChallengeResponses": {"USERNAME": "[username]", "ANSWER": "[SMS_MFA or SOFTWARE_TOKEN_MFA]"}

For more information about SECRET_HASH, see Computing secret hash values. For information about DEVICE_KEY, see Working with user devices in your user pool.

ClientId
Required: Yes
Type: string

The app client ID.

ClientMetadata
Type: Associative array of custom strings keys (StringType) to strings

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.

When you use the ClientMetadata parameter, note 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 send sensitive information in this parameter.

Session
Type: 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.

UserContextData
Type: UserContextDataType structure

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.

For more information, see Collecting data for threat protection in applications.

Result Syntax

[
    'AuthenticationResult' => [
        'AccessToken' => '<string>',
        'ExpiresIn' => <integer>,
        'IdToken' => '<string>',
        'NewDeviceMetadata' => [
            'DeviceGroupKey' => '<string>',
            'DeviceKey' => '<string>',
        ],
        'RefreshToken' => '<string>',
        'TokenType' => '<string>',
    ],
    'ChallengeName' => 'SMS_MFA|EMAIL_OTP|SOFTWARE_TOKEN_MFA|SELECT_MFA_TYPE|MFA_SETUP|PASSWORD_VERIFIER|CUSTOM_CHALLENGE|SELECT_CHALLENGE|DEVICE_SRP_AUTH|DEVICE_PASSWORD_VERIFIER|ADMIN_NO_SRP_AUTH|NEW_PASSWORD_REQUIRED|SMS_OTP|PASSWORD|WEB_AUTHN|PASSWORD_SRP',
    'ChallengeParameters' => ['<string>', ...],
    'Session' => '<string>',
]

Result Details

Members
AuthenticationResult
Type: AuthenticationResultType structure

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

ChallengeName
Type: string

The challenge name. For more information, see InitiateAuth.

ChallengeParameters
Type: Associative array of custom strings keys (StringType) to strings

The challenge parameters. For more information, see InitiateAuth.

Session
Type: 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.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

CodeMismatchException:

This exception is thrown if the provided code doesn't match what the server was expecting.

ExpiredCodeException:

This exception is thrown if a code has expired.

UnexpectedLambdaException:

This exception is thrown when Amazon Cognito encounters an unexpected exception with Lambda.

UserLambdaValidationException:

This exception is thrown when the Amazon Cognito service encounters a user validation exception with the Lambda service.

InvalidPasswordException:

This exception is thrown when Amazon Cognito encounters an invalid password.

PasswordHistoryPolicyViolationException:

The message returned when a user's new password matches a previous password and doesn't comply with the password-history policy.

InvalidLambdaResponseException:

This exception is thrown when Amazon Cognito encounters an invalid Lambda response.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

InvalidUserPoolConfigurationException:

This exception is thrown when the user pool configuration is not valid.

MFAMethodNotFoundException:

This exception is thrown when Amazon Cognito can't find a multi-factor authentication (MFA) method.

PasswordResetRequiredException:

This exception is thrown when a password reset is required.

UserNotFoundException:

This exception is thrown when a user isn't found.

UserNotConfirmedException:

This exception is thrown when a user isn't confirmed successfully.

InvalidSmsRoleAccessPolicyException:

This exception is returned when the role provided for SMS configuration doesn't have permission to publish using Amazon SNS.

InvalidSmsRoleTrustRelationshipException:

This exception is thrown when the trust relationship is not valid for the role provided for SMS configuration. This can happen if you don't trust cognito-idp.amazonaws.com or the external ID provided in the role does not match what is provided in the SMS configuration for the user pool.

InvalidEmailRoleAccessPolicyException:

This exception is thrown when Amazon Cognito isn't allowed to use your email identity. HTTP status code: 400.

AliasExistsException:

This exception is thrown when a user tries to confirm the account with an email address or phone number that has already been supplied as an alias for a different user profile. This exception indicates that an account with this email address or phone already exists in a user pool that you've configured to use email address or phone number as a sign-in alias.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

SoftwareTokenMFANotFoundException:

This exception is thrown when the software token time-based one-time password (TOTP) multi-factor authentication (MFA) isn't activated for the user pool.

ForbiddenException:

This exception is thrown when WAF doesn't allow your request based on a web ACL that's associated with your user pool.

RevokeToken

$result = $client->revokeToken([/* ... */]);
$promise = $client->revokeTokenAsync([/* ... */]);

Revokes all of the access tokens generated by, and at the same time as, the specified refresh token. After a token is revoked, you can't use the revoked token to access Amazon Cognito user APIs, or to authorize access to your resource server.

Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.

Parameter Syntax

$result = $client->revokeToken([
    'ClientId' => '<string>', // REQUIRED
    'ClientSecret' => '<string>',
    'Token' => '<string>', // REQUIRED
]);

Parameter Details

Members
ClientId
Required: Yes
Type: string

The client ID for the token that you want to revoke.

ClientSecret
Type: string

The secret for the client ID. This is required only if the client ID has a secret.

Token
Required: Yes
Type: string

The refresh token that you want to revoke.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

UnauthorizedException:

Exception that is thrown when the request isn't authorized. This can happen due to an invalid access token in the request.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

UnsupportedOperationException:

Exception that is thrown when you attempt to perform an operation that isn't enabled for the user pool client.

UnsupportedTokenTypeException:

Exception that is thrown when an unsupported token is passed to an operation.

ForbiddenException:

This exception is thrown when WAF doesn't allow your request based on a web ACL that's associated with your user pool.

SetLogDeliveryConfiguration

$result = $client->setLogDeliveryConfiguration([/* ... */]);
$promise = $client->setLogDeliveryConfigurationAsync([/* ... */]);

Sets up or modifies the logging configuration of a user pool. User pools can export user notification logs and advanced security features user activity logs.

Parameter Syntax

$result = $client->setLogDeliveryConfiguration([
    'LogConfigurations' => [ // REQUIRED
        [
            'CloudWatchLogsConfiguration' => [
                'LogGroupArn' => '<string>',
            ],
            'EventSource' => 'userNotification|userAuthEvents', // REQUIRED
            'FirehoseConfiguration' => [
                'StreamArn' => '<string>',
            ],
            'LogLevel' => 'ERROR|INFO', // REQUIRED
            'S3Configuration' => [
                'BucketArn' => '<string>',
            ],
        ],
        // ...
    ],
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
LogConfigurations
Required: Yes
Type: Array of LogConfigurationType structures

A collection of the logging configurations for a user pool.

UserPoolId
Required: Yes
Type: string

The ID of the user pool where you want to configure logging.

Result Syntax

[
    'LogDeliveryConfiguration' => [
        'LogConfigurations' => [
            [
                'CloudWatchLogsConfiguration' => [
                    'LogGroupArn' => '<string>',
                ],
                'EventSource' => 'userNotification|userAuthEvents',
                'FirehoseConfiguration' => [
                    'StreamArn' => '<string>',
                ],
                'LogLevel' => 'ERROR|INFO',
                'S3Configuration' => [
                    'BucketArn' => '<string>',
                ],
            ],
            // ...
        ],
        'UserPoolId' => '<string>',
    ],
]

Result Details

Members
LogDeliveryConfiguration

The detailed activity logging configuration that you applied to the requested user pool.

Errors

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

FeatureUnavailableInTierException:

This exception is thrown when a feature you attempted to configure isn't available in your current feature plan.

SetRiskConfiguration

$result = $client->setRiskConfiguration([/* ... */]);
$promise = $client->setRiskConfigurationAsync([/* ... */]);

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 keyAdvancedSecurityMode.

Parameter Syntax

$result = $client->setRiskConfiguration([
    'AccountTakeoverRiskConfiguration' => [
        'Actions' => [ // REQUIRED
            'HighAction' => [
                'EventAction' => 'BLOCK|MFA_IF_CONFIGURED|MFA_REQUIRED|NO_ACTION', // REQUIRED
                'Notify' => true || false, // REQUIRED
            ],
            'LowAction' => [
                'EventAction' => 'BLOCK|MFA_IF_CONFIGURED|MFA_REQUIRED|NO_ACTION', // REQUIRED
                'Notify' => true || false, // REQUIRED
            ],
            'MediumAction' => [
                'EventAction' => 'BLOCK|MFA_IF_CONFIGURED|MFA_REQUIRED|NO_ACTION', // REQUIRED
                'Notify' => true || false, // REQUIRED
            ],
        ],
        'NotifyConfiguration' => [
            'BlockEmail' => [
                'HtmlBody' => '<string>',
                'Subject' => '<string>', // REQUIRED
                'TextBody' => '<string>',
            ],
            'From' => '<string>',
            'MfaEmail' => [
                'HtmlBody' => '<string>',
                'Subject' => '<string>', // REQUIRED
                'TextBody' => '<string>',
            ],
            'NoActionEmail' => [
                'HtmlBody' => '<string>',
                'Subject' => '<string>', // REQUIRED
                'TextBody' => '<string>',
            ],
            'ReplyTo' => '<string>',
            'SourceArn' => '<string>', // REQUIRED
        ],
    ],
    'ClientId' => '<string>',
    'CompromisedCredentialsRiskConfiguration' => [
        'Actions' => [ // REQUIRED
            'EventAction' => 'BLOCK|NO_ACTION', // REQUIRED
        ],
        'EventFilter' => ['<string>', ...],
    ],
    'RiskExceptionConfiguration' => [
        'BlockedIPRangeList' => ['<string>', ...],
        'SkippedIPRangeList' => ['<string>', ...],
    ],
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
AccountTakeoverRiskConfiguration

The account takeover risk configuration.

ClientId
Type: 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

The compromised credentials risk configuration.

RiskExceptionConfiguration

The configuration to override the risk decision.

UserPoolId
Required: Yes
Type: string

The user pool ID.

Result Syntax

[
    'RiskConfiguration' => [
        'AccountTakeoverRiskConfiguration' => [
            'Actions' => [
                'HighAction' => [
                    'EventAction' => 'BLOCK|MFA_IF_CONFIGURED|MFA_REQUIRED|NO_ACTION',
                    'Notify' => true || false,
                ],
                'LowAction' => [
                    'EventAction' => 'BLOCK|MFA_IF_CONFIGURED|MFA_REQUIRED|NO_ACTION',
                    'Notify' => true || false,
                ],
                'MediumAction' => [
                    'EventAction' => 'BLOCK|MFA_IF_CONFIGURED|MFA_REQUIRED|NO_ACTION',
                    'Notify' => true || false,
                ],
            ],
            'NotifyConfiguration' => [
                'BlockEmail' => [
                    'HtmlBody' => '<string>',
                    'Subject' => '<string>',
                    'TextBody' => '<string>',
                ],
                'From' => '<string>',
                'MfaEmail' => [
                    'HtmlBody' => '<string>',
                    'Subject' => '<string>',
                    'TextBody' => '<string>',
                ],
                'NoActionEmail' => [
                    'HtmlBody' => '<string>',
                    'Subject' => '<string>',
                    'TextBody' => '<string>',
                ],
                'ReplyTo' => '<string>',
                'SourceArn' => '<string>',
            ],
        ],
        'ClientId' => '<string>',
        'CompromisedCredentialsRiskConfiguration' => [
            'Actions' => [
                'EventAction' => 'BLOCK|NO_ACTION',
            ],
            'EventFilter' => ['<string>', ...],
        ],
        'LastModifiedDate' => <DateTime>,
        'RiskExceptionConfiguration' => [
            'BlockedIPRangeList' => ['<string>', ...],
            'SkippedIPRangeList' => ['<string>', ...],
        ],
        'UserPoolId' => '<string>',
    ],
]

Result Details

Members
RiskConfiguration
Required: Yes
Type: RiskConfigurationType structure

The risk configuration.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

UserPoolAddOnNotEnabledException:

This exception is thrown when user pool add-ons aren't enabled.

CodeDeliveryFailureException:

This exception is thrown when a verification code fails to deliver successfully.

InvalidEmailRoleAccessPolicyException:

This exception is thrown when Amazon Cognito isn't allowed to use your email identity. HTTP status code: 400.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

SetUICustomization

$result = $client->setUICustomization([/* ... */]);
$promise = $client->setUICustomizationAsync([/* ... */]);

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.

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.

Parameter Syntax

$result = $client->setUICustomization([
    'CSS' => '<string>',
    'ClientId' => '<string>',
    'ImageFile' => <string || resource || Psr\Http\Message\StreamInterface>,
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
CSS
Type: string

The CSS values in the UI customization.

ClientId
Type: string

The client ID for the client app.

ImageFile
Type: blob (string|resource|Psr\Http\Message\StreamInterface)

The uploaded logo image for the UI customization.

UserPoolId
Required: Yes
Type: string

The ID of the user pool.

Result Syntax

[
    'UICustomization' => [
        'CSS' => '<string>',
        'CSSVersion' => '<string>',
        'ClientId' => '<string>',
        'CreationDate' => <DateTime>,
        'ImageUrl' => '<string>',
        'LastModifiedDate' => <DateTime>,
        'UserPoolId' => '<string>',
    ],
]

Result Details

Members
UICustomization
Required: Yes
Type: UICustomizationType structure

The UI customization information.

Errors

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

SetUserMFAPreference

$result = $client->setUserMFAPreference([/* ... */]);
$promise = $client->setUserMFAPreferenceAsync([/* ... */]);

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.

This operation doesn't reset an existing TOTP MFA for a user. To register a new TOTP factor for a user, make an AssociateSoftwareToken request. For more information, see TOTP software token MFA.

Authorize this action with a signed-in user's access token. It must include the scope aws.cognito.signin.user.admin.

Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.

Parameter Syntax

$result = $client->setUserMFAPreference([
    'AccessToken' => '<string>', // REQUIRED
    'EmailMfaSettings' => [
        'Enabled' => true || false,
        'PreferredMfa' => true || false,
    ],
    'SMSMfaSettings' => [
        'Enabled' => true || false,
        'PreferredMfa' => true || false,
    ],
    'SoftwareTokenMfaSettings' => [
        'Enabled' => true || false,
        'PreferredMfa' => true || false,
    ],
]);

Parameter Details

Members
AccessToken
Required: Yes
Type: string

A valid access token that Amazon Cognito issued to the user whose MFA preference you want to set.

EmailMfaSettings
Type: EmailMfaSettingsType structure

User preferences for email message MFA. Activates or deactivates email MFA and sets it as the preferred MFA method when multiple methods are available. To activate this setting, advanced security features must be active in your user pool.

SMSMfaSettings
Type: SMSMfaSettingsType structure

User preferences for SMS message MFA. Activates or deactivates SMS MFA and sets it as the preferred MFA method when multiple methods are available.

SoftwareTokenMfaSettings

User preferences for time-based one-time password (TOTP) MFA. Activates or deactivates TOTP MFA and sets it as the preferred MFA method when multiple methods are available.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

PasswordResetRequiredException:

This exception is thrown when a password reset is required.

UserNotFoundException:

This exception is thrown when a user isn't found.

UserNotConfirmedException:

This exception is thrown when a user isn't confirmed successfully.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

ForbiddenException:

This exception is thrown when WAF doesn't allow your request based on a web ACL that's associated with your user pool.

SetUserPoolMfaConfig

$result = $client->setUserPoolMfaConfig([/* ... */]);
$promise = $client->setUserPoolMfaConfigAsync([/* ... */]);

Sets the user pool multi-factor authentication (MFA) and passkey configuration.

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 Services 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.

Parameter Syntax

$result = $client->setUserPoolMfaConfig([
    'EmailMfaConfiguration' => [
        'Message' => '<string>',
        'Subject' => '<string>',
    ],
    'MfaConfiguration' => 'OFF|ON|OPTIONAL',
    'SmsMfaConfiguration' => [
        'SmsAuthenticationMessage' => '<string>',
        'SmsConfiguration' => [
            'ExternalId' => '<string>',
            'SnsCallerArn' => '<string>', // REQUIRED
            'SnsRegion' => '<string>',
        ],
    ],
    'SoftwareTokenMfaConfiguration' => [
        'Enabled' => true || false,
    ],
    'UserPoolId' => '<string>', // REQUIRED
    'WebAuthnConfiguration' => [
        'RelyingPartyId' => '<string>',
        'UserVerification' => 'required|preferred',
    ],
]);

Parameter Details

Members
EmailMfaConfiguration
Type: EmailMfaConfigType structure

Configures user pool email messages for MFA. Sets the subject and body of the email message template for MFA messages. To activate this setting, advanced security features must be active in your user pool.

MfaConfiguration
Type: 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.

SmsMfaConfiguration
Type: SmsMfaConfigType structure

Configures user pool SMS messages for MFA. Sets the message template and the SMS message sending configuration for Amazon SNS.

SoftwareTokenMfaConfiguration
Type: SoftwareTokenMfaConfigType structure

Configures a user pool for time-based one-time password (TOTP) MFA. Enables or disables TOTP.

UserPoolId
Required: Yes
Type: string

The user pool ID.

WebAuthnConfiguration
Type: WebAuthnConfigurationType structure

The configuration of your user pool for passkey, or webauthN, authentication and registration. You can set this configuration independent of the MFA configuration options in this operation.

Result Syntax

[
    'EmailMfaConfiguration' => [
        'Message' => '<string>',
        'Subject' => '<string>',
    ],
    'MfaConfiguration' => 'OFF|ON|OPTIONAL',
    'SmsMfaConfiguration' => [
        'SmsAuthenticationMessage' => '<string>',
        'SmsConfiguration' => [
            'ExternalId' => '<string>',
            'SnsCallerArn' => '<string>',
            'SnsRegion' => '<string>',
        ],
    ],
    'SoftwareTokenMfaConfiguration' => [
        'Enabled' => true || false,
    ],
    'WebAuthnConfiguration' => [
        'RelyingPartyId' => '<string>',
        'UserVerification' => 'required|preferred',
    ],
]

Result Details

Members
EmailMfaConfiguration
Type: EmailMfaConfigType structure

Shows user pool email message configuration for MFA. Includes the subject and body of the email message template for MFA messages. To activate this setting, advanced security features must be active in your user pool.

MfaConfiguration
Type: 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.

SmsMfaConfiguration
Type: SmsMfaConfigType structure

Shows user pool SMS message configuration for MFA. Includes the message template and the SMS message sending configuration for Amazon SNS.

SoftwareTokenMfaConfiguration
Type: SoftwareTokenMfaConfigType structure

Shows user pool configuration for time-based one-time password (TOTP) MFA. Includes TOTP enabled or disabled state.

WebAuthnConfiguration
Type: WebAuthnConfigurationType structure

The configuration of your user pool for passkey, or webauthN, biometric and security-key devices.

Errors

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

ConcurrentModificationException:

This exception is thrown if two or more modifications are happening concurrently.

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidSmsRoleAccessPolicyException:

This exception is returned when the role provided for SMS configuration doesn't have permission to publish using Amazon SNS.

InvalidSmsRoleTrustRelationshipException:

This exception is thrown when the trust relationship is not valid for the role provided for SMS configuration. This can happen if you don't trust cognito-idp.amazonaws.com or the external ID provided in the role does not match what is provided in the SMS configuration for the user pool.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

FeatureUnavailableInTierException:

This exception is thrown when a feature you attempted to configure isn't available in your current feature plan.

SetUserSettings

$result = $client->setUserSettings([/* ... */]);
$promise = $client->setUserSettingsAsync([/* ... */]);

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.

Authorize this action with a signed-in user's access token. It must include the scope aws.cognito.signin.user.admin.

Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.

Parameter Syntax

$result = $client->setUserSettings([
    'AccessToken' => '<string>', // REQUIRED
    'MFAOptions' => [ // REQUIRED
        [
            'AttributeName' => '<string>',
            'DeliveryMedium' => 'SMS|EMAIL',
        ],
        // ...
    ],
]);

Parameter Details

Members
AccessToken
Required: Yes
Type: string

A valid access token that Amazon Cognito issued to the user whose user settings you want to configure.

MFAOptions
Required: Yes
Type: Array of MFAOptionType structures

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

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

PasswordResetRequiredException:

This exception is thrown when a password reset is required.

UserNotFoundException:

This exception is thrown when a user isn't found.

UserNotConfirmedException:

This exception is thrown when a user isn't confirmed successfully.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

ForbiddenException:

This exception is thrown when WAF doesn't allow your request based on a web ACL that's associated with your user pool.

SignUp

$result = $client->signUp([/* ... */]);
$promise = $client->signUpAsync([/* ... */]);

Registers the user in the specified user pool and creates a user name, password, and user attributes.

Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.

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 Services 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.

You might receive a LimitExceeded exception in response to this request if you have exceeded a rate quota for email or SMS messages, and if your user pool automatically verifies email addresses or phone numbers. When you get this exception in the response, the user is successfully created and is in an UNCONFIRMED state. You can send a new code with the ResendConfirmationCode request, or confirm the user as an administrator with an AdminConfirmSignUp request.

Parameter Syntax

$result = $client->signUp([
    'AnalyticsMetadata' => [
        'AnalyticsEndpointId' => '<string>',
    ],
    'ClientId' => '<string>', // REQUIRED
    'ClientMetadata' => ['<string>', ...],
    'Password' => '<string>',
    'SecretHash' => '<string>',
    'UserAttributes' => [
        [
            'Name' => '<string>', // REQUIRED
            'Value' => '<string>',
        ],
        // ...
    ],
    'UserContextData' => [
        'EncodedData' => '<string>',
        'IpAddress' => '<string>',
    ],
    'Username' => '<string>', // REQUIRED
    'ValidationData' => [
        [
            'Name' => '<string>', // REQUIRED
            'Value' => '<string>',
        ],
        // ...
    ],
]);

Parameter Details

Members
AnalyticsMetadata
Type: AnalyticsMetadataType structure

The Amazon Pinpoint analytics metadata that contributes to your metrics for SignUp calls.

ClientId
Required: Yes
Type: string

The ID of the client associated with the user pool.

ClientMetadata
Type: Associative array of custom strings keys (StringType) to strings

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.

When you use the ClientMetadata parameter, note 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 send sensitive information in this parameter.

Password
Type: string

The password of the user you want to register.

Users can sign up without a password when your user pool supports passwordless sign-in with email or SMS OTPs. To create a user with no password, omit this parameter or submit a blank value. You can only create a passwordless user when passwordless sign-in is available. See the SignInPolicyType property of CreateUserPool and UpdateUserPool.

SecretHash
Type: 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. For more information about SecretHash, see Computing secret hash values.

UserAttributes
Type: Array of AttributeType structures

An array of name-value pairs representing user attributes.

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

UserContextData
Type: UserContextDataType structure

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.

For more information, see Collecting data for threat protection in applications.

Username
Required: Yes
Type: string

The username of the user that you want to sign up. The value of this parameter is typically a username, but can be any alias attribute in your user pool.

ValidationData
Type: Array of AttributeType structures

Temporary user attributes that contribute to the outcomes of your pre sign-up Lambda trigger. This set of key-value pairs are for custom validation of information that you collect from your users but don't need to retain.

Your Lambda function can analyze this additional data and act on it. Your function might perform external API operations like logging user attributes and validation data to Amazon CloudWatch Logs. Validation data might also affect the response that your function returns to Amazon Cognito, like automatically confirming the user if they sign up from within your network.

For more information about the pre sign-up Lambda trigger, see Pre sign-up Lambda trigger.

Result Syntax

[
    'CodeDeliveryDetails' => [
        'AttributeName' => '<string>',
        'DeliveryMedium' => 'SMS|EMAIL',
        'Destination' => '<string>',
    ],
    'Session' => '<string>',
    'UserConfirmed' => true || false,
    'UserSub' => '<string>',
]

Result Details

Members
CodeDeliveryDetails
Type: CodeDeliveryDetailsType structure

The code delivery details returned by the server response to the user registration request.

Session
Type: string

A session Id that you can pass to ConfirmSignUp when you want to immediately sign in your user with the USER_AUTH flow after they complete sign-up.

UserConfirmed
Required: Yes
Type: boolean

A response from the server indicating that a user registration has been confirmed.

UserSub
Required: Yes
Type: string

The 128-bit ID of the authenticated user. This isn't the same as username.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

UnexpectedLambdaException:

This exception is thrown when Amazon Cognito encounters an unexpected exception with Lambda.

UserLambdaValidationException:

This exception is thrown when the Amazon Cognito service encounters a user validation exception with the Lambda service.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

InvalidPasswordException:

This exception is thrown when Amazon Cognito encounters an invalid password.

InvalidLambdaResponseException:

This exception is thrown when Amazon Cognito encounters an invalid Lambda response.

UsernameExistsException:

This exception is thrown when Amazon Cognito encounters a user name that already exists in the user pool.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

LimitExceededException:

This exception is thrown when a user exceeds the limit for a requested Amazon Web Services resource.

InvalidSmsRoleAccessPolicyException:

This exception is returned when the role provided for SMS configuration doesn't have permission to publish using Amazon SNS.

InvalidSmsRoleTrustRelationshipException:

This exception is thrown when the trust relationship is not valid for the role provided for SMS configuration. This can happen if you don't trust cognito-idp.amazonaws.com or the external ID provided in the role does not match what is provided in the SMS configuration for the user pool.

InvalidEmailRoleAccessPolicyException:

This exception is thrown when Amazon Cognito isn't allowed to use your email identity. HTTP status code: 400.

CodeDeliveryFailureException:

This exception is thrown when a verification code fails to deliver successfully.

ForbiddenException:

This exception is thrown when WAF doesn't allow your request based on a web ACL that's associated with your user pool.

StartUserImportJob

$result = $client->startUserImportJob([/* ... */]);
$promise = $client->startUserImportJobAsync([/* ... */]);

Starts the user import.

Parameter Syntax

$result = $client->startUserImportJob([
    'JobId' => '<string>', // REQUIRED
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
JobId
Required: Yes
Type: string

The job ID for the user import job.

UserPoolId
Required: Yes
Type: string

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

Result Syntax

[
    'UserImportJob' => [
        'CloudWatchLogsRoleArn' => '<string>',
        'CompletionDate' => <DateTime>,
        'CompletionMessage' => '<string>',
        'CreationDate' => <DateTime>,
        'FailedUsers' => <integer>,
        'ImportedUsers' => <integer>,
        'JobId' => '<string>',
        'JobName' => '<string>',
        'PreSignedUrl' => '<string>',
        'SkippedUsers' => <integer>,
        'StartDate' => <DateTime>,
        'Status' => 'Created|Pending|InProgress|Stopping|Expired|Stopped|Failed|Succeeded',
        'UserPoolId' => '<string>',
    ],
]

Result Details

Members
UserImportJob
Type: UserImportJobType structure

The job object that represents the user import job.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

PreconditionNotMetException:

This exception is thrown when a precondition is not met.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

StartWebAuthnRegistration

$result = $client->startWebAuthnRegistration([/* ... */]);
$promise = $client->startWebAuthnRegistrationAsync([/* ... */]);

Requests credential creation options from your user pool for registration of a passkey authenticator. Returns information about the user pool, the user profile, and authentication requirements. Users must provide this information in their request to enroll your application with their passkey provider.

After users present this data and register with their passkey provider, return the response to your user pool in a CompleteWebAuthnRegistration API request.

Authorize this action with a signed-in user's access token. It must include the scope aws.cognito.signin.user.admin.

Parameter Syntax

$result = $client->startWebAuthnRegistration([
    'AccessToken' => '<string>', // REQUIRED
]);

Parameter Details

Members
AccessToken
Required: Yes
Type: string

A valid access token that Amazon Cognito issued to the user whose passkey metadata you want to generate.

Result Syntax

[
    'CredentialCreationOptions' => [
    ],
]

Result Details

Members
CredentialCreationOptions
Required: Yes
Type: document (null|bool|string|numeric) or an (array|associative array) whose members are all valid documents

The information that a user can provide in their request to register with their passkey provider.

Errors

ForbiddenException:

This exception is thrown when WAF doesn't allow your request based on a web ACL that's associated with your user pool.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

LimitExceededException:

This exception is thrown when a user exceeds the limit for a requested Amazon Web Services resource.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

WebAuthnNotEnabledException:

This exception is thrown when the passkey feature isn't enabled for the user pool.

WebAuthnConfigurationMissingException:

This exception is thrown when a user pool doesn't have a configured relying party id or a user pool domain.

StopUserImportJob

$result = $client->stopUserImportJob([/* ... */]);
$promise = $client->stopUserImportJobAsync([/* ... */]);

Stops the user import job.

Parameter Syntax

$result = $client->stopUserImportJob([
    'JobId' => '<string>', // REQUIRED
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
JobId
Required: Yes
Type: string

The job ID for the user import job.

UserPoolId
Required: Yes
Type: string

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

Result Syntax

[
    'UserImportJob' => [
        'CloudWatchLogsRoleArn' => '<string>',
        'CompletionDate' => <DateTime>,
        'CompletionMessage' => '<string>',
        'CreationDate' => <DateTime>,
        'FailedUsers' => <integer>,
        'ImportedUsers' => <integer>,
        'JobId' => '<string>',
        'JobName' => '<string>',
        'PreSignedUrl' => '<string>',
        'SkippedUsers' => <integer>,
        'StartDate' => <DateTime>,
        'Status' => 'Created|Pending|InProgress|Stopping|Expired|Stopped|Failed|Succeeded',
        'UserPoolId' => '<string>',
    ],
]

Result Details

Members
UserImportJob
Type: UserImportJobType structure

The job object that represents the user import job.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

PreconditionNotMetException:

This exception is thrown when a precondition is not met.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

TagResource

$result = $client->tagResource([/* ... */]);
$promise = $client->tagResourceAsync([/* ... */]);

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.

Parameter Syntax

$result = $client->tagResource([
    'ResourceArn' => '<string>', // REQUIRED
    'Tags' => ['<string>', ...], // REQUIRED
]);

Parameter Details

Members
ResourceArn
Required: Yes
Type: string

The Amazon Resource Name (ARN) of the user pool to assign the tags to.

Tags
Required: Yes
Type: Associative array of custom strings keys (TagKeysType) to strings

The tags to assign to the user pool.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

UntagResource

$result = $client->untagResource([/* ... */]);
$promise = $client->untagResourceAsync([/* ... */]);

Removes the specified tags from an Amazon Cognito user pool. You can use this action up to 5 times per second, per account.

Parameter Syntax

$result = $client->untagResource([
    'ResourceArn' => '<string>', // REQUIRED
    'TagKeys' => ['<string>', ...], // REQUIRED
]);

Parameter Details

Members
ResourceArn
Required: Yes
Type: string

The Amazon Resource Name (ARN) of the user pool that the tags are assigned to.

TagKeys
Required: Yes
Type: Array of strings

The keys of the tags to remove from the user pool.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

UpdateAuthEventFeedback

$result = $client->updateAuthEventFeedback([/* ... */]);
$promise = $client->updateAuthEventFeedbackAsync([/* ... */]);

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.

Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.

Parameter Syntax

$result = $client->updateAuthEventFeedback([
    'EventId' => '<string>', // REQUIRED
    'FeedbackToken' => '<string>', // REQUIRED
    'FeedbackValue' => 'Valid|Invalid', // REQUIRED
    'UserPoolId' => '<string>', // REQUIRED
    'Username' => '<string>', // REQUIRED
]);

Parameter Details

Members
EventId
Required: Yes
Type: string

The event ID.

FeedbackToken
Required: Yes
Type: string

The feedback token.

FeedbackValue
Required: Yes
Type: string

The authentication event feedback value. When you provide a FeedbackValue value of valid, you tell Amazon Cognito that you trust a user session where Amazon Cognito has evaluated some level of risk. When you provide a FeedbackValue value of invalid, you tell Amazon Cognito that you don't trust a user session, or you don't believe that Amazon Cognito evaluated a high-enough risk level.

UserPoolId
Required: Yes
Type: string

The user pool ID.

Username
Required: Yes
Type: string

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

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

UserNotFoundException:

This exception is thrown when a user isn't found.

UserPoolAddOnNotEnabledException:

This exception is thrown when user pool add-ons aren't enabled.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

UpdateDeviceStatus

$result = $client->updateDeviceStatus([/* ... */]);
$promise = $client->updateDeviceStatusAsync([/* ... */]);

Updates the device status. For more information about device authentication, see Working with user devices in your user pool.

Authorize this action with a signed-in user's access token. It must include the scope aws.cognito.signin.user.admin.

Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.

Parameter Syntax

$result = $client->updateDeviceStatus([
    'AccessToken' => '<string>', // REQUIRED
    'DeviceKey' => '<string>', // REQUIRED
    'DeviceRememberedStatus' => 'remembered|not_remembered',
]);

Parameter Details

Members
AccessToken
Required: Yes
Type: string

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

DeviceKey
Required: Yes
Type: string

The device key.

DeviceRememberedStatus
Type: string

The status of whether a device is remembered.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

InvalidUserPoolConfigurationException:

This exception is thrown when the user pool configuration is not valid.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

PasswordResetRequiredException:

This exception is thrown when a password reset is required.

UserNotFoundException:

This exception is thrown when a user isn't found.

UserNotConfirmedException:

This exception is thrown when a user isn't confirmed successfully.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

ForbiddenException:

This exception is thrown when WAF doesn't allow your request based on a web ACL that's associated with your user pool.

UpdateGroup

$result = $client->updateGroup([/* ... */]);
$promise = $client->updateGroupAsync([/* ... */]);

Updates the specified group with the specified attributes.

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

Learn more

Parameter Syntax

$result = $client->updateGroup([
    'Description' => '<string>',
    'GroupName' => '<string>', // REQUIRED
    'Precedence' => <integer>,
    'RoleArn' => '<string>',
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
Description
Type: string

A string containing the new description of the group.

GroupName
Required: Yes
Type: string

The name of the group.

Precedence
Type: int

The new precedence value for the group. For more information about this parameter, see CreateGroup.

RoleArn
Type: 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.

UserPoolId
Required: Yes
Type: string

The ID of the user pool.

Result Syntax

[
    'Group' => [
        'CreationDate' => <DateTime>,
        'Description' => '<string>',
        'GroupName' => '<string>',
        'LastModifiedDate' => <DateTime>,
        'Precedence' => <integer>,
        'RoleArn' => '<string>',
        'UserPoolId' => '<string>',
    ],
]

Result Details

Members
Group
Type: GroupType structure

The group object for the group.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

UpdateIdentityProvider

$result = $client->updateIdentityProvider([/* ... */]);
$promise = $client->updateIdentityProviderAsync([/* ... */]);

Updates IdP information for a user pool.

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

Learn more

Parameter Syntax

$result = $client->updateIdentityProvider([
    'AttributeMapping' => ['<string>', ...],
    'IdpIdentifiers' => ['<string>', ...],
    'ProviderDetails' => ['<string>', ...],
    'ProviderName' => '<string>', // REQUIRED
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
AttributeMapping
Type: Associative array of custom strings keys (AttributeMappingKeyType) to strings

The IdP attribute mapping to be changed.

IdpIdentifiers
Type: Array of strings

A list of IdP identifiers.

ProviderDetails
Type: Associative array of custom strings keys (StringType) to strings

The scopes, URLs, and identifiers for your external identity provider. The following examples describe the provider detail keys for each IdP type. These values and their schema are subject to change. Social IdP authorize_scopes values must match the values listed here.

OpenID Connect (OIDC)

Amazon Cognito accepts the following elements when it can't discover endpoint URLs from oidc_issuer: attributes_url, authorize_url, jwks_uri, token_url.

Create or update request: "ProviderDetails": { "attributes_request_method": "GET", "attributes_url": "https://auth.example.com/userInfo", "authorize_scopes": "openid profile email", "authorize_url": "https://auth.example.com/authorize", "client_id": "1example23456789", "client_secret": "provider-app-client-secret", "jwks_uri": "https://auth.example.com/.well-known/jwks.json", "oidc_issuer": "https://auth.example.com", "token_url": "https://example.com/token" }

Describe response: "ProviderDetails": { "attributes_request_method": "GET", "attributes_url": "https://auth.example.com/userInfo", "attributes_url_add_attributes": "false", "authorize_scopes": "openid profile email", "authorize_url": "https://auth.example.com/authorize", "client_id": "1example23456789", "client_secret": "provider-app-client-secret", "jwks_uri": "https://auth.example.com/.well-known/jwks.json", "oidc_issuer": "https://auth.example.com", "token_url": "https://example.com/token" }

SAML

Create or update request with Metadata URL: "ProviderDetails": { "IDPInit": "true", "IDPSignout": "true", "EncryptedResponses" : "true", "MetadataURL": "https://auth.example.com/sso/saml/metadata", "RequestSigningAlgorithm": "rsa-sha256" }

Create or update request with Metadata file: "ProviderDetails": { "IDPInit": "true", "IDPSignout": "true", "EncryptedResponses" : "true", "MetadataFile": "[metadata XML]", "RequestSigningAlgorithm": "rsa-sha256" }

The value of MetadataFile must be the plaintext metadata document with all quote (") characters escaped by backslashes.

Describe response: "ProviderDetails": { "IDPInit": "true", "IDPSignout": "true", "EncryptedResponses" : "true", "ActiveEncryptionCertificate": "[certificate]", "MetadataURL": "https://auth.example.com/sso/saml/metadata", "RequestSigningAlgorithm": "rsa-sha256", "SLORedirectBindingURI": "https://auth.example.com/slo/saml", "SSORedirectBindingURI": "https://auth.example.com/sso/saml" }

LoginWithAmazon

Create or update request: "ProviderDetails": { "authorize_scopes": "profile postal_code", "client_id": "amzn1.application-oa2-client.1example23456789", "client_secret": "provider-app-client-secret"

Describe response: "ProviderDetails": { "attributes_url": "https://api.amazon.com/user/profile", "attributes_url_add_attributes": "false", "authorize_scopes": "profile postal_code", "authorize_url": "https://www.amazon.com/ap/oa", "client_id": "amzn1.application-oa2-client.1example23456789", "client_secret": "provider-app-client-secret", "token_request_method": "POST", "token_url": "https://api.amazon.com/auth/o2/token" }

Google

Create or update request: "ProviderDetails": { "authorize_scopes": "email profile openid", "client_id": "1example23456789.apps.googleusercontent.com", "client_secret": "provider-app-client-secret" }

Describe response: "ProviderDetails": { "attributes_url": "https://people.googleapis.com/v1/people/me?personFields=", "attributes_url_add_attributes": "true", "authorize_scopes": "email profile openid", "authorize_url": "https://accounts.google.com/o/oauth2/v2/auth", "client_id": "1example23456789.apps.googleusercontent.com", "client_secret": "provider-app-client-secret", "oidc_issuer": "https://accounts.google.com", "token_request_method": "POST", "token_url": "https://www.googleapis.com/oauth2/v4/token" }

SignInWithApple

Create or update request: "ProviderDetails": { "authorize_scopes": "email name", "client_id": "com.example.cognito", "private_key": "1EXAMPLE", "key_id": "2EXAMPLE", "team_id": "3EXAMPLE" }

Describe response: "ProviderDetails": { "attributes_url_add_attributes": "false", "authorize_scopes": "email name", "authorize_url": "https://appleid.apple.com/auth/authorize", "client_id": "com.example.cognito", "key_id": "1EXAMPLE", "oidc_issuer": "https://appleid.apple.com", "team_id": "2EXAMPLE", "token_request_method": "POST", "token_url": "https://appleid.apple.com/auth/token" }

Facebook

Create or update request: "ProviderDetails": { "api_version": "v17.0", "authorize_scopes": "public_profile, email", "client_id": "1example23456789", "client_secret": "provider-app-client-secret" }

Describe response: "ProviderDetails": { "api_version": "v17.0", "attributes_url": "https://graph.facebook.com/v17.0/me?fields=", "attributes_url_add_attributes": "true", "authorize_scopes": "public_profile, email", "authorize_url": "https://www.facebook.com/v17.0/dialog/oauth", "client_id": "1example23456789", "client_secret": "provider-app-client-secret", "token_request_method": "GET", "token_url": "https://graph.facebook.com/v17.0/oauth/access_token" }

ProviderName
Required: Yes
Type: string

The IdP name.

UserPoolId
Required: Yes
Type: string

The user pool ID.

Result Syntax

[
    'IdentityProvider' => [
        'AttributeMapping' => ['<string>', ...],
        'CreationDate' => <DateTime>,
        'IdpIdentifiers' => ['<string>', ...],
        'LastModifiedDate' => <DateTime>,
        'ProviderDetails' => ['<string>', ...],
        'ProviderName' => '<string>',
        'ProviderType' => 'SAML|Facebook|Google|LoginWithAmazon|SignInWithApple|OIDC',
        'UserPoolId' => '<string>',
    ],
]

Result Details

Members
IdentityProvider
Required: Yes
Type: IdentityProviderType structure

The identity provider details.

Errors

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

UnsupportedIdentityProviderException:

This exception is thrown when the specified identifier isn't supported.

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

ConcurrentModificationException:

This exception is thrown if two or more modifications are happening concurrently.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

UpdateManagedLoginBranding

$result = $client->updateManagedLoginBranding([/* ... */]);
$promise = $client->updateManagedLoginBrandingAsync([/* ... */]);

Configures the branding settings for a user pool style. This operation is the programmatic option for the configuration of a style in the branding designer.

Provides values for UI customization in a Settings JSON object and image files in an Assets array.

This operation has a 2-megabyte request-size limit and include the CSS settings and image assets for your app client. Your branding settings might exceed 2MB in size. Amazon Cognito doesn't require that you pass all parameters in one request and preserves existing style settings that you don't specify. If your request is larger than 2MB, separate it into multiple requests, each with a size smaller than the limit.

As a best practice, modify the output of DescribeManagedLoginBrandingByClient into the request parameters for this operation. To get all settings, set ReturnMergedResources to true. For more information, see API and SDK operations for managed login branding

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

Learn more

Parameter Syntax

$result = $client->updateManagedLoginBranding([
    'Assets' => [
        [
            'Bytes' => <string || resource || Psr\Http\Message\StreamInterface>,
            'Category' => 'FAVICON_ICO|FAVICON_SVG|EMAIL_GRAPHIC|SMS_GRAPHIC|AUTH_APP_GRAPHIC|PASSWORD_GRAPHIC|PASSKEY_GRAPHIC|PAGE_HEADER_LOGO|PAGE_HEADER_BACKGROUND|PAGE_FOOTER_LOGO|PAGE_FOOTER_BACKGROUND|PAGE_BACKGROUND|FORM_BACKGROUND|FORM_LOGO|IDP_BUTTON_ICON', // REQUIRED
            'ColorMode' => 'LIGHT|DARK|DYNAMIC', // REQUIRED
            'Extension' => 'ICO|JPEG|PNG|SVG|WEBP', // REQUIRED
            'ResourceId' => '<string>',
        ],
        // ...
    ],
    'ManagedLoginBrandingId' => '<string>',
    'Settings' => [
    ],
    'UseCognitoProvidedValues' => true || false,
    'UserPoolId' => '<string>',
]);

Parameter Details

Members
Assets
Type: Array of AssetType structures

An array of image files that you want to apply to roles like backgrounds, logos, and icons. Each object must also indicate whether it is for dark mode, light mode, or browser-adaptive mode.

ManagedLoginBrandingId
Type: string

The ID of the managed login branding style that you want to update.

Settings
Type: document (null|bool|string|numeric) or an (array|associative array) whose members are all valid documents

A JSON file, encoded as a Document type, with the the settings that you want to apply to your style.

UseCognitoProvidedValues
Type: boolean

When true, applies the default branding style options. This option reverts to default style options that are managed by Amazon Cognito. You can modify them later in the branding designer.

When you specify true for this option, you must also omit values for Settings and Assets in the request.

UserPoolId
Type: string

The ID of the user pool that contains the managed login branding style that you want to update.

Result Syntax

[
    'ManagedLoginBranding' => [
        'Assets' => [
            [
                'Bytes' => <string || resource || Psr\Http\Message\StreamInterface>,
                'Category' => 'FAVICON_ICO|FAVICON_SVG|EMAIL_GRAPHIC|SMS_GRAPHIC|AUTH_APP_GRAPHIC|PASSWORD_GRAPHIC|PASSKEY_GRAPHIC|PAGE_HEADER_LOGO|PAGE_HEADER_BACKGROUND|PAGE_FOOTER_LOGO|PAGE_FOOTER_BACKGROUND|PAGE_BACKGROUND|FORM_BACKGROUND|FORM_LOGO|IDP_BUTTON_ICON',
                'ColorMode' => 'LIGHT|DARK|DYNAMIC',
                'Extension' => 'ICO|JPEG|PNG|SVG|WEBP',
                'ResourceId' => '<string>',
            ],
            // ...
        ],
        'CreationDate' => <DateTime>,
        'LastModifiedDate' => <DateTime>,
        'ManagedLoginBrandingId' => '<string>',
        'Settings' => [
        ],
        'UseCognitoProvidedValues' => true || false,
        'UserPoolId' => '<string>',
    ],
]

Result Details

Members
ManagedLoginBranding
Type: ManagedLoginBrandingType structure

The details of the branding style that you updated.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

ConcurrentModificationException:

This exception is thrown if two or more modifications are happening concurrently.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

UpdateResourceServer

$result = $client->updateResourceServer([/* ... */]);
$promise = $client->updateResourceServerAsync([/* ... */]);

Updates the name and scopes of resource server. All other fields are read-only.

If you don't provide a value for an attribute, it is set to the default value.

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

Learn more

Parameter Syntax

$result = $client->updateResourceServer([
    'Identifier' => '<string>', // REQUIRED
    'Name' => '<string>', // REQUIRED
    'Scopes' => [
        [
            'ScopeDescription' => '<string>', // REQUIRED
            'ScopeName' => '<string>', // REQUIRED
        ],
        // ...
    ],
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
Identifier
Required: Yes
Type: string

A unique resource server identifier for the resource server. The identifier can be an API friendly name like solar-system-data. You can also set an API URL like https://solar-system-data-api.example.com as your identifier.

Amazon Cognito represents scopes in the access token in the format $resource-server-identifier/$scope. Longer scope-identifier strings increase the size of your access tokens.

Name
Required: Yes
Type: string

The name of the resource server.

Scopes
Type: Array of ResourceServerScopeType structures

The scope values to be set for the resource server.

UserPoolId
Required: Yes
Type: string

The ID of the user pool.

Result Syntax

[
    'ResourceServer' => [
        'Identifier' => '<string>',
        'Name' => '<string>',
        'Scopes' => [
            [
                'ScopeDescription' => '<string>',
                'ScopeName' => '<string>',
            ],
            // ...
        ],
        'UserPoolId' => '<string>',
    ],
]

Result Details

Members
ResourceServer
Required: Yes
Type: ResourceServerType structure

The resource server.

Errors

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

UpdateUserAttributes

$result = $client->updateUserAttributes([/* ... */]);
$promise = $client->updateUserAttributesAsync([/* ... */]);

With this operation, your users can update one or more of their attributes with their own credentials. You authorize this API request with the user's access token. To delete an attribute from your user, submit the attribute in your API request with a blank value. Custom attribute values in this request must include the custom: prefix.

Authorize this action with a signed-in user's access token. It must include the scope aws.cognito.signin.user.admin.

Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.

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 Services 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.

Parameter Syntax

$result = $client->updateUserAttributes([
    'AccessToken' => '<string>', // REQUIRED
    'ClientMetadata' => ['<string>', ...],
    'UserAttributes' => [ // REQUIRED
        [
            'Name' => '<string>', // REQUIRED
            'Value' => '<string>',
        ],
        // ...
    ],
]);

Parameter Details

Members
AccessToken
Required: Yes
Type: string

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

ClientMetadata
Type: Associative array of custom strings keys (StringType) to strings

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.

When you use the ClientMetadata parameter, note 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 send sensitive information in this parameter.

UserAttributes
Required: Yes
Type: Array of AttributeType structures

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.

Result Syntax

[
    'CodeDeliveryDetailsList' => [
        [
            'AttributeName' => '<string>',
            'DeliveryMedium' => 'SMS|EMAIL',
            'Destination' => '<string>',
        ],
        // ...
    ],
]

Result Details

Members
CodeDeliveryDetailsList
Type: Array of CodeDeliveryDetailsType structures

The code delivery details list from the server for the request to update user attributes.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

CodeMismatchException:

This exception is thrown if the provided code doesn't match what the server was expecting.

ExpiredCodeException:

This exception is thrown if a code has expired.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

UnexpectedLambdaException:

This exception is thrown when Amazon Cognito encounters an unexpected exception with Lambda.

UserLambdaValidationException:

This exception is thrown when the Amazon Cognito service encounters a user validation exception with the Lambda service.

InvalidLambdaResponseException:

This exception is thrown when Amazon Cognito encounters an invalid Lambda response.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

AliasExistsException:

This exception is thrown when a user tries to confirm the account with an email address or phone number that has already been supplied as an alias for a different user profile. This exception indicates that an account with this email address or phone already exists in a user pool that you've configured to use email address or phone number as a sign-in alias.

InvalidSmsRoleAccessPolicyException:

This exception is returned when the role provided for SMS configuration doesn't have permission to publish using Amazon SNS.

InvalidSmsRoleTrustRelationshipException:

This exception is thrown when the trust relationship is not valid for the role provided for SMS configuration. This can happen if you don't trust cognito-idp.amazonaws.com or the external ID provided in the role does not match what is provided in the SMS configuration for the user pool.

InvalidEmailRoleAccessPolicyException:

This exception is thrown when Amazon Cognito isn't allowed to use your email identity. HTTP status code: 400.

CodeDeliveryFailureException:

This exception is thrown when a verification code fails to deliver successfully.

PasswordResetRequiredException:

This exception is thrown when a password reset is required.

UserNotFoundException:

This exception is thrown when a user isn't found.

UserNotConfirmedException:

This exception is thrown when a user isn't confirmed successfully.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

ForbiddenException:

This exception is thrown when WAF doesn't allow your request based on a web ACL that's associated with your user pool.

UpdateUserPool

$result = $client->updateUserPool([/* ... */]);
$promise = $client->updateUserPoolAsync([/* ... */]);

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 Services 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.

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, Amazon Cognito sets it to its default value.

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

Learn more

Parameter Syntax

$result = $client->updateUserPool([
    'AccountRecoverySetting' => [
        'RecoveryMechanisms' => [
            [
                'Name' => 'verified_email|verified_phone_number|admin_only', // REQUIRED
                'Priority' => <integer>, // REQUIRED
            ],
            // ...
        ],
    ],
    'AdminCreateUserConfig' => [
        'AllowAdminCreateUserOnly' => true || false,
        'InviteMessageTemplate' => [
            'EmailMessage' => '<string>',
            'EmailSubject' => '<string>',
            'SMSMessage' => '<string>',
        ],
        'UnusedAccountValidityDays' => <integer>,
    ],
    'AutoVerifiedAttributes' => ['<string>', ...],
    'DeletionProtection' => 'ACTIVE|INACTIVE',
    'DeviceConfiguration' => [
        'ChallengeRequiredOnNewDevice' => true || false,
        'DeviceOnlyRememberedOnUserPrompt' => true || false,
    ],
    'EmailConfiguration' => [
        'ConfigurationSet' => '<string>',
        'EmailSendingAccount' => 'COGNITO_DEFAULT|DEVELOPER',
        'From' => '<string>',
        'ReplyToEmailAddress' => '<string>',
        'SourceArn' => '<string>',
    ],
    'EmailVerificationMessage' => '<string>',
    'EmailVerificationSubject' => '<string>',
    'LambdaConfig' => [
        'CreateAuthChallenge' => '<string>',
        'CustomEmailSender' => [
            'LambdaArn' => '<string>', // REQUIRED
            'LambdaVersion' => 'V1_0', // REQUIRED
        ],
        'CustomMessage' => '<string>',
        'CustomSMSSender' => [
            'LambdaArn' => '<string>', // REQUIRED
            'LambdaVersion' => 'V1_0', // REQUIRED
        ],
        'DefineAuthChallenge' => '<string>',
        'KMSKeyID' => '<string>',
        'PostAuthentication' => '<string>',
        'PostConfirmation' => '<string>',
        'PreAuthentication' => '<string>',
        'PreSignUp' => '<string>',
        'PreTokenGeneration' => '<string>',
        'PreTokenGenerationConfig' => [
            'LambdaArn' => '<string>', // REQUIRED
            'LambdaVersion' => 'V1_0|V2_0', // REQUIRED
        ],
        'UserMigration' => '<string>',
        'VerifyAuthChallengeResponse' => '<string>',
    ],
    'MfaConfiguration' => 'OFF|ON|OPTIONAL',
    'Policies' => [
        'PasswordPolicy' => [
            'MinimumLength' => <integer>,
            'PasswordHistorySize' => <integer>,
            'RequireLowercase' => true || false,
            'RequireNumbers' => true || false,
            'RequireSymbols' => true || false,
            'RequireUppercase' => true || false,
            'TemporaryPasswordValidityDays' => <integer>,
        ],
        'SignInPolicy' => [
            'AllowedFirstAuthFactors' => ['<string>', ...],
        ],
    ],
    'PoolName' => '<string>',
    'SmsAuthenticationMessage' => '<string>',
    'SmsConfiguration' => [
        'ExternalId' => '<string>',
        'SnsCallerArn' => '<string>', // REQUIRED
        'SnsRegion' => '<string>',
    ],
    'SmsVerificationMessage' => '<string>',
    'UserAttributeUpdateSettings' => [
        'AttributesRequireVerificationBeforeUpdate' => ['<string>', ...],
    ],
    'UserPoolAddOns' => [
        'AdvancedSecurityAdditionalFlows' => [
            'CustomAuthMode' => 'AUDIT|ENFORCED',
        ],
        'AdvancedSecurityMode' => 'OFF|AUDIT|ENFORCED', // REQUIRED
    ],
    'UserPoolId' => '<string>', // REQUIRED
    'UserPoolTags' => ['<string>', ...],
    'UserPoolTier' => 'LITE|ESSENTIALS|PLUS',
    'VerificationMessageTemplate' => [
        'DefaultEmailOption' => 'CONFIRM_WITH_LINK|CONFIRM_WITH_CODE',
        'EmailMessage' => '<string>',
        'EmailMessageByLink' => '<string>',
        'EmailSubject' => '<string>',
        'EmailSubjectByLink' => '<string>',
        'SmsMessage' => '<string>',
    ],
]);

Parameter Details

Members
AccountRecoverySetting
Type: AccountRecoverySettingType structure

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.

AdminCreateUserConfig
Type: AdminCreateUserConfigType structure

The configuration for AdminCreateUser requests.

AutoVerifiedAttributes
Type: Array of strings

The attributes that are automatically verified when Amazon Cognito requests to update user pools.

DeletionProtection
Type: string

When active, DeletionProtection prevents accidental deletion of your user pool. Before you can delete a user pool that you have protected against deletion, you must deactivate this feature.

When you try to delete a protected user pool in a DeleteUserPool API request, Amazon Cognito returns an InvalidParameterException error. To delete a protected user pool, send a new DeleteUserPool request after you deactivate deletion protection in an UpdateUserPool API request.

DeviceConfiguration
Type: DeviceConfigurationType structure

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

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

EmailConfiguration
Type: EmailConfigurationType structure

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.

EmailVerificationMessage
Type: string

This parameter is no longer used. See VerificationMessageTemplateType.

EmailVerificationSubject
Type: string

This parameter is no longer used. See VerificationMessageTemplateType.

LambdaConfig
Type: LambdaConfigType structure

The Lambda configuration information from the request to update the user pool.

MfaConfiguration
Type: 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.

Policies
Type: UserPoolPolicyType structure

A container with the policies you want to update in a user pool.

PoolName
Type: string

The updated name of your user pool.

SmsAuthenticationMessage
Type: string

The contents of the SMS authentication message.

SmsConfiguration
Type: SmsConfigurationType structure

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.

SmsVerificationMessage
Type: string

This parameter is no longer used. See VerificationMessageTemplateType.

UserAttributeUpdateSettings

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.

UserPoolAddOns
Type: UserPoolAddOnsType structure

User pool add-ons. Contains settings for activation of advanced security features. To log user security information but take no action, set to AUDIT. To configure automatic security responses to risky traffic to your user pool, set to ENFORCED.

For more information, see Adding advanced security to a user pool.

UserPoolId
Required: Yes
Type: string

The ID of the user pool you want to update.

UserPoolTags
Type: Associative array of custom strings keys (TagKeysType) to strings

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.

UserPoolTier
Type: string

The user pool feature plan, or tier. This parameter determines the eligibility of the user pool for features like managed login, access-token customization, and threat protection. Defaults to ESSENTIALS.

VerificationMessageTemplate

The template for verification messages.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

ConcurrentModificationException:

This exception is thrown if two or more modifications are happening concurrently.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

UserImportInProgressException:

This exception is thrown when you're trying to modify a user pool while a user import job is in progress for that pool.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

InvalidSmsRoleAccessPolicyException:

This exception is returned when the role provided for SMS configuration doesn't have permission to publish using Amazon SNS.

InvalidSmsRoleTrustRelationshipException:

This exception is thrown when the trust relationship is not valid for the role provided for SMS configuration. This can happen if you don't trust cognito-idp.amazonaws.com or the external ID provided in the role does not match what is provided in the SMS configuration for the user pool.

UserPoolTaggingException:

This exception is thrown when a user pool tag can't be set or updated.

InvalidEmailRoleAccessPolicyException:

This exception is thrown when Amazon Cognito isn't allowed to use your email identity. HTTP status code: 400.

TierChangeNotAllowedException:

This exception is thrown when you've attempted to change your feature plan but the operation isn't permitted.

FeatureUnavailableInTierException:

This exception is thrown when a feature you attempted to configure isn't available in your current feature plan.

UpdateUserPoolClient

$result = $client->updateUserPoolClient([/* ... */]);
$promise = $client->updateUserPoolClientAsync([/* ... */]);

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.

If you don't provide a value for an attribute, Amazon Cognito sets it to its default value.

You can also use this operation to enable token revocation for user pool clients. For more information about revoking tokens, see RevokeToken.

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

Learn more

Parameter Syntax

$result = $client->updateUserPoolClient([
    'AccessTokenValidity' => <integer>,
    'AllowedOAuthFlows' => ['<string>', ...],
    'AllowedOAuthFlowsUserPoolClient' => true || false,
    'AllowedOAuthScopes' => ['<string>', ...],
    'AnalyticsConfiguration' => [
        'ApplicationArn' => '<string>',
        'ApplicationId' => '<string>',
        'ExternalId' => '<string>',
        'RoleArn' => '<string>',
        'UserDataShared' => true || false,
    ],
    'AuthSessionValidity' => <integer>,
    'CallbackURLs' => ['<string>', ...],
    'ClientId' => '<string>', // REQUIRED
    'ClientName' => '<string>',
    'DefaultRedirectURI' => '<string>',
    'EnablePropagateAdditionalUserContextData' => true || false,
    'EnableTokenRevocation' => true || false,
    'ExplicitAuthFlows' => ['<string>', ...],
    'IdTokenValidity' => <integer>,
    'LogoutURLs' => ['<string>', ...],
    'PreventUserExistenceErrors' => 'LEGACY|ENABLED',
    'ReadAttributes' => ['<string>', ...],
    'RefreshTokenValidity' => <integer>,
    'SupportedIdentityProviders' => ['<string>', ...],
    'TokenValidityUnits' => [
        'AccessToken' => 'seconds|minutes|hours|days',
        'IdToken' => 'seconds|minutes|hours|days',
        'RefreshToken' => 'seconds|minutes|hours|days',
    ],
    'UserPoolId' => '<string>', // REQUIRED
    'WriteAttributes' => ['<string>', ...],
]);

Parameter Details

Members
AccessTokenValidity
Type: int

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.

If you don't specify otherwise in the configuration of your app client, your access tokens are valid for one hour.

AllowedOAuthFlows
Type: Array of strings

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.

AllowedOAuthFlowsUserPoolClient
Type: boolean

Set to true to use OAuth 2.0 features in your user pool app client.

AllowedOAuthFlowsUserPoolClient must be true before you can configure the following features in your app client.

  • CallBackURLs: Callback URLs.

  • LogoutURLs: Sign-out redirect URLs.

  • AllowedOAuthScopes: OAuth 2.0 scopes.

  • AllowedOAuthFlows: Support for authorization code, implicit, and client credentials OAuth 2.0 grants.

To use OAuth 2.0 features, configure one of these features in the Amazon Cognito console or set AllowedOAuthFlowsUserPoolClient to true in a CreateUserPoolClient or UpdateUserPoolClient API request. If you don't set a value for AllowedOAuthFlowsUserPoolClient in a request with the CLI or SDKs, it defaults to false.

AllowedOAuthScopes
Type: Array of strings

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.

AnalyticsConfiguration
Type: AnalyticsConfigurationType structure

The Amazon Pinpoint analytics configuration necessary to collect metrics for this user pool.

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.

AuthSessionValidity
Type: int

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.

CallbackURLs
Type: Array of strings

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.

ClientId
Required: Yes
Type: string

The ID of the client associated with the user pool.

ClientName
Type: string

The client name from the update user pool client request.

DefaultRedirectURI
Type: 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.

EnablePropagateAdditionalUserContextData
Type: 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.

EnableTokenRevocation
Type: boolean

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

ExplicitAuthFlows
Type: Array of strings

The authentication flows that you want your user pool client to support. For each app client in your user pool, you can sign in your users with any combination of one or more flows, including with a user name and Secure Remote Password (SRP), a user name and password, or a custom authentication process that you define with Lambda functions.

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

Valid values include:

  • ALLOW_USER_AUTH: Enable selection-based sign-in with USER_AUTH. This setting covers username-password, secure remote password (SRP), passwordless, and passkey authentication. This authentiation flow can do username-password and SRP authentication without other ExplicitAuthFlows permitting them. For example users can complete an SRP challenge through USER_AUTH without the flow USER_SRP_AUTH being active for the app client. This flow doesn't include CUSTOM_AUTH.

  • 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, your app passes a user name and password to Amazon Cognito in the request, instead of using the Secure Remote Password (SRP) protocol to securely transmit the password.

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

In some environments, you will see the values ADMIN_NO_SRP_AUTH, CUSTOM_AUTH_FLOW_ONLY, or USER_PASSWORD_AUTH. You can't assign these legacy ExplicitAuthFlows values to user pool clients at the same time as values that begin with ALLOW_, like ALLOW_USER_SRP_AUTH.

IdTokenValidity
Type: int

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 IdTokenValidity in an API request is hours. Valid range is displayed below in seconds.

If you don't specify otherwise in the configuration of your app client, your ID tokens are valid for one hour.

LogoutURLs
Type: Array of strings

A list of allowed logout URLs for the IdPs.

PreventUserExistenceErrors
Type: 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.

Defaults to LEGACY when you don't provide a value.

ReadAttributes
Type: Array of strings

The list of user attributes that you want your app client to have read access to. After your user authenticates in your app, their access token authorizes them to read their own attribute value for any attribute in this list. An example of this kind of activity is when your user selects a link to view their profile information. Your app makes a GetUser API request to retrieve and display your user's profile data.

When you don't specify the ReadAttributes for your app client, your app can read the values of email_verified, phone_number_verified, and the Standard attributes of your user pool. When your user pool app client has read access to these default attributes, ReadAttributes doesn't return any information. Amazon Cognito only populates ReadAttributes in the API response if you have specified your own custom set of read attributes.

RefreshTokenValidity
Type: int

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.

If you don't specify otherwise in the configuration of your app client, your refresh tokens are valid for 30 days.

SupportedIdentityProviders
Type: Array of strings

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.

This setting applies to providers that you can access with managed login. The removal of COGNITO from this list doesn't prevent authentication operations for local users with the user pools API in an Amazon Web Services SDK. The only way to prevent API-based authentication is to block access with a WAF rule.

TokenValidityUnits
Type: TokenValidityUnitsType structure

The time units you use when you set the duration of ID, access, and refresh tokens. The default unit for RefreshToken is days, and the default for ID and access tokens is hours.

UserPoolId
Required: Yes
Type: string

The ID of the user pool where you want to update the user pool client.

WriteAttributes
Type: Array of strings

The list of user attributes that you want your app client to have write access to. After your user authenticates in your app, their access token authorizes them to set or modify their own attribute value for any attribute in this list. An example of this kind of activity is when you present your user with a form to update their profile information and they change their last name. Your app then makes an UpdateUserAttributes API request and sets family_name to the new value.

When you don't specify the WriteAttributes for your app client, your app can write the values of the Standard attributes of your user pool. When your user pool has write access to these default attributes, WriteAttributes doesn't return any information. Amazon Cognito only populates WriteAttributes in the API response if you have specified your own custom set of write attributes.

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.

Result Syntax

[
    'UserPoolClient' => [
        'AccessTokenValidity' => <integer>,
        'AllowedOAuthFlows' => ['<string>', ...],
        'AllowedOAuthFlowsUserPoolClient' => true || false,
        'AllowedOAuthScopes' => ['<string>', ...],
        'AnalyticsConfiguration' => [
            'ApplicationArn' => '<string>',
            'ApplicationId' => '<string>',
            'ExternalId' => '<string>',
            'RoleArn' => '<string>',
            'UserDataShared' => true || false,
        ],
        'AuthSessionValidity' => <integer>,
        'CallbackURLs' => ['<string>', ...],
        'ClientId' => '<string>',
        'ClientName' => '<string>',
        'ClientSecret' => '<string>',
        'CreationDate' => <DateTime>,
        'DefaultRedirectURI' => '<string>',
        'EnablePropagateAdditionalUserContextData' => true || false,
        'EnableTokenRevocation' => true || false,
        'ExplicitAuthFlows' => ['<string>', ...],
        'IdTokenValidity' => <integer>,
        'LastModifiedDate' => <DateTime>,
        'LogoutURLs' => ['<string>', ...],
        'PreventUserExistenceErrors' => 'LEGACY|ENABLED',
        'ReadAttributes' => ['<string>', ...],
        'RefreshTokenValidity' => <integer>,
        'SupportedIdentityProviders' => ['<string>', ...],
        'TokenValidityUnits' => [
            'AccessToken' => 'seconds|minutes|hours|days',
            'IdToken' => 'seconds|minutes|hours|days',
            'RefreshToken' => 'seconds|minutes|hours|days',
        ],
        'UserPoolId' => '<string>',
        'WriteAttributes' => ['<string>', ...],
    ],
]

Result Details

Members
UserPoolClient
Type: UserPoolClientType structure

The user pool client value from the response from the server when you request to update the user pool client.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

ConcurrentModificationException:

This exception is thrown if two or more modifications are happening concurrently.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

ScopeDoesNotExistException:

This exception is thrown when the specified scope doesn't exist.

InvalidOAuthFlowException:

This exception is thrown when the specified OAuth flow is not valid.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

UpdateUserPoolDomain

$result = $client->updateUserPoolDomain([/* ... */]);
$promise = $client->updateUserPoolDomainAsync([/* ... */]);

A user pool domain hosts managed login, an authorization server and web server for authentication in your application. This operation updates the branding version for user pool domains between 1 for hosted UI (classic) and 2 for managed login. It also updates the SSL certificate for user pool custom domains.

Changes to the domain branding version take up to one minute to take effect for a prefix domain and up to five minutes for a custom domain.

This operation doesn't change the name of your user pool domain. To change your domain, delete it with DeleteUserPoolDomain and create a new domain with CreateUserPoolDomain.

You can pass the ARN of a new Certificate Manager certificate in this request. Typically, ACM certificates automatically renew and you user pool can continue to use the same ARN. But if you generate a new certificate for your custom domain name, replace the original configuration with the new ARN in this request.

ACM certificates for custom domains must be in the US East (N. Virginia) 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 Configuring a user pool domain.

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

Learn more

Parameter Syntax

$result = $client->updateUserPoolDomain([
    'CustomDomainConfig' => [
        'CertificateArn' => '<string>', // REQUIRED
    ],
    'Domain' => '<string>', // REQUIRED
    'ManagedLoginVersion' => <integer>,
    'UserPoolId' => '<string>', // REQUIRED
]);

Parameter Details

Members
CustomDomainConfig
Type: CustomDomainConfigType structure

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.

When you create a custom domain, the passkey RP ID defaults to the custom domain. If you had a prefix domain active, this will cause passkey integration for your prefix domain to stop working due to a mismatch in RP ID. To keep the prefix domain passkey integration working, you can explicitly set RP ID to the prefix domain. Update the RP ID in a SetUserPoolMfaConfig request.

Domain
Required: Yes
Type: string

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.

ManagedLoginVersion
Type: int

A version number that indicates the state of managed login for your domain. Version 1 is hosted UI (classic). Version 2 is the newer managed login with the branding designer. For more information, see Managed login.

UserPoolId
Required: Yes
Type: string

The ID of the user pool that is associated with the custom domain whose certificate you're updating.

Result Syntax

[
    'CloudFrontDomain' => '<string>',
    'ManagedLoginVersion' => <integer>,
]

Result Details

Members
CloudFrontDomain
Type: string

The Amazon CloudFront endpoint that Amazon Cognito set up when you added the custom domain to your user pool.

ManagedLoginVersion
Type: int

A version number that indicates the state of managed login for your domain. Version 1 is hosted UI (classic). Version 2 is the newer managed login with the branding designer. For more information, see Managed login.

Errors

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

FeatureUnavailableInTierException:

This exception is thrown when a feature you attempted to configure isn't available in your current feature plan.

VerifySoftwareToken

$result = $client->verifySoftwareToken([/* ... */]);
$promise = $client->verifySoftwareTokenAsync([/* ... */]);

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.

Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.

Parameter Syntax

$result = $client->verifySoftwareToken([
    'AccessToken' => '<string>',
    'FriendlyDeviceName' => '<string>',
    'Session' => '<string>',
    'UserCode' => '<string>', // REQUIRED
]);

Parameter Details

Members
AccessToken
Type: string

A valid access token that Amazon Cognito issued to the user whose software token you want to verify.

FriendlyDeviceName
Type: string

The friendly device name.

Session
Type: string

The session that should be passed both ways in challenge-response calls to the service.

UserCode
Required: Yes
Type: string

The one- time password computed using the secret code returned by AssociateSoftwareToken.

Result Syntax

[
    'Session' => '<string>',
    'Status' => 'SUCCESS|ERROR',
]

Result Details

Members
Session
Type: string

The session that should be passed both ways in challenge-response calls to the service.

Status
Type: string

The status of the verify software token.

Errors

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidUserPoolConfigurationException:

This exception is thrown when the user pool configuration is not valid.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

PasswordResetRequiredException:

This exception is thrown when a password reset is required.

UserNotFoundException:

This exception is thrown when a user isn't found.

UserNotConfirmedException:

This exception is thrown when a user isn't confirmed successfully.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

EnableSoftwareTokenMFAException:

This exception is thrown when there is a code mismatch and the service fails to configure the software token TOTP multi-factor authentication (MFA).

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

SoftwareTokenMFANotFoundException:

This exception is thrown when the software token time-based one-time password (TOTP) multi-factor authentication (MFA) isn't activated for the user pool.

CodeMismatchException:

This exception is thrown if the provided code doesn't match what the server was expecting.

ForbiddenException:

This exception is thrown when WAF doesn't allow your request based on a web ACL that's associated with your user pool.

VerifyUserAttribute

$result = $client->verifyUserAttribute([/* ... */]);
$promise = $client->verifyUserAttributeAsync([/* ... */]);

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.

Authorize this action with a signed-in user's access token. It must include the scope aws.cognito.signin.user.admin.

Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.

Parameter Syntax

$result = $client->verifyUserAttribute([
    'AccessToken' => '<string>', // REQUIRED
    'AttributeName' => '<string>', // REQUIRED
    'Code' => '<string>', // REQUIRED
]);

Parameter Details

Members
AccessToken
Required: Yes
Type: string

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

AttributeName
Required: Yes
Type: string

The attribute name in the request to verify user attributes.

Code
Required: Yes
Type: string

The verification code in the request to verify user attributes.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceNotFoundException:

This exception is thrown when the Amazon Cognito service can't find the requested resource.

InvalidParameterException:

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

CodeMismatchException:

This exception is thrown if the provided code doesn't match what the server was expecting.

ExpiredCodeException:

This exception is thrown if a code has expired.

NotAuthorizedException:

This exception is thrown when a user isn't authorized.

TooManyRequestsException:

This exception is thrown when the user has made too many requests for a given operation.

LimitExceededException:

This exception is thrown when a user exceeds the limit for a requested Amazon Web Services resource.

PasswordResetRequiredException:

This exception is thrown when a password reset is required.

UserNotFoundException:

This exception is thrown when a user isn't found.

UserNotConfirmedException:

This exception is thrown when a user isn't confirmed successfully.

InternalErrorException:

This exception is thrown when Amazon Cognito encounters an internal error.

AliasExistsException:

This exception is thrown when a user tries to confirm the account with an email address or phone number that has already been supplied as an alias for a different user profile. This exception indicates that an account with this email address or phone already exists in a user pool that you've configured to use email address or phone number as a sign-in alias.

ForbiddenException:

This exception is thrown when WAF doesn't allow your request based on a web ACL that's associated with your user pool.

Shapes

AccountRecoverySettingType

Description

The settings for user message delivery in forgot-password operations. Contains preference for email or SMS message delivery of password reset codes, or for admin-only password reset.

This data type is a request and response parameter of CreateUserPool and UpdateUserPool, and a response parameter of DescribeUserPool.

Members
RecoveryMechanisms
Type: Array of RecoveryOptionType structures

The list of options and priorities for user message delivery in forgot-password operations. Sets or displays user pool preferences for email or SMS message priority, whether users should fall back to a second delivery method, and whether passwords should only be reset by administrators.

AccountTakeoverActionType

Description

The automated response to a risk level for adaptive authentication in full-function, or ENFORCED, mode. You can assign an action to each risk level that advanced security features evaluates.

This data type is a request parameter of SetRiskConfiguration and a response parameter of DescribeRiskConfiguration.

Members
EventAction
Required: Yes
Type: string

The action to take for the attempted account takeover action for the associated risk level. Valid values are as follows:

  • BLOCK: Block the request.

  • MFA_IF_CONFIGURED: Present an MFA challenge if possible. MFA is possible if the user pool has active MFA methods that the user can set up. For example, if the user pool only supports SMS message MFA but the user doesn't have a phone number attribute, MFA setup isn't possible. If MFA setup isn't possible, allow the request.

  • MFA_REQUIRED: Present an MFA challenge if possible. Block the request if a user hasn't set up MFA. To sign in with required MFA, users must have an email address or phone number attribute, or a registered TOTP factor.

  • NO_ACTION: Take no action. Permit sign-in.

Notify
Required: Yes
Type: boolean

Determines whether Amazon Cognito sends a user a notification message when your user pools assesses a user's session at the associated risk level.

AccountTakeoverActionsType

Description

A list of account-takeover actions for each level of risk that Amazon Cognito might assess with advanced security features.

This data type is a request parameter of SetRiskConfiguration and a response parameter of DescribeRiskConfiguration.

Members
HighAction
Type: AccountTakeoverActionType structure

The action that you assign to a high-risk assessment by advanced security features.

LowAction
Type: AccountTakeoverActionType structure

The action that you assign to a low-risk assessment by advanced security features.

MediumAction
Type: AccountTakeoverActionType structure

The action that you assign to a medium-risk assessment by advanced security features.

AccountTakeoverRiskConfigurationType

Description

The settings for automated responses and notification templates for adaptive authentication with advanced security features.

This data type is a request parameter of SetRiskConfiguration and a response parameter of DescribeRiskConfiguration.

Members
Actions
Required: Yes
Type: AccountTakeoverActionsType structure

A list of account-takeover actions for each level of risk that Amazon Cognito might assess with advanced security features.

NotifyConfiguration
Type: NotifyConfigurationType structure

The settings for composing and sending an email message when advanced security features assesses a risk level with adaptive authentication. When you choose to notify users in AccountTakeoverRiskConfiguration, Amazon Cognito sends an email message using the method and template that you set with this data type.

AdminCreateUserConfigType

Description

The settings for administrator creation of users in a user pool. Contains settings for allowing user sign-up, customizing invitation messages to new users, and the amount of time before temporary passwords expire.

This data type is a request and response parameter of CreateUserPool and UpdateUserPool, and a response parameter of DescribeUserPool.

Members
AllowAdminCreateUserOnly
Type: boolean

The setting for allowing self-service sign-up. When true, only administrators can create new user profiles. When false, users can register themselves and create a new user profile with the SignUp operation.

InviteMessageTemplate
Type: MessageTemplateType structure

The template for the welcome message to new users. This template must include the {####} temporary password placeholder if you are creating users with passwords. If your users don't have passwords, you can omit the placeholder.

See also Customizing User Invitation Messages.

UnusedAccountValidityDays
Type: int

This parameter is no longer in use. Configure the duration of temporary passwords with the TemporaryPasswordValidityDays parameter of PasswordPolicyType. For older user pools that have a UnusedAccountValidityDays configuration, that value is effective until you set a value for TemporaryPasswordValidityDays.

The password expiration limit in days for administrator-created users. When this time expires, the user can't sign in with their temporary password. 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.

AdvancedSecurityAdditionalFlowsType

Description

Advanced security configuration options for additional authentication types in your user pool, including custom authentication.

Members
CustomAuthMode
Type: string

The operating mode of advanced security features in custom authentication with Custom authentication challenge Lambda triggers.

AliasExistsException

Description

This exception is thrown when a user tries to confirm the account with an email address or phone number that has already been supplied as an alias for a different user profile. This exception indicates that an account with this email address or phone already exists in a user pool that you've configured to use email address or phone number as a sign-in alias.

Members
message
Type: string

The message that Amazon Cognito sends to the user when the value of an alias attribute is already linked to another user profile.

AnalyticsConfigurationType

Description

The settings for Amazon Pinpoint analytics configuration. With an analytics configuration, your application can collect user-activity metrics for user notifications with a Amazon Pinpoint campaign.

Amazon Pinpoint isn't available in all Amazon Web Services Regions. For a list of available Regions, see Amazon Cognito and Amazon Pinpoint Region availability.

This data type is a request parameter of CreateUserPoolClient and UpdateUserPoolClient, and a response parameter of DescribeUserPoolClient.

Members
ApplicationArn
Type: string

The Amazon Resource Name (ARN) of an Amazon Pinpoint project that you want to connect to your user pool app client. Amazon Cognito publishes events to the Amazon Pinpoint project that ApplicationArn declares. You can also configure your application to pass an endpoint ID in the AnalyticsMetadata parameter of sign-in operations. The endpoint ID is information about the destination for push notifications

ApplicationId
Type: string

Your Amazon Pinpoint project ID.

ExternalId
Type: string

The external ID of the role that Amazon Cognito assumes to send analytics data to Amazon Pinpoint.

RoleArn
Type: string

The ARN of an Identity and Access Management role that has the permissions required for Amazon Cognito to publish events to Amazon Pinpoint analytics.

UserDataShared
Type: boolean

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

AnalyticsMetadataType

Description

Information that your application adds to authentication requests. Applies an endpoint ID to the analytics data that your user pool sends to Amazon Pinpoint.

An endpoint ID uniquely identifies a mobile device, email address or phone number that can receive messages from Amazon Pinpoint analytics. For more information about Amazon Web Services Regions that can contain Amazon Pinpoint resources for use with Amazon Cognito user pools, see Using Amazon Pinpoint analytics with Amazon Cognito user pools.

This data type is a request parameter of authentication operations like InitiateAuth, AdminInitiateAuth, RespondToAuthChallenge, and AdminRespondToAuthChallenge.

Members
AnalyticsEndpointId
Type: string

The endpoint ID. Information that you want to pass to Amazon Pinpoint about where to send notifications.

AssetType

Description

An image file from a managed login branding style in a user pool.

This data type is a request parameter of CreateManagedLoginBranding and UpdateManagedLoginBranding, and a response parameter of DescribeManagedLoginBranding.

Members
Bytes
Type: blob (string|resource|Psr\Http\Message\StreamInterface)

The image file, in Base64-encoded binary.

Category
Required: Yes
Type: string

The category that the image corresponds to in your managed login configuration. Managed login has asset categories for different types of logos, backgrounds, and icons.

ColorMode
Required: Yes
Type: string

The display-mode target of the asset: light, dark, or browser-adaptive. For example, Amazon Cognito displays a dark-mode image only when the browser or application is in dark mode, but displays a browser-adaptive file in all contexts.

Extension
Required: Yes
Type: string

The file type of the image file.

ResourceId
Type: string

The ID of the asset.

AttributeType

Description

The name and value of a user attribute.

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

Members
Name
Required: Yes
Type: string

The name of the attribute.

Value
Type: string

The value of the attribute.

AuthEventType

Description

One authentication event that Amazon Cognito logged in a user pool with advanced security features active. Contains user and device metadata and a risk assessment from your user pool.

This data type is a request parameter of AdminListUserAuthEvents.

Members
ChallengeResponses
Type: Array of ChallengeResponseType structures

A list of the challenges that the user was requested to answer, for example Password, and the result, for example Success.

CreationDate
Type: timestamp (string|DateTime or anything parsable by strtotime)

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

EventContextData
Type: EventContextDataType structure

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.

EventFeedback
Type: EventFeedbackType structure

The UpdateAuthEventFeedback or AdminUpdateAuthEventFeedback feedback that you or your user provided in response to the event. A value of Valid indicates that you disagreed with the level of risk that your user pool assigned, and evaluated a session to be valid, or likely safe. A value of Invalid indicates that you agreed with the user pool risk level and evaluated a session to be invalid, or likely malicious.

EventId
Type: string

The event ID.

EventResponse
Type: string

The event response.

EventRisk
Type: EventRiskType structure

The threat evaluation from your user pool about an event. Contains information about whether your user pool detected compromised credentials, whether the event triggered an automated response, and the level of risk.

EventType
Type: string

The type of authentication event.

AuthenticationResultType

Description

The object that your application receives after authentication. Contains tokens and information for device authentication.

This data type is a response parameter of authentication operations like InitiateAuth, AdminInitiateAuth, RespondToAuthChallenge, and AdminRespondToAuthChallenge.

Members
AccessToken
Type: string

Your user's access token.

ExpiresIn
Type: int

The expiration period of the authentication result in seconds.

IdToken
Type: string

Your user's ID token.

NewDeviceMetadata
Type: NewDeviceMetadataType structure

The new device metadata from an authentication result.

RefreshToken
Type: string

Your user's refresh token.

TokenType
Type: string

The intended use of the token, for example Bearer.

ChallengeResponseType

Description

The responses to the challenge that you received in the previous request. Each challenge has its own required response parameters. The following examples are partial JSON request bodies that highlight challenge-response parameters.

You must provide a SECRET_HASH parameter in all challenge responses to an app client that has a client secret. Include a DEVICE_KEY for device authentication.

SELECT_CHALLENGE

"ChallengeName": "SELECT_CHALLENGE", "ChallengeResponses": { "USERNAME": "[username]", "ANSWER": "[Challenge name]"}

Available challenges are PASSWORD, PASSWORD_SRP, EMAIL_OTP, SMS_OTP, and WEB_AUTHN.

Complete authentication in the SELECT_CHALLENGE response for PASSWORD, PASSWORD_SRP, and WEB_AUTHN:

  • "ChallengeName": "SELECT_CHALLENGE", "ChallengeResponses": { "ANSWER": "WEB_AUTHN", "USERNAME": "[username]", "CREDENTIAL": "[AuthenticationResponseJSON]"}

    See AuthenticationResponseJSON.

  • "ChallengeName": "SELECT_CHALLENGE", "ChallengeResponses": { "ANSWER": "PASSWORD", "USERNAME": "[username]", "PASSWORD": "[password]"}

  • "ChallengeName": "SELECT_CHALLENGE", "ChallengeResponses": { "ANSWER": "PASSWORD_SRP", "USERNAME": "[username]", "SRP_A": "[SRP_A]"}

For SMS_OTP and EMAIL_OTP, respond with the username and answer. Your user pool will send a code for the user to submit in the next challenge response.

  • "ChallengeName": "SELECT_CHALLENGE", "ChallengeResponses": { "ANSWER": "SMS_OTP", "USERNAME": "[username]"}

  • "ChallengeName": "SELECT_CHALLENGE", "ChallengeResponses": { "ANSWER": "EMAIL_OTP", "USERNAME": "[username]"}

SMS_OTP

"ChallengeName": "SMS_OTP", "ChallengeResponses": {"SMS_OTP_CODE": "[code]", "USERNAME": "[username]"}

EMAIL_OTP

"ChallengeName": "EMAIL_OTP", "ChallengeResponses": {"EMAIL_OTP_CODE": "[code]", "USERNAME": "[username]"}

SMS_MFA

"ChallengeName": "SMS_MFA", "ChallengeResponses": {"SMS_MFA_CODE": "[code]", "USERNAME": "[username]"}

PASSWORD_VERIFIER

This challenge response is part of the SRP flow. Amazon Cognito requires that your application respond to this challenge within a few seconds. When the response time exceeds this period, your user pool returns a NotAuthorizedException error.

"ChallengeName": "PASSWORD_VERIFIER", "ChallengeResponses": {"PASSWORD_CLAIM_SIGNATURE": "[claim_signature]", "PASSWORD_CLAIM_SECRET_BLOCK": "[secret_block]", "TIMESTAMP": [timestamp], "USERNAME": "[username]"}

Add "DEVICE_KEY" when you sign in with a remembered device.

CUSTOM_CHALLENGE

"ChallengeName": "CUSTOM_CHALLENGE", "ChallengeResponses": {"USERNAME": "[username]", "ANSWER": "[challenge_answer]"}

Add "DEVICE_KEY" when you sign in with a remembered device.

NEW_PASSWORD_REQUIRED

"ChallengeName": "NEW_PASSWORD_REQUIRED", "ChallengeResponses": {"NEW_PASSWORD": "[new_password]", "USERNAME": "[username]"}

To set any required attributes that InitiateAuth returned in an requiredAttributes parameter, add "userAttributes.[attribute_name]": "[attribute_value]". This parameter can also set values for writable attributes that aren't required by your user pool.

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

"ChallengeName": "SOFTWARE_TOKEN_MFA", "ChallengeResponses": {"USERNAME": "[username]", "SOFTWARE_TOKEN_MFA_CODE": [authenticator_code]}

DEVICE_SRP_AUTH

"ChallengeName": "DEVICE_SRP_AUTH", "ChallengeResponses": {"USERNAME": "[username]", "DEVICE_KEY": "[device_key]", "SRP_A": "[srp_a]"}

DEVICE_PASSWORD_VERIFIER

"ChallengeName": "DEVICE_PASSWORD_VERIFIER", "ChallengeResponses": {"DEVICE_KEY": "[device_key]", "PASSWORD_CLAIM_SIGNATURE": "[claim_signature]", "PASSWORD_CLAIM_SECRET_BLOCK": "[secret_block]", "TIMESTAMP": [timestamp], "USERNAME": "[username]"}

MFA_SETUP

"ChallengeName": "MFA_SETUP", "ChallengeResponses": {"USERNAME": "[username]"}, "SESSION": "[Session ID from VerifySoftwareToken]"

SELECT_MFA_TYPE

"ChallengeName": "SELECT_MFA_TYPE", "ChallengeResponses": {"USERNAME": "[username]", "ANSWER": "[SMS_MFA or SOFTWARE_TOKEN_MFA]"}

For more information about SECRET_HASH, see Computing secret hash values. For information about DEVICE_KEY, see Working with user devices in your user pool.

This data type is a request parameter of RespondToAuthChallenge and AdminRespondToAuthChallenge.

Members
ChallengeName
Type: string

The type of challenge that your previous authentication request returned in the parameter ChallengeName, for example SMS_MFA.

ChallengeResponse
Type: string

The set of key-value pairs that provides a response to the requested challenge.

CloudWatchLogsConfigurationType

Description

Configuration for the CloudWatch log group destination of user pool detailed activity logging, or of user activity log export with advanced security features.

This data type is a request parameter of SetLogDeliveryConfiguration and a response parameter of GetLogDeliveryConfiguration.

Members
LogGroupArn
Type: string

The Amazon Resource Name (arn) of a CloudWatch Logs log group where your user pool sends logs. The log group must not be encrypted with Key Management Service and must be in the same Amazon Web Services account as your user pool.

To send logs to log groups with a resource policy of a size greater than 5120 characters, configure a log group with a path that starts with /aws/vendedlogs. For more information, see Enabling logging from certain Amazon Web Services services.

CodeDeliveryDetailsType

Description

The delivery details for an email or SMS message that Amazon Cognito sent for authentication or verification.

This data type is a response parameter of operations that send a code for user profile confirmation, verification, or management, for example ForgotPassword and SignUp.

Members
AttributeName
Type: string

The name of the attribute that Amazon Cognito verifies with the code.

DeliveryMedium
Type: string

The method that Amazon Cognito used to send the code.

Destination
Type: string

The email address or phone number destination where Amazon Cognito sent the code.

CodeDeliveryFailureException

Description

This exception is thrown when a verification code fails to deliver successfully.

Members
message
Type: string

The message sent when a verification code fails to deliver successfully.

CodeMismatchException

Description

This exception is thrown if the provided code doesn't match what the server was expecting.

Members
message
Type: string

The message provided when the code mismatch exception is thrown.

CompromisedCredentialsActionsType

Description

Settings for user pool actions when Amazon Cognito detects compromised credentials with advanced security features in full-function ENFORCED mode.

This data type is a request parameter of SetRiskConfiguration and a response parameter of DescribeRiskConfiguration.

Members
EventAction
Required: Yes
Type: string

The action that Amazon Cognito takes when it detects compromised credentials.

CompromisedCredentialsRiskConfigurationType

Description

Settings for compromised-credentials actions and authentication-event sources with advanced security features in full-function ENFORCED mode.

This data type is a request parameter of SetRiskConfiguration and a response parameter of DescribeRiskConfiguration.

Members
Actions
Required: Yes
Type: CompromisedCredentialsActionsType structure

Settings for the actions that you want your user pool to take when Amazon Cognito detects compromised credentials.

EventFilter
Type: Array of strings

Settings for the sign-in activity where you want to configure compromised-credentials actions. Defaults to all events.

ConcurrentModificationException

Description

This exception is thrown if two or more modifications are happening concurrently.

Members
message
Type: string

The message provided when the concurrent exception is thrown.

ContextDataType

Description

Contextual user data used for evaluating the risk of an authentication event by user pool threat protection.

This data type is a request parameter of server-side authentication operations like AdminInitiateAuth and AdminRespondToAuthChallenge.

Members
EncodedData
Type: 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.

HttpHeaders
Required: Yes
Type: Array of HttpHeader structures

The HTTP headers from your user's authentication request.

IpAddress
Required: Yes
Type: string

The source IP address of your user's device.

ServerName
Required: Yes
Type: string

The name of your application's service endpoint.

ServerPath
Required: Yes
Type: string

The path of your application's service endpoint.

CustomDomainConfigType

Description

The configuration for a hosted UI custom domain.

This data type is a request parameter of CreateUserPoolDomain and UpdateUserPoolDomain.

Members
CertificateArn
Required: Yes
Type: string

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

CustomEmailLambdaVersionConfigType

Description

The properties of a custom email sender Lambda trigger.

This data type is a request and response parameter of CreateUserPool and UpdateUserPool, and a response parameter of DescribeUserPool.

Members
LambdaArn
Required: Yes
Type: string

The Amazon Resource Name (ARN) of the function that you want to assign to your Lambda trigger.

LambdaVersion
Required: Yes
Type: string

The user pool trigger version of the request that Amazon Cognito sends to your Lambda function. Higher-numbered versions add fields that support new features.

You must use a LambdaVersion of V1_0 with a custom sender function.

CustomSMSLambdaVersionConfigType

Description

The properties of a custom SMS sender Lambda trigger.

This data type is a request and response parameter of CreateUserPool and UpdateUserPool, and a response parameter of DescribeUserPool.

Members
LambdaArn
Required: Yes
Type: string

The Amazon Resource Name (ARN) of the function that you want to assign to your Lambda trigger.

LambdaVersion
Required: Yes
Type: string

The user pool trigger version of the request that Amazon Cognito sends to your Lambda function. Higher-numbered versions add fields that support new features.

You must use a LambdaVersion of V1_0 with a custom sender function.

DeviceConfigurationType

Description

The device-remembering configuration for a user pool. A DescribeUserPool request returns a null value for this object when the user pool isn't configured to remember devices. When device remembering is active, you can remember a user's device with a ConfirmDevice API request. Additionally. when the property DeviceOnlyRememberedOnUserPrompt is true, you must follow ConfirmDevice with an UpdateDeviceStatus API request that sets the user's device to remembered or not_remembered.

To sign in with a remembered device, include DEVICE_KEY in the authentication parameters in your user's InitiateAuth request. If your app doesn't include a DEVICE_KEY parameter, the response from Amazon Cognito includes newly-generated DEVICE_KEY and DEVICE_GROUP_KEY values under NewDeviceMetadata. Store these values to use in future device-authentication requests.

When you provide a value for any property of DeviceConfiguration, you activate the device remembering for the user pool.

This data type is a request and response parameter of CreateUserPool and UpdateUserPool, and a response parameter of DescribeUserPool.

Members
ChallengeRequiredOnNewDevice
Type: 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).

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
Type: 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.

DeviceSecretVerifierConfigType

Description

A Secure Remote Password (SRP) value that your application generates when you register a user's device. For more information, see Getting a device key.

This data type is a request parameter of ConfirmDevice.

Members
PasswordVerifier
Type: string

A password verifier for a user's device. Used in SRP authentication.

Salt
Type: string

The salt that you want to use in SRP authentication with the user's device.

DeviceType

Description

Information about a user's device that they've registered for device SRP authentication in your application. For more information, see Working with user devices in your user pool.

The data type is a response parameter of AdminGetDevice, AdminListDevices, and GetDevice.

Members
DeviceAttributes
Type: Array of AttributeType structures

Metadata about a user's device, like name and last-access source IP.

DeviceCreateDate
Type: timestamp (string|DateTime or anything parsable by strtotime)

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

DeviceKey
Type: string

The device key, for example us-west-2_EXAMPLE-a1b2c3d4-5678-90ab-cdef-EXAMPLE22222.

DeviceLastAuthenticatedDate
Type: timestamp (string|DateTime or anything parsable by strtotime)

The date when the user last signed in with the device.

DeviceLastModifiedDate
Type: timestamp (string|DateTime or anything parsable by strtotime)

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

Document

Members

DomainDescriptionType

Description

A container for information about the user pool domain associated with the hosted UI and OAuth endpoints.

This data type is a response parameter of DescribeUserPoolDomain.

Members
AWSAccountId
Type: string

The Amazon Web Services account that you created the user pool in.

CloudFrontDistribution
Type: string

The Amazon CloudFront endpoint that hosts your custom domain.

CustomDomainConfig
Type: CustomDomainConfigType structure

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

Domain
Type: 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.

ManagedLoginVersion
Type: int

The version of managed login branding that you want to apply to your domain. A value of 1 indicates hosted UI (classic) branding and a version of 2 indicates managed login branding.

Managed login requires that your user pool be configured for any feature plan other than Lite.

S3Bucket
Type: string

The Amazon S3 bucket where the static files for this domain are stored.

Status
Type: string

The domain status.

UserPoolId
Type: string

The ID of the user pool that the domain is attached to.

Version
Type: string

The app version.

DuplicateProviderException

Description

This exception is thrown when the provider is already supported by the user pool.

Members
message
Type: string

EmailConfigurationType

Description

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.

Amazon Cognito can send email messages with Amazon Simple Email Service resources in the Amazon Web Services Region where you created your user pool, and in alternate Regions in some cases. For more information on the supported Regions, see Email settings for Amazon Cognito user pools.

This data type is a request parameter of CreateUserPool, UpdateUserPool, and SetUserPoolMfaConfig, and a response parameter of CreateUserPool, UpdateUserPool, and GetUserPoolMfaConfig.

Members
ConfigurationSet
Type: 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.

EmailSendingAccount
Type: 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 the Amazon Cognito 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 you to access Amazon SES and send email messages from your email 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
Type: 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.

ReplyToEmailAddress
Type: string

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

SourceArn
Type: string

The ARN of a verified email address or an address from a verified domain in Amazon SES. You can set a SourceArn email from a verified domain only with an API request. You can set a verified email address, but not an address in a verified domain, in the Amazon Cognito console. Amazon Cognito uses the email address that you provide 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.

EmailMfaConfigType

Description

Sets or shows user pool email message configuration for MFA. Includes the subject and body of the email message template for MFA messages. To activate this setting, advanced security features must be active in your user pool.

This data type is a request parameter of SetUserPoolMfaConfig and a response parameter of GetUserPoolMfaConfig.

Members
Message
Type: string

The template for the email message that your user pool sends to users with a code for MFA and sign-in with an email OTP. The message must contain the {####} placeholder. In the message, Amazon Cognito replaces this placeholder with the code. If you don't provide this parameter, Amazon Cognito sends messages in the default format.

Subject
Type: string

The subject of the email message that your user pool sends to users with a code for MFA and email OTP sign-in.

EmailMfaSettingsType

Description

User preferences for multi-factor authentication with email messages. Activates or deactivates email MFA and sets it as the preferred MFA method when multiple methods are available. To activate this setting, advanced security features must be active in your user pool.

This data type is a request parameter of SetUserMFAPreference and AdminSetUserMFAPreference.

Members
Enabled
Type: boolean

Specifies whether email message MFA is active for a user. When the value of this parameter is Enabled, 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
Type: boolean

Specifies whether email message MFA is the user's preferred method.

EnableSoftwareTokenMFAException

Description

This exception is thrown when there is a code mismatch and the service fails to configure the software token TOTP multi-factor authentication (MFA).

Members
message
Type: string

EventContextDataType

Description

The context data that your application submitted in an authentication request with advanced security features, as displayed in an AdminListUserAuthEvents response.

Members
City
Type: string

The user's city.

Country
Type: string

The user's country.

DeviceName
Type: string

The user's device name.

IpAddress
Type: string

The source IP address of your user's device.

Timezone
Type: string

The user's time zone.

EventFeedbackType

Description

The feedback that your application submitted to an advanced security features event log, as displayed in an AdminListUserAuthEvents response.

Members
FeedbackDate
Type: timestamp (string|DateTime or anything parsable by strtotime)

The date that you or your user submitted the feedback.

FeedbackValue
Required: Yes
Type: string

The authentication event feedback value. When you provide a FeedbackValue value of valid, you tell Amazon Cognito that you trust a user session where Amazon Cognito has evaluated some level of risk. When you provide a FeedbackValue value of invalid, you tell Amazon Cognito that you don't trust a user session, or you don't believe that Amazon Cognito evaluated a high-enough risk level.

Provider
Required: Yes
Type: string

The submitter of the event feedback. For example, if you submit event feedback in the Amazon Cognito console, this value is Admin.

EventRiskType

Description

The risk evaluation by adaptive authentication, as displayed in an AdminListUserAuthEvents response. Contains evaluations of compromised-credentials detection and assessed risk level and action taken by adaptive authentication.

Members
CompromisedCredentialsDetected
Type: boolean

Indicates whether compromised credentials were detected during an authentication event.

RiskDecision
Type: string

The action taken by adaptive authentication. If NoRisk, your user pool took no action. If AccountTakeover, your user pool applied the adaptive authentication automated response that you configured. If Block, your user pool prevented the attempt.

RiskLevel
Type: string

The risk level that adaptive authentication assessed for the authentication event.

ExpiredCodeException

Description

This exception is thrown if a code has expired.

Members
message
Type: string

The message returned when the expired code exception is thrown.

FeatureUnavailableInTierException

Description

This exception is thrown when a feature you attempted to configure isn't available in your current feature plan.

Members
message
Type: string

FirehoseConfigurationType

Description

Configuration for the Amazon Data Firehose stream destination of user activity log export with advanced security features.

Members
StreamArn
Type: string

The ARN of an Amazon Data Firehose stream that's the destination for advanced security features log export.

ForbiddenException

Description

This exception is thrown when WAF doesn't allow your request based on a web ACL that's associated with your user pool.

Members
message
Type: string

The message returned when WAF doesn't allow your request based on a web ACL that's associated with your user pool.

GroupExistsException

Description

This exception is thrown when Amazon Cognito encounters a group that already exists in the user pool.

Members
message
Type: string

GroupType

Description

A user pool group. Contains details about the group and the way that it contributes to IAM role decisions with identity pools. Identity pools can make decisions about the IAM role to assign based on groups: users get credentials for the role associated with their highest-priority group.

This data type is a response parameter of AdminListGroupsForUser, CreateGroup, GetGroup, ListGroups, and UpdateGroup.

Members
CreationDate
Type: timestamp (string|DateTime or anything parsable by strtotime)

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

Description
Type: string

A friendly description of the group.

GroupName
Type: string

The name of the group.

LastModifiedDate
Type: timestamp (string|DateTime or anything parsable by strtotime)

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

Precedence
Type: int

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.

RoleArn
Type: string

The ARN of the IAM role associated with the group. If a group has the highest priority of a user's groups, users who authenticate with an identity pool get credentials for the RoleArn that's associated with the group.

UserPoolId
Type: string

The ID of the user pool that contains the group.

HttpHeader

Description

The HTTP header in the ContextData parameter.

This data type is a request parameter of server-side authentication operations like AdminInitiateAuth and AdminRespondToAuthChallenge.

Members
headerName
Type: string

The header name.

headerValue
Type: string

The header value.

IdentityProviderType

Description

A user pool identity provider (IdP). Contains information about a third-party IdP to a user pool, the attributes that it populates to user profiles, and the trust relationship between the IdP and your user pool.

This data type is a response parameter of CreateIdentityProvider, DescribeIdentityProvider, GetIdentityProviderByIdentifier, and UpdateIdentityProvider.

Members
AttributeMapping
Type: Associative array of custom strings keys (AttributeMappingKeyType) to strings

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

CreationDate
Type: timestamp (string|DateTime or anything parsable by strtotime)

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

IdpIdentifiers
Type: Array of strings

A list of IdP identifiers. IdP identifiers are strings that represent friendly names or domain names of IdPs, for example MyIdP or auth.example.com. You can choose to route user authorization requests to the right IdP with either IdP identifiers or IdP names. For more information, see identity_provider and idp_identifier at Authorize endpoint.

LastModifiedDate
Type: timestamp (string|DateTime or anything parsable by strtotime)

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

ProviderDetails
Type: Associative array of custom strings keys (StringType) to strings

The scopes, URLs, and identifiers for your external identity provider. The following examples describe the provider detail keys for each IdP type. These values and their schema are subject to change. Social IdP authorize_scopes values must match the values listed here.

OpenID Connect (OIDC)

Amazon Cognito accepts the following elements when it can't discover endpoint URLs from oidc_issuer: attributes_url, authorize_url, jwks_uri, token_url.

Create or update request: "ProviderDetails": { "attributes_request_method": "GET", "attributes_url": "https://auth.example.com/userInfo", "authorize_scopes": "openid profile email", "authorize_url": "https://auth.example.com/authorize", "client_id": "1example23456789", "client_secret": "provider-app-client-secret", "jwks_uri": "https://auth.example.com/.well-known/jwks.json", "oidc_issuer": "https://auth.example.com", "token_url": "https://example.com/token" }

Describe response: "ProviderDetails": { "attributes_request_method": "GET", "attributes_url": "https://auth.example.com/userInfo", "attributes_url_add_attributes": "false", "authorize_scopes": "openid profile email", "authorize_url": "https://auth.example.com/authorize", "client_id": "1example23456789", "client_secret": "provider-app-client-secret", "jwks_uri": "https://auth.example.com/.well-known/jwks.json", "oidc_issuer": "https://auth.example.com", "token_url": "https://example.com/token" }

SAML

Create or update request with Metadata URL: "ProviderDetails": { "IDPInit": "true", "IDPSignout": "true", "EncryptedResponses" : "true", "MetadataURL": "https://auth.example.com/sso/saml/metadata", "RequestSigningAlgorithm": "rsa-sha256" }

Create or update request with Metadata file: "ProviderDetails": { "IDPInit": "true", "IDPSignout": "true", "EncryptedResponses" : "true", "MetadataFile": "[metadata XML]", "RequestSigningAlgorithm": "rsa-sha256" }

The value of MetadataFile must be the plaintext metadata document with all quote (") characters escaped by backslashes.

Describe response: "ProviderDetails": { "IDPInit": "true", "IDPSignout": "true", "EncryptedResponses" : "true", "ActiveEncryptionCertificate": "[certificate]", "MetadataURL": "https://auth.example.com/sso/saml/metadata", "RequestSigningAlgorithm": "rsa-sha256", "SLORedirectBindingURI": "https://auth.example.com/slo/saml", "SSORedirectBindingURI": "https://auth.example.com/sso/saml" }

LoginWithAmazon

Create or update request: "ProviderDetails": { "authorize_scopes": "profile postal_code", "client_id": "amzn1.application-oa2-client.1example23456789", "client_secret": "provider-app-client-secret"

Describe response: "ProviderDetails": { "attributes_url": "https://api.amazon.com/user/profile", "attributes_url_add_attributes": "false", "authorize_scopes": "profile postal_code", "authorize_url": "https://www.amazon.com/ap/oa", "client_id": "amzn1.application-oa2-client.1example23456789", "client_secret": "provider-app-client-secret", "token_request_method": "POST", "token_url": "https://api.amazon.com/auth/o2/token" }

Google

Create or update request: "ProviderDetails": { "authorize_scopes": "email profile openid", "client_id": "1example23456789.apps.googleusercontent.com", "client_secret": "provider-app-client-secret" }

Describe response: "ProviderDetails": { "attributes_url": "https://people.googleapis.com/v1/people/me?personFields=", "attributes_url_add_attributes": "true", "authorize_scopes": "email profile openid", "authorize_url": "https://accounts.google.com/o/oauth2/v2/auth", "client_id": "1example23456789.apps.googleusercontent.com", "client_secret": "provider-app-client-secret", "oidc_issuer": "https://accounts.google.com", "token_request_method": "POST", "token_url": "https://www.googleapis.com/oauth2/v4/token" }

SignInWithApple

Create or update request: "ProviderDetails": { "authorize_scopes": "email name", "client_id": "com.example.cognito", "private_key": "1EXAMPLE", "key_id": "2EXAMPLE", "team_id": "3EXAMPLE" }

Describe response: "ProviderDetails": { "attributes_url_add_attributes": "false", "authorize_scopes": "email name", "authorize_url": "https://appleid.apple.com/auth/authorize", "client_id": "com.example.cognito", "key_id": "1EXAMPLE", "oidc_issuer": "https://appleid.apple.com", "team_id": "2EXAMPLE", "token_request_method": "POST", "token_url": "https://appleid.apple.com/auth/token" }

Facebook

Create or update request: "ProviderDetails": { "api_version": "v17.0", "authorize_scopes": "public_profile, email", "client_id": "1example23456789", "client_secret": "provider-app-client-secret" }

Describe response: "ProviderDetails": { "api_version": "v17.0", "attributes_url": "https://graph.facebook.com/v17.0/me?fields=", "attributes_url_add_attributes": "true", "authorize_scopes": "public_profile, email", "authorize_url": "https://www.facebook.com/v17.0/dialog/oauth", "client_id": "1example23456789", "client_secret": "provider-app-client-secret", "token_request_method": "GET", "token_url": "https://graph.facebook.com/v17.0/oauth/access_token" }

ProviderName
Type: string

A friendly name for the IdP.

ProviderType
Type: string

The type of IdP. Either SAML, OIDC, or a named social identity provider.

UserPoolId
Type: string

The ID of the user pool associated with the IdP.

InternalErrorException

Description

This exception is thrown when Amazon Cognito encounters an internal error.

Members
message
Type: string

The message returned when Amazon Cognito throws an internal error exception.

InvalidEmailRoleAccessPolicyException

Description

This exception is thrown when Amazon Cognito isn't allowed to use your email identity. HTTP status code: 400.

Members
message
Type: string

The message returned when you have an unverified email address or the identity policy isn't set on an email address that Amazon Cognito can access.

InvalidLambdaResponseException

Description

This exception is thrown when Amazon Cognito encounters an invalid Lambda response.

Members
message
Type: string

The message returned when Amazon Cognito throws an invalid Lambda response exception.

InvalidOAuthFlowException

Description

This exception is thrown when the specified OAuth flow is not valid.

Members
message
Type: string

InvalidParameterException

Description

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

Members
message
Type: string

The message returned when the Amazon Cognito service throws an invalid parameter exception.

reasonCode
Type: string

The reason code of the exception.

InvalidPasswordException

Description

This exception is thrown when Amazon Cognito encounters an invalid password.

Members
message
Type: string

The message returned when Amazon Cognito throws an invalid user password exception.

InvalidSmsRoleAccessPolicyException

Description

This exception is returned when the role provided for SMS configuration doesn't have permission to publish using Amazon SNS.

Members
message
Type: string

The message returned when the invalid SMS role access policy exception is thrown.

InvalidSmsRoleTrustRelationshipException

Description

This exception is thrown when the trust relationship is not valid for the role provided for SMS configuration. This can happen if you don't trust cognito-idp.amazonaws.com or the external ID provided in the role does not match what is provided in the SMS configuration for the user pool.

Members
message
Type: string

The message returned when the role trust relationship for the SMS message is not valid.

InvalidUserPoolConfigurationException

Description

This exception is thrown when the user pool configuration is not valid.

Members
message
Type: string

The message returned when the user pool configuration is not valid.

LambdaConfigType

Description

A collection of user pool Lambda triggers. Amazon Cognito invokes triggers at several possible stages of user pool operations. Triggers can modify the outcome of the operations that invoked them.

This data type is a request and response parameter of CreateUserPool and UpdateUserPool, and a response parameter of DescribeUserPool.

Members
CreateAuthChallenge
Type: string

The configuration of a create auth challenge Lambda trigger, one of three triggers in the sequence of the custom authentication challenge triggers.

CustomEmailSender

The configuration of a custom email sender Lambda trigger. This trigger routes all email notifications from a user pool to a Lambda function that delivers the message using custom logic.

CustomMessage
Type: string

A custom message Lambda trigger. This trigger is an opportunity to customize all SMS and email messages from your user pool. When a custom message trigger is active, your user pool routes all messages to a Lambda function that returns a runtime-customized message subject and body for your user pool to deliver to a user.

CustomSMSSender

The configuration of a custom SMS sender Lambda trigger. This trigger routes all SMS notifications from a user pool to a Lambda function that delivers the message using custom logic.

DefineAuthChallenge
Type: string

The configuration of a define auth challenge Lambda trigger, one of three triggers in the sequence of the custom authentication challenge triggers.

KMSKeyID
Type: string

The ARN of an KMS key. Amazon Cognito uses the key to encrypt codes and temporary passwords sent to custom sender Lambda triggers.

PostAuthentication
Type: string

The configuration of a post authentication Lambda trigger in a user pool. This trigger can take custom actions after a user signs in.

PostConfirmation
Type: string

The configuration of a post confirmation Lambda trigger in a user pool. This trigger can take custom actions after a user confirms their user account and their email address or phone number.

PreAuthentication
Type: string

The configuration of a pre authentication trigger in a user pool. This trigger can evaluate and modify user sign-in events.

PreSignUp
Type: string

The configuration of a pre sign-up Lambda trigger in a user pool. This trigger evaluates new users and can bypass confirmation, link a federated user profile, or block sign-up requests.

PreTokenGeneration
Type: string

The legacy configuration of a pre token generation Lambda trigger in a user pool.

Set this parameter for legacy purposes. If you also set an ARN in PreTokenGenerationConfig, its value must be identical to PreTokenGeneration. For new instances of pre token generation triggers, set the LambdaArn of PreTokenGenerationConfig.

PreTokenGenerationConfig

The detailed configuration of a pre token generation Lambda trigger in a user pool. If you also set an ARN in PreTokenGeneration, its value must be identical to PreTokenGenerationConfig.

UserMigration
Type: string

The configuration of a migrate user Lambda trigger in a user pool. This trigger can create user profiles when users sign in or attempt to reset their password with credentials that don't exist yet.

VerifyAuthChallengeResponse
Type: string

The configuration of a verify auth challenge Lambda trigger, one of three triggers in the sequence of the custom authentication challenge triggers.

LimitExceededException

Description

This exception is thrown when a user exceeds the limit for a requested Amazon Web Services resource.

Members
message
Type: string

The message returned when Amazon Cognito throws a limit exceeded exception.

LogConfigurationType

Description

The configuration of user event logs to an external Amazon Web Services service like Amazon Data Firehose, Amazon S3, or Amazon CloudWatch Logs.

This data type is a request parameter of SetLogDeliveryConfiguration and a response parameter of GetLogDeliveryConfiguration.

Members
CloudWatchLogsConfiguration

The CloudWatch log group destination of user pool detailed activity logs, or of user activity log export with advanced security features.

EventSource
Required: Yes
Type: string

The source of events that your user pool sends for logging. To send error-level logs about user notification activity, set to userNotification. To send info-level logs about advanced security features user activity, set to userAuthEvents.

FirehoseConfiguration
Type: FirehoseConfigurationType structure

The Amazon Data Firehose stream destination of user activity log export with advanced security features. To activate this setting, advanced security features must be active in your user pool.

LogLevel
Required: Yes
Type: string

The errorlevel selection of logs that a user pool sends for detailed activity logging. To send userNotification activity with information about message delivery, choose ERROR with CloudWatchLogsConfiguration. To send userAuthEvents activity with user logs from advanced security features, choose INFO with one of CloudWatchLogsConfiguration, FirehoseConfiguration, or S3Configuration.

S3Configuration
Type: S3ConfigurationType structure

The Amazon S3 bucket destination of user activity log export with advanced security features. To activate this setting, advanced security features must be active in your user pool.

LogDeliveryConfigurationType

Description

The logging parameters of a user pool, as returned in the response to a GetLogDeliveryConfiguration request.

Members
LogConfigurations
Required: Yes
Type: Array of LogConfigurationType structures

A logging destination of a user pool. User pools can have multiple logging destinations for message-delivery and user-activity logs.

UserPoolId
Required: Yes
Type: string

The ID of the user pool where you configured logging.

MFAMethodNotFoundException

Description

This exception is thrown when Amazon Cognito can't find a multi-factor authentication (MFA) method.

Members
message
Type: string

The message returned when Amazon Cognito throws an MFA method not found exception.

MFAOptionType

Description

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.

Members
AttributeName
Type: string

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

DeliveryMedium
Type: string

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

ManagedLoginBrandingExistsException

Description

This exception is thrown when you attempt to apply a managed login branding style to an app client that already has an assigned style.

Members
message
Type: string

ManagedLoginBrandingType

Description

A managed login branding style that's assigned to a user pool app client.

This data type is a response parameter of CreateManagedLoginBranding, UpdateManagedLoginBranding, DescribeManagedLoginBranding, and DescribeManagedLoginBrandingByClient.

Members
Assets
Type: Array of AssetType structures

An array of image files that you want to apply to roles like backgrounds, logos, and icons. Each object must also indicate whether it is for dark mode, light mode, or browser-adaptive mode.

CreationDate
Type: timestamp (string|DateTime or anything parsable by strtotime)

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

LastModifiedDate
Type: timestamp (string|DateTime or anything parsable by strtotime)

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

ManagedLoginBrandingId
Type: string

The ID of the managed login branding style.

Settings
Type: document (null|bool|string|numeric) or an (array|associative array) whose members are all valid documents

A JSON file, encoded as a Document type, with the the settings that you want to apply to your style.

UseCognitoProvidedValues
Type: boolean

When true, applies the default branding style options. This option reverts to default style options that are managed by Amazon Cognito. You can modify them later in the branding designer.

When you specify true for this option, you must also omit values for Settings and Assets in the request.

UserPoolId
Type: string

The user pool where the branding style is assigned.

MessageTemplateType

Description

The message template structure.

Members
EmailMessage
Type: string

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

EmailSubject
Type: string

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

SMSMessage
Type: string

The message template for SMS messages.

NewDeviceMetadataType

Description

Information that your user pool responds with in AuthenticationResultwhen you configure it to remember devices and a user signs in with an unrecognized device. Amazon Cognito presents a new device key that you can use to set up device authentication in a "Remember me on this device" authentication model.

This data type is a response parameter of authentication operations like InitiateAuth, AdminInitiateAuth, RespondToAuthChallenge, and AdminRespondToAuthChallenge.

Members
DeviceGroupKey
Type: string

The device group key, an identifier used in generating the DEVICE_PASSWORD_VERIFIER for device SRP authentication.

DeviceKey
Type: string

The device key, an identifier used in generating the DEVICE_PASSWORD_VERIFIER for device SRP authentication.

NotAuthorizedException

Description

This exception is thrown when a user isn't authorized.

Members
message
Type: string

The message returned when the Amazon Cognito service returns a not authorized exception.

NotifyConfigurationType

Description

The configuration for Amazon SES email messages that advanced security features sends to a user when your adaptive authentication automated response has a Notify action.

This data type is a request parameter of SetRiskConfiguration and a response parameter of DescribeRiskConfiguration.

Members
BlockEmail
Type: NotifyEmailType structure

The template for the email message that your user pool sends when a detected risk event is blocked.

From
Type: string

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

MfaEmail
Type: NotifyEmailType structure

The template for the email message that your user pool sends when MFA is challenged in response to a detected risk.

NoActionEmail
Type: NotifyEmailType structure

The template for the email message that your user pool sends when no action is taken in response to a detected risk.

ReplyTo
Type: string

The reply-to email address of an email template.

SourceArn
Required: Yes
Type: 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.

NotifyEmailType

Description

The template for email messages that advanced security features sends to a user when your threat protection automated response has a Notify action.

This data type is a request parameter of SetRiskConfiguration and a response parameter of DescribeRiskConfiguration.

Members
HtmlBody
Type: string

The body of an email notification formatted in HTML. Choose an HtmlBody or a TextBody to send an HTML-formatted or plaintext message, respectively.

Subject
Required: Yes
Type: string

The subject of the threat protection email notification.

TextBody
Type: string

The body of an email notification formatted in plaintext. Choose an HtmlBody or a TextBody to send an HTML-formatted or plaintext message, respectively.

NumberAttributeConstraintsType

Description

The minimum and maximum values of an attribute that is of the number type, for example custom:age.

This data type is part of SchemaAttributeType. It defines the length constraints on number-type attributes that you configure in CreateUserPool and UpdateUserPool, and displays the length constraints of all number-type attributes in the response to DescribeUserPool

Members
MaxValue
Type: string

The maximum length of a number attribute value. Must be a number less than or equal to 2^1023, represented as a string with a length of 131072 characters or fewer.

MinValue
Type: string

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

PasswordHistoryPolicyViolationException

Description

The message returned when a user's new password matches a previous password and doesn't comply with the password-history policy.

Members
message
Type: string

PasswordPolicyType

Description

The password policy settings for a user pool, including complexity, history, and length requirements.

This data type is a request and response parameter of CreateUserPool and UpdateUserPool, and a response parameter of DescribeUserPool.

Members
MinimumLength
Type: int

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

PasswordHistorySize
Type: int

The number of previous passwords that you want Amazon Cognito to restrict each user from reusing. Users can't set a password that matches any of n previous passwords, where n is the value of PasswordHistorySize.

Password history isn't enforced and isn't displayed in DescribeUserPool responses when you set this value to 0 or don't provide it. To activate this setting, advanced security features must be active in your user pool.

RequireLowercase
Type: boolean

The requirement in a password policy that users must include at least one lowercase letter in their password.

RequireNumbers
Type: boolean

The requirement in a password policy that users must include at least one number in their password.

RequireSymbols
Type: boolean

The requirement in a password policy that users must include at least one symbol in their password.

RequireUppercase
Type: boolean

The requirement in a password policy that users must include at least one uppercase letter in their password.

TemporaryPasswordValidityDays
Type: int

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. Defaults to 7. If you submit a value of 0, Amazon Cognito treats it as a null value and sets TemporaryPasswordValidityDays to its default value.

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

PasswordResetRequiredException

Description

This exception is thrown when a password reset is required.

Members
message
Type: string

The message returned when a password reset is required.

PreTokenGenerationVersionConfigType

Description

The properties of a pre token generation Lambda trigger.

This data type is a request and response parameter of CreateUserPool and UpdateUserPool, and a response parameter of DescribeUserPool.

Members
LambdaArn
Required: Yes
Type: string

The Amazon Resource Name (ARN) of the function that you want to assign to your Lambda trigger.

This parameter and the PreTokenGeneration property of LambdaConfig have the same value. For new instances of pre token generation triggers, set LambdaArn.

LambdaVersion
Required: Yes
Type: string

The user pool trigger version of the request that Amazon Cognito sends to your Lambda function. Higher-numbered versions add fields that support new features.

PreconditionNotMetException

Description

This exception is thrown when a precondition is not met.

Members
message
Type: string

The message returned when a precondition is not met.

ProviderDescription

Description

The details of a user pool identity provider (IdP), including name and type.

This data type is a response parameter of ListIdentityProviders.

Members
CreationDate
Type: timestamp (string|DateTime or anything parsable by strtotime)

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

LastModifiedDate
Type: timestamp (string|DateTime or anything parsable by strtotime)

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

ProviderName
Type: string

The name of the IdP, for example MySAMLProvider.

ProviderType
Type: string

The type of the provider, for example SAML. Amazon Cognito supports SAML 2.0, OIDC, and social IdPs. User pools list supported social IdPs by name in this response parameter: Facebook, Google, Login with Amazon, and Sign in with Apple.

ProviderUserIdentifierType

Description

The characteristics of a source or destination user for linking a federated user profile to a local user profile.

This data type is a request parameter of AdminLinkProviderForUser and AdminDisableProviderForUser.

Members
ProviderAttributeName
Type: string

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

ProviderAttributeValue
Type: string

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

ProviderName
Type: string

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

RecoveryOptionType

Description

A recovery option for a user. The AccountRecoverySettingType data type is an array of this object. Each RecoveryOptionType has a priority property that determines whether it is a primary or secondary option.

For example, if verified_email has a priority of 1 and verified_phone_number has a priority of 2, your user pool sends account-recovery messages to a verified email address but falls back to an SMS message if the user has a verified phone number. The admin_only option prevents self-service account recovery.

This data type is a request and response parameter of CreateUserPool and UpdateUserPool, and a response parameter of DescribeUserPool.

Members
Name
Required: Yes
Type: string

The recovery method that this object sets a recovery option for.

Priority
Required: Yes
Type: int

Your priority preference for using the specified attribute in account recovery. The highest priority is 1.

ResourceNotFoundException

Description

This exception is thrown when the Amazon Cognito service can't find the requested resource.

Members
message
Type: string

The message returned when the Amazon Cognito service returns a resource not found exception.

ResourceServerScopeType

Description

One custom scope associated with a user pool resource server. This data type is a member of ResourceServerScopeType. For more information, see Scopes, M2M, and API authorization with resource servers.

This data type is a request parameter of CreateResourceServer and a response parameter of DescribeResourceServer.

Members
ScopeDescription
Required: Yes
Type: string

A friendly description of a custom scope.

ScopeName
Required: Yes
Type: string

The name of the scope. Amazon Cognito renders custom scopes in the format resourceServerIdentifier/ScopeName. For example, if this parameter is exampleScope in the resource server with the identifier exampleResourceServer, you request and receive the scope exampleResourceServer/exampleScope.

ResourceServerType

Description

The details of a resource server configuration and associated custom scopes in a user pool.

This data type is a request parameter of CreateResourceServer and a response parameter of DescribeResourceServer.

Members
Identifier
Type: string

A unique resource server identifier for the resource server. The identifier can be an API friendly name like solar-system-data. You can also set an API URL like https://solar-system-data-api.example.com as your identifier.

Amazon Cognito represents scopes in the access token in the format $resource-server-identifier/$scope. Longer scope-identifier strings increase the size of your access tokens.

Name
Type: string

The name of the resource server.

Scopes
Type: Array of ResourceServerScopeType structures

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

UserPoolId
Type: string

The ID of the user pool that contains the resource server configuration.

RiskConfigurationType

Description

The settings of risk configuration for threat protection with advanced security features in a user pool.

This data type is a response parameter of DescribeRiskConfiguration and SetRiskConfiguration.

Members
AccountTakeoverRiskConfiguration

The settings for automated responses and notification templates for adaptive authentication with advanced security features.

ClientId
Type: string

The app client where this configuration is applied. When this parameter isn't present, the risk configuration applies to all user pool app clients that don't have client-level settings.

CompromisedCredentialsRiskConfiguration

Settings for compromised-credentials actions and authentication types with advanced security features in full-function ENFORCED mode.

LastModifiedDate
Type: timestamp (string|DateTime or anything parsable by strtotime)

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

RiskExceptionConfiguration

Exceptions to the risk evaluation configuration, including always-allow and always-block IP address ranges.

UserPoolId
Type: string

The ID of the user pool that has the risk configuration applied.

RiskExceptionConfigurationType

Description

Exceptions to the risk evaluation configuration, including always-allow and always-block IP address ranges.

This data type is a request parameter of SetRiskConfiguration and a response parameter of DescribeRiskConfiguration.

Members
BlockedIPRangeList
Type: Array of strings

An always-block IP address list. Overrides the risk decision and always blocks authentication requests. This parameter is displayed and set in CIDR notation.

SkippedIPRangeList
Type: Array of strings

An always-allow IP address list. Risk detection isn't performed on the IP addresses in this range list. This parameter is displayed and set in CIDR notation.

S3ConfigurationType

Description

Configuration for the Amazon S3 bucket destination of user activity log export with advanced security features.

Members
BucketArn
Type: string

The ARN of an Amazon S3 bucket that's the destination for advanced security features log export.

SMSMfaSettingsType

Description

A user's preference for using SMS message multi-factor authentication (MFA). Turns SMS MFA on and off, and can set SMS as preferred when other MFA options are available. You can't turn off SMS MFA for any of your users when MFA is required in your user pool; you can only set the type that your user prefers.

This data type is a request parameter of SetUserMFAPreference and AdminSetUserMFAPreference.

Members
Enabled
Type: boolean

Specifies whether SMS 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
Type: boolean

Specifies whether SMS is the preferred MFA method. If true, your user pool prompts the specified user for a code delivered by SMS message after username-password sign-in succeeds.

SchemaAttributeType

Description

A list of the user attributes and their properties in your user pool. The attribute schema contains standard attributes, custom attributes with a custom: prefix, and developer attributes with a dev: prefix. For more information, see User pool attributes.

Developer-only dev: attributes are a legacy feature of user pools, and are read-only to all app clients. You can create and update developer-only attributes only with IAM-authenticated API operations. Use app client read/write permissions instead.

This data type is a request and response parameter of CreateUserPool and UpdateUserPool, and a response parameter of DescribeUserPool.

Members
AttributeDataType
Type: string

The data format of the values for your attribute. When you choose an AttributeDataType, Amazon Cognito validates the input against the data type. A custom attribute value in your user's ID token is always a string, for example "custom:isMember" : "true" or "custom:YearsAsMember" : "12".

DeveloperOnlyAttribute
Type: boolean

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
Type: boolean

Specifies whether the value of the attribute can be changed.

Any user pool attribute whose value you map from an IdP attribute must be mutable, with a parameter value of 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.

Name
Type: string

The name of your user pool attribute. When you create or update a user pool, adding a schema attribute creates a custom or developer-only attribute. When you add an attribute with a Name value of MyAttribute, Amazon Cognito creates the custom attribute custom:MyAttribute. When DeveloperOnlyAttribute is true, Amazon Cognito creates your attribute as dev:MyAttribute. In an operation that describes a user pool, Amazon Cognito returns this value as value for standard attributes, custom:value for custom attributes, and dev:value for developer-only attributes..

NumberAttributeConstraints

Specifies the constraints for an attribute of the number type.

Required
Type: 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.

StringAttributeConstraints

Specifies the constraints for an attribute of the string type.

ScopeDoesNotExistException

Description

This exception is thrown when the specified scope doesn't exist.

Members
message
Type: string

SignInPolicyType

Description

The policy for allowed types of authentication in a user pool.

This data type is a request and response parameter of CreateUserPool and UpdateUserPool, and a response parameter of DescribeUserPool.

Members
AllowedFirstAuthFactors
Type: Array of strings

The sign-in methods that a user pool supports as the first factor. You can permit users to start authentication with a standard username and password, or with other one-time password and hardware factors.

SmsConfigurationType

Description

User pool configuration for delivery of SMS messages with 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.

This data type is a request parameter of CreateUserPool, UpdateUserPool, and SetUserPoolMfaConfig, and a response parameter of CreateUserPool, UpdateUserPool, and GetUserPoolMfaConfig.

Members
ExternalId
Type: 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.

SnsCallerArn
Required: Yes
Type: 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.

SnsRegion
Type: 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.

SmsMfaConfigType

Description

The configuration of multi-factor authentication (MFA) with SMS messages in a user pool.

This data type is a request parameter of SetUserPoolMfaConfig and a response parameter of GetUserPoolMfaConfig.

Members
SmsAuthenticationMessage
Type: string

The SMS authentication message that will be sent to users with the code they must sign in with. The message must contain the {####} placeholder. Your user pool replaces the placeholder with the MFA code. If this parameter isn't provided, your user pool sends a default message.

SmsConfiguration
Type: SmsConfigurationType structure

User pool configuration for delivery of SMS messages with 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.

You can set SmsConfiguration in CreateUserPool and UpdateUserPool, or in SetUserPoolMfaConfig.

SoftwareTokenMFANotFoundException

Description

This exception is thrown when the software token time-based one-time password (TOTP) multi-factor authentication (MFA) isn't activated for the user pool.

Members
message
Type: string

SoftwareTokenMfaConfigType

Description

Settings for time-based one-time password (TOTP) multi-factor authentication (MFA) in a user pool. Enables and disables availability of this feature.

This data type is a request parameter of SetUserPoolMfaConfig and a response parameter of GetUserPoolMfaConfig.

Members
Enabled
Type: boolean

The activation state of TOTP MFA.

SoftwareTokenMfaSettingsType

Description

A user's preference for using time-based one-time password (TOTP) multi-factor authentication (MFA). Turns TOTP MFA on and off, and can set TOTP as preferred when other MFA options are available. You can't turn off TOTP MFA for any of your users when MFA is required in your user pool; you can only set the type that your user prefers.

This data type is a request parameter of SetUserMFAPreference and AdminSetUserMFAPreference.

Members
Enabled
Type: 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
Type: boolean

Specifies whether software token MFA is the preferred MFA method.

StringAttributeConstraintsType

Description

The minimum and maximum length values of an attribute that is of the string type, for example custom:department.

This data type is part of SchemaAttributeType. It defines the length constraints on string-type attributes that you configure in CreateUserPool and UpdateUserPool, and displays the length constraints of all string-type attributes in the response to DescribeUserPool

Members
MaxLength
Type: string

The maximum length of a string attribute value. Must be a number less than or equal to 2^1023, represented as a string with a length of 131072 characters or fewer.

MinLength
Type: string

The minimum length of a string attribute value.

TierChangeNotAllowedException

Description

This exception is thrown when you've attempted to change your feature plan but the operation isn't permitted.

Members
message
Type: string

TokenValidityUnitsType

Description

The time units that, with IdTokenValidity, AccessTokenValidity, and RefreshTokenValidity, set and display the duration of ID, access, and refresh tokens for an app client. You can assign a separate token validity unit to each type of token.

This data type is a request parameter of CreateUserPoolClient and UpdateUserPoolClient, and a response parameter of DescribeUserPoolClient.

Members
AccessToken
Type: string

A time unit for the value that you set in the AccessTokenValidity parameter. The default AccessTokenValidity time unit is hours. AccessTokenValidity duration can range from five minutes to one day.

IdToken
Type: string

A time unit for the value that you set in the IdTokenValidity parameter. The default IdTokenValidity time unit is hours. IdTokenValidity duration can range from five minutes to one day.

RefreshToken
Type: string

A time unit for the value that you set in the RefreshTokenValidity parameter. The default RefreshTokenValidity time unit is days. RefreshTokenValidity duration can range from 60 minutes to 10 years.

TooManyFailedAttemptsException

Description

This exception is thrown when the user has made too many failed attempts for a given action, such as sign-in.

Members
message
Type: string

The message returned when Amazon Cognito returns a TooManyFailedAttempts exception.

TooManyRequestsException

Description

This exception is thrown when the user has made too many requests for a given operation.

Members
message
Type: string

The message returned when the Amazon Cognito service returns a too many requests exception.

UICustomizationType

Description

A container for the UI customization information for the hosted UI in a user pool.

This data type is a response parameter of GetUICustomization.

Members
CSS
Type: string

The CSS values in the UI customization. To get a template with your UI customization options, make a GetUiCustomization request.

CSSVersion
Type: string

The CSS version number.

ClientId
Type: string

The app client ID for your UI customization. When this value isn't present, the customization applies to all user pool app clients that don't have client-level settings..

CreationDate
Type: timestamp (string|DateTime or anything parsable by strtotime)

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

ImageUrl
Type: string

A URL path to the hosted logo image of your UI customization.

LastModifiedDate
Type: timestamp (string|DateTime or anything parsable by strtotime)

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

UserPoolId
Type: string

The ID of the user pool with hosted UI customizations.

UnauthorizedException

Description

Exception that is thrown when the request isn't authorized. This can happen due to an invalid access token in the request.

Members
message
Type: string

UnexpectedLambdaException

Description

This exception is thrown when Amazon Cognito encounters an unexpected exception with Lambda.

Members
message
Type: string

The message returned when Amazon Cognito returns an unexpected Lambda exception.

UnsupportedIdentityProviderException

Description

This exception is thrown when the specified identifier isn't supported.

Members
message
Type: string

UnsupportedOperationException

Description

Exception that is thrown when you attempt to perform an operation that isn't enabled for the user pool client.

Members
message
Type: string

UnsupportedTokenTypeException

Description

Exception that is thrown when an unsupported token is passed to an operation.

Members
message
Type: string

UnsupportedUserStateException

Description

The request failed because the user is in an unsupported state.

Members
message
Type: string

The message returned when the user is in an unsupported state.

UserAttributeUpdateSettingsType

Description

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.

This data type is a request and response parameter of CreateUserPool and UpdateUserPool, and a response parameter of DescribeUserPool.

Members
AttributesRequireVerificationBeforeUpdate
Type: Array of strings

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

UserContextDataType

Description

Contextual data, such as the user's device fingerprint, IP address, or location, used for evaluating the risk of an unexpected event by Amazon Cognito advanced security.

This data type is a request parameter of public-client authentication operations like InitiateAuth and RespondToAuthChallenge.

Members
EncodedData
Type: 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.

IpAddress
Type: string

The source IP address of your user's device.

UserImportInProgressException

Description

This exception is thrown when you're trying to modify a user pool while a user import job is in progress for that pool.

Members
message
Type: string

The message returned when the user pool has an import job running.

UserImportJobType

Description

A user import job in a user pool. Describes the status of user import with a CSV file. For more information, see Importing users into user pools from a CSV file.

This data type is a request parameter of CreateUserImportJob, DescribeUserImportJob, ListUserImportJobs, StartUserImportJob, and StopUserImportJob.

Members
CloudWatchLogsRoleArn
Type: 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.

CompletionDate
Type: timestamp (string|DateTime or anything parsable by strtotime)

The date when the user import job was completed.

CompletionMessage
Type: string

The message returned when the user import job is completed.

CreationDate
Type: timestamp (string|DateTime or anything parsable by strtotime)

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

FailedUsers
Type: long (int|float)

The number of users that couldn't be imported.

ImportedUsers
Type: long (int|float)

The number of users that were successfully imported.

JobId
Type: string

The ID of the user import job.

JobName
Type: string

The friendly name of the user import job.

PreSignedUrl
Type: string

The pre-signed URL target for uploading the CSV file.

SkippedUsers
Type: long (int|float)

The number of users that were skipped.

StartDate
Type: timestamp (string|DateTime or anything parsable by strtotime)

The date when the user import job was started.

Status
Type: 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.

UserPoolId
Type: string

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

UserLambdaValidationException

Description

This exception is thrown when the Amazon Cognito service encounters a user validation exception with the Lambda service.

Members
message
Type: string

The message returned when the Amazon Cognito service returns a user validation exception with the Lambda service.

UserNotConfirmedException

Description

This exception is thrown when a user isn't confirmed successfully.

Members
message
Type: string

The message returned when a user isn't confirmed successfully.

UserNotFoundException

Description

This exception is thrown when a user isn't found.

Members
message
Type: string

The message returned when a user isn't found.

UserPoolAddOnNotEnabledException

Description

This exception is thrown when user pool add-ons aren't enabled.

Members
message
Type: string

UserPoolAddOnsType

Description

User pool add-ons. Contains settings for activation of advanced security features. To log user security information but take no action, set to AUDIT. To configure automatic security responses to risky traffic to your user pool, set to ENFORCED.

For more information, see Adding advanced security to a user pool.

This data type is a request and response parameter of CreateUserPool and UpdateUserPool, and a response parameter of DescribeUserPool.

Members
AdvancedSecurityAdditionalFlows

Advanced security configuration options for additional authentication types in your user pool, including custom authentication.

AdvancedSecurityMode
Required: Yes
Type: string

The operating mode of advanced security features for standard authentication types in your user pool, including username-password and secure remote password (SRP) authentication.

UserPoolClientDescription

Description

A short description of a user pool app client.

This data type is a response parameter of ListUserPoolClients.

Members
ClientId
Type: string

The app client ID.

ClientName
Type: string

The app client name.

UserPoolId
Type: string

The ID of the user pool that's associated with the app client.

UserPoolClientType

Description

The configuration of a user pool client.

This data type is a request parameter of CreateUserPoolClient and UpdateUserPoolClient, and a response parameter of DescribeUserPoolClient.

Members
AccessTokenValidity
Type: int

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.

If you don't specify otherwise in the configuration of your app client, your access tokens are valid for one hour.

AllowedOAuthFlows
Type: Array of strings

The OAuth grant types that you want your app client to generate. To create an app client that generates client credentials grants, you must add client_credentials as the only allowed OAuth flow.

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.

AllowedOAuthFlowsUserPoolClient
Type: boolean

Set to true to use OAuth 2.0 features in your user pool app client.

AllowedOAuthFlowsUserPoolClient must be true before you can configure the following features in your app client.

  • CallBackURLs: Callback URLs.

  • LogoutURLs: Sign-out redirect URLs.

  • AllowedOAuthScopes: OAuth 2.0 scopes.

  • AllowedOAuthFlows: Support for authorization code, implicit, and client credentials OAuth 2.0 grants.

To use OAuth 2.0 features, configure one of these features in the Amazon Cognito console or set AllowedOAuthFlowsUserPoolClient to true in a CreateUserPoolClient or UpdateUserPoolClient API request. If you don't set a value for AllowedOAuthFlowsUserPoolClient in a request with the CLI or SDKs, it defaults to false.

AllowedOAuthScopes
Type: Array of strings

The OAuth 2.0 scopes that you want your app client to support. Can include standard OAuth scopes like phone, email, openid, and profile. Can also include the aws.cognito.signin.user.admin scope that authorizes user profile self-service operations and custom scopes from resource servers.

AnalyticsConfiguration
Type: AnalyticsConfigurationType structure

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

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.

AuthSessionValidity
Type: int

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.

CallbackURLs
Type: Array of strings

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.

ClientId
Type: string

The ID of the app client.

ClientName
Type: string

The name of the app client.

ClientSecret
Type: string

The app client secret.

CreationDate
Type: timestamp (string|DateTime or anything parsable by strtotime)

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

DefaultRedirectURI
Type: 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.

EnablePropagateAdditionalUserContextData
Type: 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.

EnableTokenRevocation
Type: 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.

ExplicitAuthFlows
Type: Array of strings

The authentication flows that you want your user pool client to support. For each app client in your user pool, you can sign in your users with any combination of one or more flows, including with a user name and Secure Remote Password (SRP), a user name and password, or a custom authentication process that you define with Lambda functions.

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

Valid values include:

  • ALLOW_USER_AUTH: Enable selection-based sign-in with USER_AUTH. This setting covers username-password, secure remote password (SRP), passwordless, and passkey authentication. This authentiation flow can do username-password and SRP authentication without other ExplicitAuthFlows permitting them. For example users can complete an SRP challenge through USER_AUTH without the flow USER_SRP_AUTH being active for the app client. This flow doesn't include CUSTOM_AUTH.

  • 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, your app passes a user name and password to Amazon Cognito in the request, instead of using the Secure Remote Password (SRP) protocol to securely transmit the password.

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

In some environments, you will see the values ADMIN_NO_SRP_AUTH, CUSTOM_AUTH_FLOW_ONLY, or USER_PASSWORD_AUTH. You can't assign these legacy ExplicitAuthFlows values to user pool clients at the same time as values that begin with ALLOW_, like ALLOW_USER_SRP_AUTH.

IdTokenValidity
Type: int

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 IdTokenValidity in an API request is hours. Valid range is displayed below in seconds.

If you don't specify otherwise in the configuration of your app client, your ID tokens are valid for one hour.

LastModifiedDate
Type: timestamp (string|DateTime or anything parsable by strtotime)

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

LogoutURLs
Type: Array of strings

A list of allowed logout URLs for the IdPs.

PreventUserExistenceErrors
Type: 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.

Defaults to LEGACY when you don't provide a value.

ReadAttributes
Type: Array of strings

The list of user attributes that you want your app client to have read access to. After your user authenticates in your app, their access token authorizes them to read their own attribute value for any attribute in this list. An example of this kind of activity is when your user selects a link to view their profile information. Your app makes a GetUser API request to retrieve and display your user's profile data.

When you don't specify the ReadAttributes for your app client, your app can read the values of email_verified, phone_number_verified, and the Standard attributes of your user pool. When your user pool app client has read access to these default attributes, ReadAttributes doesn't return any information. Amazon Cognito only populates ReadAttributes in the API response if you have specified your own custom set of read attributes.

RefreshTokenValidity
Type: int

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.

If you don't specify otherwise in the configuration of your app client, your refresh tokens are valid for 30 days.

SupportedIdentityProviders
Type: Array of strings

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.

This setting applies to providers that you can access with managed login. The removal of COGNITO from this list doesn't prevent authentication operations for local users with the user pools API in an Amazon Web Services SDK. The only way to prevent API-based authentication is to block access with a WAF rule.

TokenValidityUnits
Type: TokenValidityUnitsType structure

The time units that, with IdTokenValidity, AccessTokenValidity, and RefreshTokenValidity, set and display the duration of ID, access, and refresh tokens for an app client. You can assign a separate token validity unit to each type of token.

UserPoolId
Type: string

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

WriteAttributes
Type: Array of strings

The list of user attributes that you want your app client to have write access to. After your user authenticates in your app, their access token authorizes them to set or modify their own attribute value for any attribute in this list. An example of this kind of activity is when you present your user with a form to update their profile information and they change their last name. Your app then makes an UpdateUserAttributes API request and sets family_name to the new value.

When you don't specify the WriteAttributes for your app client, your app can write the values of the Standard attributes of your user pool. When your user pool has write access to these default attributes, WriteAttributes doesn't return any information. Amazon Cognito only populates WriteAttributes in the API response if you have specified your own custom set of write attributes.

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.

UserPoolDescriptionType

Description

A short description of a user pool.

This data type is a response parameter of ListUserPools.

Members
CreationDate
Type: timestamp (string|DateTime or anything parsable by strtotime)

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

Id
Type: string

The user pool ID.

LambdaConfig
Type: LambdaConfigType structure

A collection of user pool Lambda triggers. Amazon Cognito invokes triggers at several possible stages of user pool operations. Triggers can modify the outcome of the operations that invoked them.

LastModifiedDate
Type: timestamp (string|DateTime or anything parsable by strtotime)

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

Name
Type: string

The user pool name.

Status
Type: string

The user pool status.

UserPoolPolicyType

Description

A list of user pool policies. Contains the policy that sets password-complexity requirements.

This data type is a request and response parameter of CreateUserPool and UpdateUserPool, and a response parameter of DescribeUserPool.

Members
PasswordPolicy
Type: PasswordPolicyType structure

The password policy settings for a user pool, including complexity, history, and length requirements.

SignInPolicy
Type: SignInPolicyType structure

The policy for allowed types of authentication in a user pool.

UserPoolTaggingException

Description

This exception is thrown when a user pool tag can't be set or updated.

Members
message
Type: string

UserPoolType

Description

The configuration of a user pool.

This data type is a response parameter of CreateUserPool, UpdateUserPool, and DescribeUserPool.

Members
AccountRecoverySetting
Type: AccountRecoverySettingType structure

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.

AdminCreateUserConfig
Type: AdminCreateUserConfigType structure

The configuration for AdminCreateUser requests.

AliasAttributes
Type: Array of strings

Attributes supported as an alias for this user pool. An alias is an attribute that users can enter as an alternative username. Possible values: phone_number, email, or preferred_username.

Arn
Type: string

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

AutoVerifiedAttributes
Type: Array of strings

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

CreationDate
Type: timestamp (string|DateTime or anything parsable by strtotime)

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

CustomDomain
Type: 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.

DeletionProtection
Type: string

When active, DeletionProtection prevents accidental deletion of your user pool. Before you can delete a user pool that you have protected against deletion, you must deactivate this feature.

When you try to delete a protected user pool in a DeleteUserPool API request, Amazon Cognito returns an InvalidParameterException error. To delete a protected user pool, send a new DeleteUserPool request after you deactivate deletion protection in an UpdateUserPool API request.

DeviceConfiguration
Type: DeviceConfigurationType structure

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

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

Domain
Type: string

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

EmailConfiguration
Type: EmailConfigurationType structure

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.

EmailConfigurationFailure
Type: 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.

EmailVerificationMessage
Type: string

This parameter is no longer used. See VerificationMessageTemplateType.

EmailVerificationSubject
Type: string

This parameter is no longer used. See VerificationMessageTemplateType.

EstimatedNumberOfUsers
Type: int

A number estimating the size of the user pool.

Id
Type: string

The ID of the user pool.

LambdaConfig
Type: LambdaConfigType structure

A collection of user pool Lambda triggers. Amazon Cognito invokes triggers at several possible stages of user pool operations. Triggers can modify the outcome of the operations that invoked them.

LastModifiedDate
Type: timestamp (string|DateTime or anything parsable by strtotime)

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

MfaConfiguration
Type: 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.

Name
Type: string

The name of the user pool.

Policies
Type: UserPoolPolicyType structure

A list of user pool policies. Contains the policy that sets password-complexity requirements.

SchemaAttributes
Type: Array of SchemaAttributeType structures

A list of the user attributes and their properties in your user pool. The attribute schema contains standard attributes, custom attributes with a custom: prefix, and developer attributes with a dev: prefix. For more information, see User pool attributes.

Developer-only attributes are a legacy feature of user pools, and are read-only to all app clients. You can create and update developer-only attributes only with IAM-authenticated API operations. Use app client read/write permissions instead.

SmsAuthenticationMessage
Type: string

The contents of the SMS authentication message.

SmsConfiguration
Type: SmsConfigurationType structure

User pool configuration for delivery of SMS messages with 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.

SmsConfigurationFailure
Type: 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 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.

SmsVerificationMessage
Type: string

This parameter is no longer used. See VerificationMessageTemplateType.

Status
Type: string

This parameter is no longer used.

UserAttributeUpdateSettings

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.

UserPoolAddOns
Type: UserPoolAddOnsType structure

User pool add-ons. Contains settings for activation of advanced security features. To log user security information but take no action, set to AUDIT. To configure automatic security responses to risky traffic to your user pool, set to ENFORCED.

For more information, see Adding advanced security to a user pool.

UserPoolTags
Type: Associative array of custom strings keys (TagKeysType) to strings

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.

UserPoolTier
Type: string

The user pool feature plan, or tier. This parameter determines the eligibility of the user pool for features like managed login, access-token customization, and threat protection. Defaults to ESSENTIALS.

UsernameAttributes
Type: Array of strings

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

UsernameConfiguration
Type: UsernameConfigurationType structure

Case sensitivity of the username input for the selected sign-in option. When case sensitivity is set to False (case insensitive), users can sign in with any combination of capital and lowercase letters. For example, username, USERNAME, or UserName, or for email, email@example.com or EMaiL@eXamplE.Com. For most use cases, set case sensitivity to False (case insensitive) as a best practice. When usernames and email addresses are case insensitive, Amazon Cognito treats any variation in case as the same user, and prevents a case variation from being assigned to the same attribute for a different user.

This configuration is immutable after you set it. For more information, see UsernameConfigurationType.

VerificationMessageTemplate

The template for the verification message that your user pool delivers to users who set an email address or phone number attribute.

UserType

Description

A user profile in a Amazon Cognito user pool.

This data type is a response parameter to AdminCreateUser and ListUsers.

Members
Attributes
Type: Array of AttributeType structures

Names and values of a user's attributes, for example email.

Enabled
Type: boolean

Indicates whether the user's account is enabled or disabled.

MFAOptions
Type: Array of MFAOptionType structures

The user's MFA configuration.

UserCreateDate
Type: timestamp (string|DateTime or anything parsable by strtotime)

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

UserLastModifiedDate
Type: timestamp (string|DateTime or anything parsable by strtotime)

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

UserStatus
Type: 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.

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

Username
Type: string

The user's username.

UsernameConfigurationType

Description

The configuration of a user pool for username case sensitivity.

This data type is a request and response parameter of CreateUserPool and UpdateUserPool, and a response parameter of DescribeUserPool.

Members
CaseSensitive
Required: Yes
Type: boolean

Specifies whether user name case sensitivity will be applied for all users in the user pool through Amazon Cognito APIs. For most use cases, set case sensitivity to False (case insensitive) as a best practice. When usernames and email addresses are case insensitive, users can sign in as the same user when they enter a different capitalization of their user name.

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 username, USERNAME, or UserName. This option also enables both preferred_username and email alias to be case insensitive, in addition to the username attribute.

UsernameExistsException

Description

This exception is thrown when Amazon Cognito encounters a user name that already exists in the user pool.

Members
message
Type: string

The message returned when Amazon Cognito throws a user name exists exception.

VerificationMessageTemplateType

Description

The template for the verification message that your user pool delivers to users who set an email address or phone number attribute.

This data type is a request and response parameter of CreateUserPool and UpdateUserPool, and a response parameter of DescribeUserPool.

Members
DefaultEmailOption
Type: string

The configuration of verification emails to contain a clickable link or a verification code.

For link, your template body must contain link text in the format {##Click here##}. "Click here" in the example is a customizable string. For code, your template body must contain a code placeholder in the format {####}.

EmailMessage
Type: 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.

EmailMessageByLink
Type: 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.

EmailSubject
Type: 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.

EmailSubjectByLink
Type: 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.

SmsMessage
Type: string

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

WebAuthnChallengeNotFoundException

Description

This exception is thrown when the challenge from StartWebAuthn registration has expired.

Members
message
Type: string

WebAuthnClientMismatchException

Description

This exception is thrown when the access token is for a different client than the one in the original StartWebAuthnRegistration request.

Members
message
Type: string

WebAuthnConfigurationMissingException

Description

This exception is thrown when a user pool doesn't have a configured relying party id or a user pool domain.

Members
message
Type: string

WebAuthnConfigurationType

Description

Settings for multi-factor authentication (MFA) with passkey, or webauthN, biometric and security-key devices in a user pool. Configures the following:

  • Configuration at the user-pool level for whether you want to require passkey configuration as an MFA factor, or include it as a choice.

  • The user pool relying-party ID. This is the user pool domain that user's passkey providers should trust as a receiver of passkey authentication.

  • The providers that you want to allow as origins for passkey authentication.

This data type is a request parameter of SetUserPoolMfaConfig and a response parameter of GetUserPoolMfaConfig.

Members
RelyingPartyId
Type: string

Sets or displays the authentication domain, typically your user pool domain, that passkey providers must use as a relying party (RP) in their configuration.

Under the following conditions, the passkey relying party ID must be the fully-qualified domain name of your custom domain:

  • The user pool is configured for passkey authentication.

  • The user pool has a custom domain, whether or not it also has a prefix domain.

  • Your application performs authentication with managed login or the classic hosted UI.

UserVerification
Type: string

When required, users can only register and sign in users with passkeys that are capable of user verification. When preferred, your user pool doesn't require the use of authenticators with user verification but encourages it.

WebAuthnCredentialDescription

Description

The details of a passkey, or webauthN, biometric or security-key authentication factor for a user.

This data type is a response parameter of ListWebAuthnCredentials.

Members
AuthenticatorAttachment
Type: string

The general category of the passkey authenticator. Can be a platform, or on-device authenticator like a built-in fingerprint scanner, or a cross-platform device that's not attached to the device like a Bluetooth security key.

AuthenticatorTransports
Required: Yes
Type: Array of strings

Information about the transport methods of the passkey credential, for example USB or Bluetooth Low Energy.

CreatedAt
Required: Yes
Type: timestamp (string|DateTime or anything parsable by strtotime)

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

CredentialId
Required: Yes
Type: string

The unique identifier of the passkey credential.

FriendlyCredentialName
Required: Yes
Type: string

An automatically-generated friendly name for the passkey credential.

RelyingPartyId
Required: Yes
Type: string

The relying-party ID of the provider for the passkey credential.

WebAuthnCredentialNotSupportedException

Description

This exception is thrown when a user presents passkey credentials from an unsupported device or provider.

Members
message
Type: string

WebAuthnNotEnabledException

Description

This exception is thrown when the passkey feature isn't enabled for the user pool.

Members
message
Type: string

WebAuthnOriginNotAllowedException

Description

This exception is thrown when the passkey credential's registration origin does not align with the user pool relying party id.

Members
message
Type: string

WebAuthnRelyingPartyMismatchException

Description

This exception is thrown when the given passkey credential is associated with a different relying party ID than the user pool relying party ID.

Members
message
Type: string