Amazon Cognito Identity Provider

2022/05/31 - Amazon Cognito Identity Provider - 10 updated api methods

Changes  Amazon Cognito now supports IP Address propagation for all unauthenticated APIs (e.g. SignUp, ForgotPassword).

ConfirmForgotPassword (updated) Link ¶
Changes (request)
{'UserContextData': {'IpAddress': 'string'}}

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

See also: AWS API Documentation

Request Syntax

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

string

param ClientId

[REQUIRED]

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

type SecretHash

string

param SecretHash

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.

type Username

string

param Username

[REQUIRED]

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

type ConfirmationCode

string

param ConfirmationCode

[REQUIRED]

The confirmation code sent by a user's request to retrieve a forgotten password. For more information, see ForgotPassword .

type Password

string

param Password

[REQUIRED]

The password sent by a user's request to retrieve a forgotten password.

type AnalyticsMetadata

dict

param AnalyticsMetadata

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

  • AnalyticsEndpointId (string) --

    The endpoint ID.

type UserContextData

dict

param UserContextData

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

  • IpAddress (string) --

    The source IP address of your user's device.

  • EncodedData (string) --

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

type ClientMetadata

dict

param ClientMetadata

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

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

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

Note

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

  • Store the ClientMetadata value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration doesn't include triggers, the ClientMetadata parameter serves no purpose.

  • Validate the ClientMetadata value.

  • Encrypt the ClientMetadata value. Don't use Amazon Cognito to provide sensitive information.

  • (string) --

    • (string) --

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

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

ConfirmSignUp (updated) Link ¶
Changes (request)
{'UserContextData': {'IpAddress': 'string'}}

Confirms registration of a new user.

See also: AWS API Documentation

Request Syntax

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

string

param ClientId

[REQUIRED]

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

type SecretHash

string

param SecretHash

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.

type Username

string

param Username

[REQUIRED]

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

type ConfirmationCode

string

param ConfirmationCode

[REQUIRED]

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

type ForceAliasCreation

boolean

param ForceAliasCreation

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

type AnalyticsMetadata

dict

param AnalyticsMetadata

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

  • AnalyticsEndpointId (string) --

    The endpoint ID.

type UserContextData

dict

param UserContextData

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

  • IpAddress (string) --

    The source IP address of your user's device.

  • EncodedData (string) --

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

type ClientMetadata

dict

param ClientMetadata

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

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

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

Note

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

  • Store the ClientMetadata value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration doesn't include triggers, the ClientMetadata parameter serves no purpose.

  • Validate the ClientMetadata value.

  • Encrypt the ClientMetadata value. Don't use Amazon Cognito to provide sensitive information.

  • (string) --

    • (string) --

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

    Represents the response from the server for the registration confirmation.

CreateUserPoolClient (updated) Link ¶
Changes (request, response)
Request
{'EnablePropagateAdditionalUserContextData': 'boolean'}
Response
{'UserPoolClient': {'EnablePropagateAdditionalUserContextData': 'boolean'}}

Creates the user pool client.

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

See also: AWS API Documentation

Request Syntax

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

string

param UserPoolId

[REQUIRED]

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

type ClientName

string

param ClientName

[REQUIRED]

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

type GenerateSecret

boolean

param GenerateSecret

Boolean to specify whether you want to generate a secret for the user pool client being created.

type RefreshTokenValidity

integer

param RefreshTokenValidity

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.

type AccessTokenValidity

integer

param AccessTokenValidity

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.

type IdTokenValidity

integer

param IdTokenValidity

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

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

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

type TokenValidityUnits

dict

param TokenValidityUnits

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

  • AccessToken (string) --

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

  • IdToken (string) --

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

  • RefreshToken (string) --

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

type ReadAttributes

list

param ReadAttributes

The read attributes.

  • (string) --

type WriteAttributes

list

param WriteAttributes

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

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

  • (string) --

type ExplicitAuthFlows

list

param ExplicitAuthFlows

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

Note

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

Valid values include:

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

  • ALLOW_CUSTOM_AUTH : Enable Lambda trigger based authentication.

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

  • ALLOW_USER_SRP_AUTH : Enable SRP-based authentication.

  • ALLOW_REFRESH_TOKEN_AUTH : Enable authflow to refresh tokens.

If you don't specify a value for ExplicitAuthFlows , your app client activates the ALLOW_USER_SRP_AUTH and ALLOW_CUSTOM_AUTH authentication flows.

  • (string) --

type SupportedIdentityProviders

list

param SupportedIdentityProviders

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

  • (string) --

type CallbackURLs

list

param CallbackURLs

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

A redirect URI must:

  • Be an absolute URI.

  • Be registered with the authorization server.

  • Not include a fragment component.

See OAuth 2.0 - Redirection Endpoint .

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

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

  • (string) --

type LogoutURLs

list

param LogoutURLs

A list of allowed logout URLs for the IdPs.

  • (string) --

type DefaultRedirectURI

string

param DefaultRedirectURI

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.

type AllowedOAuthFlows

list

param AllowedOAuthFlows

The allowed OAuth flows.

code

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

implicit

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

client_credentials

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

  • (string) --

type AllowedOAuthScopes

list

param AllowedOAuthScopes

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

  • (string) --

type AllowedOAuthFlowsUserPoolClient

boolean

param AllowedOAuthFlowsUserPoolClient

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

type AnalyticsConfiguration

dict

param AnalyticsConfiguration

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

Note

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

  • ApplicationId (string) --

    The application ID for an Amazon Pinpoint application.

  • ApplicationArn (string) --

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

  • RoleArn (string) --

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

  • ExternalId (string) --

    The external ID.

  • UserDataShared (boolean) --

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

type PreventUserExistenceErrors

string

param PreventUserExistenceErrors

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.

type EnableTokenRevocation

boolean

param EnableTokenRevocation

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.

type EnablePropagateAdditionalUserContextData

boolean

param EnablePropagateAdditionalUserContextData

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.

rtype

dict

returns

Response Syntax

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

Response Structure

  • (dict) --

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

    • UserPoolClient (dict) --

      The user pool client that was just created.

      • UserPoolId (string) --

        The user pool ID for the user pool client.

      • ClientName (string) --

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

      • ClientId (string) --

        The ID of the client associated with the user pool.

      • ClientSecret (string) --

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

      • LastModifiedDate (datetime) --

        The date the user pool client was last modified.

      • CreationDate (datetime) --

        The date the user pool client was created.

      • RefreshTokenValidity (integer) --

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

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

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

      • AccessTokenValidity (integer) --

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

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

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

      • IdTokenValidity (integer) --

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

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

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

      • TokenValidityUnits (dict) --

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

        • AccessToken (string) --

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

        • IdToken (string) --

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

        • RefreshToken (string) --

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

      • ReadAttributes (list) --

        The Read-only attributes.

        • (string) --

      • WriteAttributes (list) --

        The writeable attributes.

        • (string) --

      • ExplicitAuthFlows (list) --

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

        Valid values include:

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

        • ALLOW_CUSTOM_AUTH : Enable Lambda trigger based authentication.

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

        • ALLOW_USER_SRP_AUTH : Enable SRP-based authentication.

        • ALLOW_REFRESH_TOKEN_AUTH : Enable authflow to refresh tokens.

        • (string) --

      • SupportedIdentityProviders (list) --

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

        • (string) --

      • CallbackURLs (list) --

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

        A redirect URI must:

        • Be an absolute URI.

        • Be registered with the authorization server.

        • Not include a fragment component.

        See OAuth 2.0 - Redirection Endpoint .

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

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

        • (string) --

      • LogoutURLs (list) --

        A list of allowed logout URLs for the IdPs.

        • (string) --

      • DefaultRedirectURI (string) --

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

        A redirect URI must:

        • Be an absolute URI.

        • Be registered with the authorization server.

        • Not include a fragment component.

        See OAuth 2.0 - Redirection Endpoint .

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

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

      • AllowedOAuthFlows (list) --

        The allowed OAuth flows.

        code

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

        implicit

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

        client_credentials

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

        • (string) --

      • AllowedOAuthScopes (list) --

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

        • (string) --

      • AllowedOAuthFlowsUserPoolClient (boolean) --

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

      • AnalyticsConfiguration (dict) --

        The Amazon Pinpoint analytics configuration for the user pool client.

        Note

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

        • ApplicationId (string) --

          The application ID for an Amazon Pinpoint application.

        • ApplicationArn (string) --

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

        • RoleArn (string) --

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

        • ExternalId (string) --

          The external ID.

        • UserDataShared (boolean) --

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

      • PreventUserExistenceErrors (string) --

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

        Valid values include:

        • ENABLED - This prevents user existence-related errors.

        • LEGACY - This represents the old behavior of Amazon Cognito where user existence related errors aren't prevented.

      • EnableTokenRevocation (boolean) --

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

      • EnablePropagateAdditionalUserContextData (boolean) --

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

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

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

DescribeUserPoolClient (updated) Link ¶
Changes (response)
{'UserPoolClient': {'EnablePropagateAdditionalUserContextData': 'boolean'}}

Client method for returning the configuration information and metadata of the specified user pool app client.

See also: AWS API Documentation

Request Syntax

client.describe_user_pool_client(
    UserPoolId='string',
    ClientId='string'
)
type UserPoolId

string

param UserPoolId

[REQUIRED]

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

type ClientId

string

param ClientId

[REQUIRED]

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

rtype

dict

returns

Response Syntax

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

Response Structure

  • (dict) --

    Represents the response from the server from a request to describe the user pool client.

    • UserPoolClient (dict) --

      The user pool client from a server response to describe the user pool client.

      • UserPoolId (string) --

        The user pool ID for the user pool client.

      • ClientName (string) --

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

      • ClientId (string) --

        The ID of the client associated with the user pool.

      • ClientSecret (string) --

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

      • LastModifiedDate (datetime) --

        The date the user pool client was last modified.

      • CreationDate (datetime) --

        The date the user pool client was created.

      • RefreshTokenValidity (integer) --

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

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

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

      • AccessTokenValidity (integer) --

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

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

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

      • IdTokenValidity (integer) --

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

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

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

      • TokenValidityUnits (dict) --

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

        • AccessToken (string) --

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

        • IdToken (string) --

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

        • RefreshToken (string) --

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

      • ReadAttributes (list) --

        The Read-only attributes.

        • (string) --

      • WriteAttributes (list) --

        The writeable attributes.

        • (string) --

      • ExplicitAuthFlows (list) --

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

        Valid values include:

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

        • ALLOW_CUSTOM_AUTH : Enable Lambda trigger based authentication.

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

        • ALLOW_USER_SRP_AUTH : Enable SRP-based authentication.

        • ALLOW_REFRESH_TOKEN_AUTH : Enable authflow to refresh tokens.

        • (string) --

      • SupportedIdentityProviders (list) --

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

        • (string) --

      • CallbackURLs (list) --

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

        A redirect URI must:

        • Be an absolute URI.

        • Be registered with the authorization server.

        • Not include a fragment component.

        See OAuth 2.0 - Redirection Endpoint .

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

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

        • (string) --

      • LogoutURLs (list) --

        A list of allowed logout URLs for the IdPs.

        • (string) --

      • DefaultRedirectURI (string) --

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

        A redirect URI must:

        • Be an absolute URI.

        • Be registered with the authorization server.

        • Not include a fragment component.

        See OAuth 2.0 - Redirection Endpoint .

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

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

      • AllowedOAuthFlows (list) --

        The allowed OAuth flows.

        code

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

        implicit

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

        client_credentials

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

        • (string) --

      • AllowedOAuthScopes (list) --

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

        • (string) --

      • AllowedOAuthFlowsUserPoolClient (boolean) --

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

      • AnalyticsConfiguration (dict) --

        The Amazon Pinpoint analytics configuration for the user pool client.

        Note

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

        • ApplicationId (string) --

          The application ID for an Amazon Pinpoint application.

        • ApplicationArn (string) --

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

        • RoleArn (string) --

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

        • ExternalId (string) --

          The external ID.

        • UserDataShared (boolean) --

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

      • PreventUserExistenceErrors (string) --

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

        Valid values include:

        • ENABLED - This prevents user existence-related errors.

        • LEGACY - This represents the old behavior of Amazon Cognito where user existence related errors aren't prevented.

      • EnableTokenRevocation (boolean) --

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

      • EnablePropagateAdditionalUserContextData (boolean) --

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

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

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

ForgotPassword (updated) Link ¶
Changes (request)
{'UserContextData': {'IpAddress': 'string'}}

Calling this API causes a message to be sent to the end user with a confirmation code that is required to change the user's password. For the Username parameter, you can use the username or user alias. The method used to send the confirmation code is sent according to the specified AccountRecoverySetting. For more information, see Recovering User Accounts in the Amazon Cognito Developer Guide . If neither a verified phone number nor a verified email exists, an InvalidParameterException is thrown. To use the confirmation code for resetting the password, call ConfirmForgotPassword .

Note

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

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

See also: AWS API Documentation

Request Syntax

client.forgot_password(
    ClientId='string',
    SecretHash='string',
    UserContextData={
        'IpAddress': 'string',
        'EncodedData': 'string'
    },
    Username='string',
    AnalyticsMetadata={
        'AnalyticsEndpointId': 'string'
    },
    ClientMetadata={
        'string': 'string'
    }
)
type ClientId

string

param ClientId

[REQUIRED]

The ID of the client associated with the user pool.

type SecretHash

string

param SecretHash

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.

type UserContextData

dict

param UserContextData

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

  • IpAddress (string) --

    The source IP address of your user's device.

  • EncodedData (string) --

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

type Username

string

param Username

[REQUIRED]

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

type AnalyticsMetadata

dict

param AnalyticsMetadata

The Amazon Pinpoint analytics metadata that contributes to your metrics for ForgotPassword calls.

  • AnalyticsEndpointId (string) --

    The endpoint ID.

type ClientMetadata

dict

param ClientMetadata

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

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

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

Note

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

  • Store the ClientMetadata value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration doesn't include triggers, the ClientMetadata parameter serves no purpose.

  • Validate the ClientMetadata value.

  • Encrypt the ClientMetadata value. Don't use Amazon Cognito to provide sensitive information.

  • (string) --

    • (string) --

rtype

dict

returns

Response Syntax

{
    'CodeDeliveryDetails': {
        'Destination': 'string',
        'DeliveryMedium': 'SMS'|'EMAIL',
        'AttributeName': 'string'
    }
}

Response Structure

  • (dict) --

    The response from Amazon Cognito to a request to reset a password.

    • CodeDeliveryDetails (dict) --

      The code delivery details returned by the server in response to the request to reset a password.

      • Destination (string) --

        The email address or phone number destination where Amazon Cognito sent the code.

      • DeliveryMedium (string) --

        The method that Amazon Cognito used to send the code.

      • AttributeName (string) --

        The name of the attribute that Amazon Cognito verifies with the code.

InitiateAuth (updated) Link ¶
Changes (request)
{'UserContextData': {'IpAddress': 'string'}}

Initiates sign-in for a user in the Amazon Cognito user directory. You can't sign in a user with a federated IdP with InitiateAuth . For more information, see Adding user pool sign-in through a third party .

Note

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

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

See also: AWS API Documentation

Request Syntax

client.initiate_auth(
    AuthFlow='USER_SRP_AUTH'|'REFRESH_TOKEN_AUTH'|'REFRESH_TOKEN'|'CUSTOM_AUTH'|'ADMIN_NO_SRP_AUTH'|'USER_PASSWORD_AUTH'|'ADMIN_USER_PASSWORD_AUTH',
    AuthParameters={
        'string': 'string'
    },
    ClientMetadata={
        'string': 'string'
    },
    ClientId='string',
    AnalyticsMetadata={
        'AnalyticsEndpointId': 'string'
    },
    UserContextData={
        'IpAddress': 'string',
        'EncodedData': 'string'
    }
)
type AuthFlow

string

param AuthFlow

[REQUIRED]

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

  • REFRESH_TOKEN_AUTH takes in a valid refresh token and returns new tokens.

  • USER_SRP_AUTH takes in USERNAME and SRP_A and returns the SRP variables to be used for next challenge execution.

  • USER_PASSWORD_AUTH takes in USERNAME and PASSWORD and returns the next challenge or tokens.

Valid values include:

  • USER_SRP_AUTH : Authentication flow for the Secure Remote Password (SRP) protocol.

  • REFRESH_TOKEN_AUTH /REFRESH_TOKEN : Authentication flow for refreshing the access token and ID token by supplying a valid refresh token.

  • CUSTOM_AUTH : Custom authentication flow.

  • USER_PASSWORD_AUTH : Non-SRP authentication flow; user name and password are passed directly. If a user migration Lambda trigger is set, this flow will invoke the user migration Lambda if it doesn't find the user name in the user pool.

ADMIN_NO_SRP_AUTH isn't a valid value.

type AuthParameters

dict

param AuthParameters

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

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

  • For REFRESH_TOKEN_AUTH/REFRESH_TOKEN : REFRESH_TOKEN (required), SECRET_HASH (required if the app client is configured with a client secret), DEVICE_KEY .

  • For CUSTOM_AUTH : USERNAME (required), SECRET_HASH (if app client is configured with client secret), DEVICE_KEY . To start the authentication flow with password verification, include ChallengeName: SRP_A and SRP_A: (The SRP_A Value) .

  • (string) --

    • (string) --

type ClientMetadata

dict

param ClientMetadata

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

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

  • Pre signup

  • Pre authentication

  • User migration

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

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

  • Post authentication

  • Custom message

  • Pre token generation

  • Create auth challenge

  • Define auth challenge

  • Verify auth challenge

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

Note

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

  • Store the ClientMetadata value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration doesn't include triggers, the ClientMetadata parameter serves no purpose.

  • Validate the ClientMetadata value.

  • Encrypt the ClientMetadata value. Don't use Amazon Cognito to provide sensitive information.

  • (string) --

    • (string) --

type ClientId

string

param ClientId

[REQUIRED]

The app client ID.

type AnalyticsMetadata

dict

param AnalyticsMetadata

The Amazon Pinpoint analytics metadata that contributes to your metrics for InitiateAuth calls.

  • AnalyticsEndpointId (string) --

    The endpoint ID.

type UserContextData

dict

param UserContextData

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

  • IpAddress (string) --

    The source IP address of your user's device.

  • EncodedData (string) --

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

rtype

dict

returns

Response Syntax

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

Response Structure

  • (dict) --

    Initiates the authentication response.

    • ChallengeName (string) --

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

      Valid values include the following:

      Note

      All of the following challenges require USERNAME and SECRET_HASH (if applicable) in the parameters.

      • SMS_MFA : Next challenge is to supply an SMS_MFA_CODE , delivered via SMS.

      • PASSWORD_VERIFIER : Next challenge is to supply PASSWORD_CLAIM_SIGNATURE , PASSWORD_CLAIM_SECRET_BLOCK , and TIMESTAMP after the client-side SRP calculations.

      • CUSTOM_CHALLENGE : This is returned if your custom authentication flow determines that the user should pass another challenge before tokens are issued.

      • DEVICE_SRP_AUTH : If device tracking was activated on your user pool and the previous challenges were passed, this challenge is returned so that Amazon Cognito can start tracking this device.

      • DEVICE_PASSWORD_VERIFIER : Similar to PASSWORD_VERIFIER , but for devices only.

      • NEW_PASSWORD_REQUIRED : For users who are required to change their passwords after successful first login. Respond to this challenge with NEW_PASSWORD and any required attributes that Amazon Cognito returned in the requiredAttributes parameter. You can also set values for attributes that aren't required by your user pool and that your app client can write. For more information, see RespondToAuthChallenge .

      Note

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

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

    • Session (string) --

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

    • ChallengeParameters (dict) --

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

      All challenges require USERNAME and SECRET_HASH (if applicable).

      • (string) --

        • (string) --

    • AuthenticationResult (dict) --

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

      • AccessToken (string) --

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

      • ExpiresIn (integer) --

        The expiration period of the authentication result in seconds.

      • TokenType (string) --

        The token type.

      • RefreshToken (string) --

        The refresh token.

      • IdToken (string) --

        The ID token.

      • NewDeviceMetadata (dict) --

        The new device metadata from an authentication result.

        • DeviceKey (string) --

          The device key.

        • DeviceGroupKey (string) --

          The device group key.

ResendConfirmationCode (updated) Link ¶
Changes (request)
{'UserContextData': {'IpAddress': 'string'}}

Resends the confirmation (for confirmation of registration) to a specific user in the user pool.

Note

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

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

See also: AWS API Documentation

Request Syntax

client.resend_confirmation_code(
    ClientId='string',
    SecretHash='string',
    UserContextData={
        'IpAddress': 'string',
        'EncodedData': 'string'
    },
    Username='string',
    AnalyticsMetadata={
        'AnalyticsEndpointId': 'string'
    },
    ClientMetadata={
        'string': 'string'
    }
)
type ClientId

string

param ClientId

[REQUIRED]

The ID of the client associated with the user pool.

type SecretHash

string

param SecretHash

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.

type UserContextData

dict

param UserContextData

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

  • IpAddress (string) --

    The source IP address of your user's device.

  • EncodedData (string) --

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

type Username

string

param Username

[REQUIRED]

The username attribute of the user to whom you want to resend a confirmation code.

type AnalyticsMetadata

dict

param AnalyticsMetadata

The Amazon Pinpoint analytics metadata that contributes to your metrics for ResendConfirmationCode calls.

  • AnalyticsEndpointId (string) --

    The endpoint ID.

type ClientMetadata

dict

param ClientMetadata

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

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

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

Note

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

  • Store the ClientMetadata value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration doesn't include triggers, the ClientMetadata parameter serves no purpose.

  • Validate the ClientMetadata value.

  • Encrypt the ClientMetadata value. Don't use Amazon Cognito to provide sensitive information.

  • (string) --

    • (string) --

rtype

dict

returns

Response Syntax

{
    'CodeDeliveryDetails': {
        'Destination': 'string',
        'DeliveryMedium': 'SMS'|'EMAIL',
        'AttributeName': 'string'
    }
}

Response Structure

  • (dict) --

    The response from the server when Amazon Cognito makes the request to resend a confirmation code.

    • CodeDeliveryDetails (dict) --

      The code delivery details returned by the server in response to the request to resend the confirmation code.

      • Destination (string) --

        The email address or phone number destination where Amazon Cognito sent the code.

      • DeliveryMedium (string) --

        The method that Amazon Cognito used to send the code.

      • AttributeName (string) --

        The name of the attribute that Amazon Cognito verifies with the code.

RespondToAuthChallenge (updated) Link ¶
Changes (request)
{'UserContextData': {'IpAddress': 'string'}}

Responds to the authentication challenge.

Note

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

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

See also: AWS API Documentation

Request Syntax

client.respond_to_auth_challenge(
    ClientId='string',
    ChallengeName='SMS_MFA'|'SOFTWARE_TOKEN_MFA'|'SELECT_MFA_TYPE'|'MFA_SETUP'|'PASSWORD_VERIFIER'|'CUSTOM_CHALLENGE'|'DEVICE_SRP_AUTH'|'DEVICE_PASSWORD_VERIFIER'|'ADMIN_NO_SRP_AUTH'|'NEW_PASSWORD_REQUIRED',
    Session='string',
    ChallengeResponses={
        'string': 'string'
    },
    AnalyticsMetadata={
        'AnalyticsEndpointId': 'string'
    },
    UserContextData={
        'IpAddress': 'string',
        'EncodedData': 'string'
    },
    ClientMetadata={
        'string': 'string'
    }
)
type ClientId

string

param ClientId

[REQUIRED]

The app client ID.

type ChallengeName

string

param ChallengeName

[REQUIRED]

The challenge name. For more information, see InitiateAuth .

ADMIN_NO_SRP_AUTH isn't a valid value.

type Session

string

param Session

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.

type ChallengeResponses

dict

param ChallengeResponses

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

Note

SECRET_HASH (if app client is configured with client secret) applies to all of the inputs that follow (including SOFTWARE_TOKEN_MFA ).

  • SMS_MFA : SMS_MFA_CODE , USERNAME .

  • PASSWORD_VERIFIER : PASSWORD_CLAIM_SIGNATURE , PASSWORD_CLAIM_SECRET_BLOCK , TIMESTAMP , USERNAME .

Note

PASSWORD_VERIFIER requires DEVICE_KEY when you sign in with a remembered device.

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

Note

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

  • SOFTWARE_TOKEN_MFA : USERNAME and SOFTWARE_TOKEN_MFA_CODE are required attributes.

  • DEVICE_SRP_AUTH requires USERNAME , DEVICE_KEY , SRP_A (and SECRET_HASH ).

  • DEVICE_PASSWORD_VERIFIER requires everything that PASSWORD_VERIFIER requires, plus DEVICE_KEY .

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

  • (string) --

    • (string) --

type AnalyticsMetadata

dict

param AnalyticsMetadata

The Amazon Pinpoint analytics metadata that contributes to your metrics for RespondToAuthChallenge calls.

  • AnalyticsEndpointId (string) --

    The endpoint ID.

type UserContextData

dict

param UserContextData

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

  • IpAddress (string) --

    The source IP address of your user's device.

  • EncodedData (string) --

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

type ClientMetadata

dict

param ClientMetadata

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

You create custom workflows by assigning Lambda functions to user pool triggers. When you use the RespondToAuthChallenge API action, Amazon Cognito invokes any functions that are assigned to the following triggers: post authentication , pre token generation , define auth challenge , create auth challenge , and verify auth challenge . When Amazon Cognito invokes any of these functions, it passes a JSON payload, which the function receives as input. This payload contains a clientMetadata attribute, which provides the data that you assigned to the ClientMetadata parameter in your RespondToAuthChallenge request. In your function code in Lambda, you can process the clientMetadata value to enhance your workflow for your specific needs.

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

Note

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

  • Store the ClientMetadata value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration doesn't include triggers, the ClientMetadata parameter serves no purpose.

  • Validate the ClientMetadata value.

  • Encrypt the ClientMetadata value. Don't use Amazon Cognito to provide sensitive information.

  • (string) --

    • (string) --

rtype

dict

returns

Response Syntax

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

Response Structure

  • (dict) --

    The response to respond to the authentication challenge.

    • ChallengeName (string) --

      The challenge name. For more information, see InitiateAuth .

    • Session (string) --

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

    • ChallengeParameters (dict) --

      The challenge parameters. For more information, see InitiateAuth .

      • (string) --

        • (string) --

    • AuthenticationResult (dict) --

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

      • AccessToken (string) --

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

      • ExpiresIn (integer) --

        The expiration period of the authentication result in seconds.

      • TokenType (string) --

        The token type.

      • RefreshToken (string) --

        The refresh token.

      • IdToken (string) --

        The ID token.

      • NewDeviceMetadata (dict) --

        The new device metadata from an authentication result.

        • DeviceKey (string) --

          The device key.

        • DeviceGroupKey (string) --

          The device group key.

SignUp (updated) Link ¶
Changes (request)
{'UserContextData': {'IpAddress': 'string'}}

Registers the user in the specified user pool and creates a user name, password, and user attributes.

Note

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

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

See also: AWS API Documentation

Request Syntax

client.sign_up(
    ClientId='string',
    SecretHash='string',
    Username='string',
    Password='string',
    UserAttributes=[
        {
            'Name': 'string',
            'Value': 'string'
        },
    ],
    ValidationData=[
        {
            'Name': 'string',
            'Value': 'string'
        },
    ],
    AnalyticsMetadata={
        'AnalyticsEndpointId': 'string'
    },
    UserContextData={
        'IpAddress': 'string',
        'EncodedData': 'string'
    },
    ClientMetadata={
        'string': 'string'
    }
)
type ClientId

string

param ClientId

[REQUIRED]

The ID of the client associated with the user pool.

type SecretHash

string

param SecretHash

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.

type Username

string

param Username

[REQUIRED]

The user name of the user you want to register.

type Password

string

param Password

[REQUIRED]

The password of the user you want to register.

type UserAttributes

list

param UserAttributes

An array of name-value pairs representing user attributes.

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

  • (dict) --

    Specifies whether the attribute is standard or custom.

    • Name (string) -- [REQUIRED]

      The name of the attribute.

    • Value (string) --

      The value of the attribute.

type ValidationData

list

param ValidationData

The validation data in the request to register a user.

  • (dict) --

    Specifies whether the attribute is standard or custom.

    • Name (string) -- [REQUIRED]

      The name of the attribute.

    • Value (string) --

      The value of the attribute.

type AnalyticsMetadata

dict

param AnalyticsMetadata

The Amazon Pinpoint analytics metadata that contributes to your metrics for SignUp calls.

  • AnalyticsEndpointId (string) --

    The endpoint ID.

type UserContextData

dict

param UserContextData

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

  • IpAddress (string) --

    The source IP address of your user's device.

  • EncodedData (string) --

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

type ClientMetadata

dict

param ClientMetadata

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

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

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

Note

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

  • Store the ClientMetadata value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration doesn't include triggers, the ClientMetadata parameter serves no purpose.

  • Validate the ClientMetadata value.

  • Encrypt the ClientMetadata value. Don't use Amazon Cognito to provide sensitive information.

  • (string) --

    • (string) --

rtype

dict

returns

Response Syntax

{
    'UserConfirmed': True|False,
    'CodeDeliveryDetails': {
        'Destination': 'string',
        'DeliveryMedium': 'SMS'|'EMAIL',
        'AttributeName': 'string'
    },
    'UserSub': 'string'
}

Response Structure

  • (dict) --

    The response from the server for a registration request.

    • UserConfirmed (boolean) --

      A response from the server indicating that a user registration has been confirmed.

    • CodeDeliveryDetails (dict) --

      The code delivery details returned by the server response to the user registration request.

      • Destination (string) --

        The email address or phone number destination where Amazon Cognito sent the code.

      • DeliveryMedium (string) --

        The method that Amazon Cognito used to send the code.

      • AttributeName (string) --

        The name of the attribute that Amazon Cognito verifies with the code.

    • UserSub (string) --

      The UUID of the authenticated user. This isn't the same as username .

UpdateUserPoolClient (updated) Link ¶
Changes (request, response)
Request
{'EnablePropagateAdditionalUserContextData': 'boolean'}
Response
{'UserPoolClient': {'EnablePropagateAdditionalUserContextData': 'boolean'}}

Updates the specified user pool app client with the specified attributes. You can get a list of the current user pool app client settings using DescribeUserPoolClient .

Warning

If you don't provide a value for an attribute, it will be set to the default value.

You can also use this operation to enable token revocation for user pool clients. For more information about revoking tokens, see RevokeToken .

See also: AWS API Documentation

Request Syntax

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

string

param UserPoolId

[REQUIRED]

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

type ClientId

string

param ClientId

[REQUIRED]

The ID of the client associated with the user pool.

type ClientName

string

param ClientName

The client name from the update user pool client request.

type RefreshTokenValidity

integer

param RefreshTokenValidity

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.

type AccessTokenValidity

integer

param AccessTokenValidity

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.

type IdTokenValidity

integer

param IdTokenValidity

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

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

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

type TokenValidityUnits

dict

param TokenValidityUnits

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

  • AccessToken (string) --

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

  • IdToken (string) --

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

  • RefreshToken (string) --

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

type ReadAttributes

list

param ReadAttributes

The read-only attributes of the user pool.

  • (string) --

type WriteAttributes

list

param WriteAttributes

The writeable attributes of the user pool.

  • (string) --

type ExplicitAuthFlows

list

param ExplicitAuthFlows

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

Valid values include:

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

  • ALLOW_CUSTOM_AUTH : Enable Lambda trigger based authentication.

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

  • ALLOW_USER_SRP_AUTH : Enable SRP-based authentication.

  • ALLOW_REFRESH_TOKEN_AUTH : Enable authflow to refresh tokens.

  • (string) --

type SupportedIdentityProviders

list

param SupportedIdentityProviders

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

  • (string) --

type CallbackURLs

list

param CallbackURLs

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

A redirect URI must:

  • Be an absolute URI.

  • Be registered with the authorization server.

  • Not include a fragment component.

See OAuth 2.0 - Redirection Endpoint .

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

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

  • (string) --

type LogoutURLs

list

param LogoutURLs

A list of allowed logout URLs for the IdPs.

  • (string) --

type DefaultRedirectURI

string

param DefaultRedirectURI

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.

type AllowedOAuthFlows

list

param AllowedOAuthFlows

The allowed OAuth flows.

code

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

implicit

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

client_credentials

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

  • (string) --

type AllowedOAuthScopes

list

param AllowedOAuthScopes

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

  • (string) --

type AllowedOAuthFlowsUserPoolClient

boolean

param AllowedOAuthFlowsUserPoolClient

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

type AnalyticsConfiguration

dict

param AnalyticsConfiguration

The Amazon Pinpoint analytics configuration necessary to collect metrics for this user pool.

Note

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

  • ApplicationId (string) --

    The application ID for an Amazon Pinpoint application.

  • ApplicationArn (string) --

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

  • RoleArn (string) --

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

  • ExternalId (string) --

    The external ID.

  • UserDataShared (boolean) --

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

type PreventUserExistenceErrors

string

param PreventUserExistenceErrors

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.

type EnableTokenRevocation

boolean

param EnableTokenRevocation

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

type EnablePropagateAdditionalUserContextData

boolean

param EnablePropagateAdditionalUserContextData

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.

rtype

dict

returns

Response Syntax

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

Response Structure

  • (dict) --

    Represents the response from the server to the request to update the user pool client.

    • UserPoolClient (dict) --

      The user pool client value from the response from the server when you request to update the user pool client.

      • UserPoolId (string) --

        The user pool ID for the user pool client.

      • ClientName (string) --

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

      • ClientId (string) --

        The ID of the client associated with the user pool.

      • ClientSecret (string) --

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

      • LastModifiedDate (datetime) --

        The date the user pool client was last modified.

      • CreationDate (datetime) --

        The date the user pool client was created.

      • RefreshTokenValidity (integer) --

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

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

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

      • AccessTokenValidity (integer) --

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

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

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

      • IdTokenValidity (integer) --

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

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

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

      • TokenValidityUnits (dict) --

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

        • AccessToken (string) --

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

        • IdToken (string) --

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

        • RefreshToken (string) --

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

      • ReadAttributes (list) --

        The Read-only attributes.

        • (string) --

      • WriteAttributes (list) --

        The writeable attributes.

        • (string) --

      • ExplicitAuthFlows (list) --

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

        Valid values include:

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

        • ALLOW_CUSTOM_AUTH : Enable Lambda trigger based authentication.

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

        • ALLOW_USER_SRP_AUTH : Enable SRP-based authentication.

        • ALLOW_REFRESH_TOKEN_AUTH : Enable authflow to refresh tokens.

        • (string) --

      • SupportedIdentityProviders (list) --

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

        • (string) --

      • CallbackURLs (list) --

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

        A redirect URI must:

        • Be an absolute URI.

        • Be registered with the authorization server.

        • Not include a fragment component.

        See OAuth 2.0 - Redirection Endpoint .

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

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

        • (string) --

      • LogoutURLs (list) --

        A list of allowed logout URLs for the IdPs.

        • (string) --

      • DefaultRedirectURI (string) --

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

        A redirect URI must:

        • Be an absolute URI.

        • Be registered with the authorization server.

        • Not include a fragment component.

        See OAuth 2.0 - Redirection Endpoint .

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

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

      • AllowedOAuthFlows (list) --

        The allowed OAuth flows.

        code

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

        implicit

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

        client_credentials

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

        • (string) --

      • AllowedOAuthScopes (list) --

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

        • (string) --

      • AllowedOAuthFlowsUserPoolClient (boolean) --

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

      • AnalyticsConfiguration (dict) --

        The Amazon Pinpoint analytics configuration for the user pool client.

        Note

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

        • ApplicationId (string) --

          The application ID for an Amazon Pinpoint application.

        • ApplicationArn (string) --

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

        • RoleArn (string) --

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

        • ExternalId (string) --

          The external ID.

        • UserDataShared (boolean) --

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

      • PreventUserExistenceErrors (string) --

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

        Valid values include:

        • ENABLED - This prevents user existence-related errors.

        • LEGACY - This represents the old behavior of Amazon Cognito where user existence related errors aren't prevented.

      • EnableTokenRevocation (boolean) --

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

      • EnablePropagateAdditionalUserContextData (boolean) --

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

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

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