We announced the upcoming end-of-support for AWS SDK for JavaScript v2.
We recommend that you migrate to AWS SDK for JavaScript v3. For dates, additional details, and information on how to migrate, please refer to the linked announcement.

Class: AWS.CognitoIdentityServiceProvider

Inherits:
AWS.Service
  • Object
show all
Identifier:
cognitoidentityserviceprovider
API Version:
2016-04-18
Defined in:
(unknown)

Overview

Constructs a service interface object. Each API operation is exposed as a function on service.

Service Description

With the Amazon Cognito user pools API, you can configure user pools and authenticate users. To authenticate users from third-party identity providers (IdPs) in this API, you can link IdP users to native user profiles. Learn more about the authentication and authorization of federated users at Adding user pool sign-in through a third party and in the User pool federation endpoints and hosted UI reference.

This API reference provides detailed information about API operations and object types in Amazon Cognito.

Along with resource management operations, the Amazon Cognito user pools API includes classes of operations and authorization models for client-side and server-side authentication of users. You can interact with operations in the Amazon Cognito user pools API as any of the following subjects.

  1. An administrator who wants to configure user pools, app clients, users, groups, or other user pool functions.

  2. A server-side app, like a web application, that wants to use its Amazon Web Services privileges to manage, authenticate, or authorize a user.

  3. A client-side app, like a mobile app, that wants to make unauthenticated requests to manage, authenticate, or authorize a user.

For more information, see Using the Amazon Cognito user pools API and user pool endpoints in the Amazon Cognito Developer Guide.

With your Amazon Web Services SDK, you can build the logic to support operational flows in every use case for this API. You can also make direct REST API requests to Amazon Cognito user pools service endpoints. The following links can get you started with the CognitoIdentityProvider client in other supported Amazon Web Services SDKs.

To get started with an Amazon Web Services SDK, see Tools to Build on Amazon Web Services. For example actions and scenarios, see Code examples for Amazon Cognito Identity Provider using Amazon Web Services SDKs.

Sending a Request Using CognitoIdentityServiceProvider

var cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider();
cognitoidentityserviceprovider.adminForgetDevice(params, function (err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Locking the API Version

In order to ensure that the CognitoIdentityServiceProvider object uses this specific API, you can construct the object by passing the apiVersion option to the constructor:

var cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider({apiVersion: '2016-04-18'});

You can also set the API version globally in AWS.config.apiVersions using the cognitoidentityserviceprovider service identifier:

AWS.config.apiVersions = {
  cognitoidentityserviceprovider: '2016-04-18',
  // other service API versions
};

var cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider();

Version:

  • 2016-04-18

Constructor Summary collapse

Property Summary collapse

Properties inherited from AWS.Service

apiVersions

Method Summary collapse

Methods inherited from AWS.Service

makeRequest, makeUnauthenticatedRequest, waitFor, setupRequestListeners, defineService

Constructor Details

new AWS.CognitoIdentityServiceProvider(options = {}) ⇒ Object

Constructs a service object. This object has one method for each API operation.

Examples:

Constructing a CognitoIdentityServiceProvider object

var cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider({apiVersion: '2016-04-18'});

Options Hash (options):

  • params (map)

    An optional map of parameters to bind to every request sent by this service object. For more information on bound parameters, see "Working with Services" in the Getting Started Guide.

  • endpoint (String|AWS.Endpoint)

    The endpoint URI to send requests to. The default endpoint is built from the configured region. The endpoint should be a string like 'https://{service}.{region}.amazonaws.com' or an Endpoint object.

  • accessKeyId (String)

    your AWS access key ID.

  • secretAccessKey (String)

    your AWS secret access key.

  • sessionToken (AWS.Credentials)

    the optional AWS session token to sign requests with.

  • credentials (AWS.Credentials)

    the AWS credentials to sign requests with. You can either specify this object, or specify the accessKeyId and secretAccessKey options directly.

  • credentialProvider (AWS.CredentialProviderChain)

    the provider chain used to resolve credentials if no static credentials property is set.

  • region (String)

    the region to send service requests to. See AWS.CognitoIdentityServiceProvider.region for more information.

  • maxRetries (Integer)

    the maximum amount of retries to attempt with a request. See AWS.CognitoIdentityServiceProvider.maxRetries for more information.

  • maxRedirects (Integer)

    the maximum amount of redirects to follow with a request. See AWS.CognitoIdentityServiceProvider.maxRedirects for more information.

  • sslEnabled (Boolean)

    whether to enable SSL for requests.

  • paramValidation (Boolean|map)

    whether input parameters should be validated against the operation description before sending the request. Defaults to true. Pass a map to enable any of the following specific validation features:

    • min [Boolean] — Validates that a value meets the min constraint. This is enabled by default when paramValidation is set to true.
    • max [Boolean] — Validates that a value meets the max constraint.
    • pattern [Boolean] — Validates that a string value matches a regular expression.
    • enum [Boolean] — Validates that a string value matches one of the allowable enum values.
  • computeChecksums (Boolean)

    whether to compute checksums for payload bodies when the service accepts it (currently supported in S3 only)

  • convertResponseTypes (Boolean)

    whether types are converted when parsing response data. Currently only supported for JSON based services. Turning this off may improve performance on large response payloads. Defaults to true.

  • correctClockSkew (Boolean)

    whether to apply a clock skew correction and retry requests that fail because of an skewed client clock. Defaults to false.

  • s3ForcePathStyle (Boolean)

    whether to force path style URLs for S3 objects.

  • s3BucketEndpoint (Boolean)

    whether the provided endpoint addresses an individual bucket (false if it addresses the root API endpoint). Note that setting this configuration option requires an endpoint to be provided explicitly to the service constructor.

  • s3DisableBodySigning (Boolean)

    whether S3 body signing should be disabled when using signature version v4. Body signing can only be disabled when using https. Defaults to true.

  • s3UsEast1RegionalEndpoint ('legacy'|'regional')

    when region is set to 'us-east-1', whether to send s3 request to global endpoints or 'us-east-1' regional endpoints. This config is only applicable to S3 client. Defaults to legacy

  • s3UseArnRegion (Boolean)

    whether to override the request region with the region inferred from requested resource's ARN. Only available for S3 buckets Defaults to true

  • retryDelayOptions (map)

    A set of options to configure the retry delay on retryable errors. Currently supported options are:

    • base [Integer] — The base number of milliseconds to use in the exponential backoff for operation retries. Defaults to 100 ms for all services except DynamoDB, where it defaults to 50ms.
    • customBackoff [function] — A custom function that accepts a retry count and error and returns the amount of time to delay in milliseconds. If the result is a non-zero negative value, no further retry attempts will be made. The base option will be ignored if this option is supplied. The function is only called for retryable errors.
  • httpOptions (map)

    A set of options to pass to the low-level HTTP request. Currently supported options are:

    • proxy [String] — the URL to proxy requests through
    • agent [http.Agent, https.Agent] — the Agent object to perform HTTP requests with. Used for connection pooling. Defaults to the global agent (http.globalAgent) for non-SSL connections. Note that for SSL connections, a special Agent object is used in order to enable peer certificate verification. This feature is only available in the Node.js environment.
    • connectTimeout [Integer] — Sets the socket to timeout after failing to establish a connection with the server after connectTimeout milliseconds. This timeout has no effect once a socket connection has been established.
    • timeout [Integer] — Sets the socket to timeout after timeout milliseconds of inactivity on the socket. Defaults to two minutes (120000).
    • xhrAsync [Boolean] — Whether the SDK will send asynchronous HTTP requests. Used in the browser environment only. Set to false to send requests synchronously. Defaults to true (async on).
    • xhrWithCredentials [Boolean] — Sets the "withCredentials" property of an XMLHttpRequest object. Used in the browser environment only. Defaults to false.
  • apiVersion (String, Date)

    a String in YYYY-MM-DD format (or a date) that represents the latest possible API version that can be used in all services (unless overridden by apiVersions). Specify 'latest' to use the latest possible version.

  • apiVersions (map<String, String|Date>)

    a map of service identifiers (the lowercase service class name) with the API version to use when instantiating a service. Specify 'latest' for each individual that can use the latest available version.

  • logger (#write, #log)

    an object that responds to .write() (like a stream) or .log() (like the console object) in order to log information about requests

  • systemClockOffset (Number)

    an offset value in milliseconds to apply to all signing times. Use this to compensate for clock skew when your system may be out of sync with the service time. Note that this configuration option can only be applied to the global AWS.config object and cannot be overridden in service-specific configuration. Defaults to 0 milliseconds.

  • signatureVersion (String)

    the signature version to sign requests with (overriding the API configuration). Possible values are: 'v2', 'v3', 'v4'.

  • signatureCache (Boolean)

    whether the signature to sign requests with (overriding the API configuration) is cached. Only applies to the signature version 'v4'. Defaults to true.

  • dynamoDbCrc32 (Boolean)

    whether to validate the CRC32 checksum of HTTP response bodies returned by DynamoDB. Default: true.

  • useAccelerateEndpoint (Boolean)

    Whether to use the S3 Transfer Acceleration endpoint with the S3 service. Default: false.

  • clientSideMonitoring (Boolean)

    whether to collect and publish this client's performance metrics of all its API requests.

  • endpointDiscoveryEnabled (Boolean|undefined)

    whether to call operations with endpoints given by service dynamically. Setting this

  • endpointCacheSize (Number)

    the size of the global cache storing endpoints from endpoint discovery operations. Once endpoint cache is created, updating this setting cannot change existing cache size. Defaults to 1000

  • hostPrefixEnabled (Boolean)

    whether to marshal request parameters to the prefix of hostname. Defaults to true.

  • stsRegionalEndpoints ('legacy'|'regional')

    whether to send sts request to global endpoints or regional endpoints. Defaults to 'legacy'.

  • useFipsEndpoint (Boolean)

    Enables FIPS compatible endpoints. Defaults to false.

  • useDualstackEndpoint (Boolean)

    Enables IPv6 dualstack endpoint. Defaults to false.

Property Details

endpointAWS.Endpoint (readwrite)

Returns an Endpoint object representing the endpoint URL for service requests.

Returns:

  • (AWS.Endpoint)

    an Endpoint object representing the endpoint URL for service requests.

Method Details

addCustomAttributes(params = {}, callback) ⇒ AWS.Request

Adds additional user attributes to the user pool schema.

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

Learn more

Service Reference:

Examples:

Calling the addCustomAttributes operation

var params = {
  CustomAttributes: [ /* required */
    {
      AttributeDataType: String | Number | DateTime | Boolean,
      DeveloperOnlyAttribute: true || false,
      Mutable: true || false,
      Name: 'STRING_VALUE',
      NumberAttributeConstraints: {
        MaxValue: 'STRING_VALUE',
        MinValue: 'STRING_VALUE'
      },
      Required: true || false,
      StringAttributeConstraints: {
        MaxLength: 'STRING_VALUE',
        MinLength: 'STRING_VALUE'
      }
    },
    /* more items */
  ],
  UserPoolId: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.addCustomAttributes(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

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

    • CustomAttributes — (Array<map>)

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

      • Name — (String)

        The name of your user pool attribute. When you create or update a user pool, adding a schema attribute creates a custom or developer-only attribute. When you add an attribute with a Name value of MyAttribute, Amazon Cognito creates the custom attribute custom:MyAttribute. When DeveloperOnlyAttribute is true, Amazon Cognito creates your attribute as dev:MyAttribute. In an operation that describes a user pool, Amazon Cognito returns this value as value for standard attributes, custom:value for custom attributes, and dev:value for developer-only attributes..

      • AttributeDataType — (String)

        The data format of the values for your attribute. When you choose an AttributeDataType, Amazon Cognito validates the input against the data type. A custom attribute value in your user's ID token is always a string, for example "custom:isMember" : "true" or "custom:YearsAsMember" : "12".

        Possible values include:
        • "String"
        • "Number"
        • "DateTime"
        • "Boolean"
      • DeveloperOnlyAttribute — (Boolean)
        Note: You should use WriteAttributes in the user pool client to control how attributes can be mutated for new use cases instead of using DeveloperOnlyAttribute.

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

      • Mutable — (Boolean)

        Specifies whether the value of the attribute can be changed.

        Any user pool attribute whose value you map from an IdP attribute must be mutable, with a parameter value of true. Amazon Cognito updates mapped attributes when users sign in to your application through an IdP. If an attribute is immutable, Amazon Cognito throws an error when it attempts to update the attribute. For more information, see Specifying Identity Provider Attribute Mappings for Your User Pool.

      • Required — (Boolean)

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

      • NumberAttributeConstraints — (map)

        Specifies the constraints for an attribute of the number type.

        • MinValue — (String)

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

        • MaxValue — (String)

          The maximum length of a number attribute value. Must be a number less than or equal to 21023, represented as a string with a length of 131072 characters or fewer.

      • StringAttributeConstraints — (map)

        Specifies the constraints for an attribute of the string type.

        • MinLength — (String)

          The minimum length.

        • MaxLength — (String)

          The maximum length of a string attribute value. Must be a number less than or equal to 21023, represented as a string with a length of 131072 characters or fewer.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

adminAddUserToGroup(params = {}, callback) ⇒ AWS.Request

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

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

Learn more

Service Reference:

Examples:

Calling the adminAddUserToGroup operation

var params = {
  GroupName: 'STRING_VALUE', /* required */
  UserPoolId: 'STRING_VALUE', /* required */
  Username: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.adminAddUserToGroup(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

      The user pool ID for the user pool.

    • Username — (String)

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

    • GroupName — (String)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

adminConfirmSignUp(params = {}, callback) ⇒ AWS.Request

This IAM-authenticated API operation confirms user sign-up as an administrator. Unlike ConfirmSignUp, your IAM credentials authorize user account confirmation. No confirmation code is required.

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

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

Learn more

Service Reference:

Examples:

Calling the adminConfirmSignUp operation

var params = {
  UserPoolId: 'STRING_VALUE', /* required */
  Username: 'STRING_VALUE', /* required */
  ClientMetadata: {
    '<StringType>': 'STRING_VALUE',
    /* '<StringType>': ... */
  }
};
cognitoidentityserviceprovider.adminConfirmSignUp(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

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

    • Username — (String)

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

    • ClientMetadata — (map<String>)

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

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

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

      Note: When you use the ClientMetadata parameter, remember that Amazon Cognito won't do the following:
      • Store the ClientMetadata value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration doesn't include triggers, the ClientMetadata parameter serves no purpose.
      • Validate the ClientMetadata value.
      • Encrypt the ClientMetadata value. Don't use Amazon Cognito to provide sensitive information.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

adminCreateUser(params = {}, callback) ⇒ AWS.Request

Creates a new user in the specified user pool.

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

Note: This action might generate an SMS text message. Starting June 1, 2021, US telecom carriers require you to register an origination phone number before you can send SMS messages to US phone numbers. If you use SMS text messages in Amazon Cognito, you must register a phone number with Amazon Pinpoint. Amazon Cognito uses the registered number automatically. Otherwise, Amazon Cognito users who must receive SMS messages might not be able to sign up, activate their accounts, or sign in. If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Services service, Amazon Simple Notification Service might place your account in the SMS sandbox. In sandbox mode , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see SMS message settings for Amazon Cognito user pools in the Amazon Cognito Developer Guide.

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

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

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

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

Learn more

Service Reference:

Examples:

An AdminCreateUser request for for a test user named John.


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

 var params = {
  DesiredDeliveryMediums: [
     "SMS"
  ], 
  MessageAction: "SUPPRESS", 
  TemporaryPassword: "This-is-my-test-99!", 
  UserAttributes: [
     {
    Name: "name", 
    Value: "John"
   }, 
     {
    Name: "phone_number", 
    Value: "+12065551212"
   }, 
     {
    Name: "email", 
    Value: "testuser@example.com"
   }
  ], 
  UserPoolId: "us-east-1_EXAMPLE", 
  Username: "testuser"
 };
 cognitoidentityserviceprovider.adminCreateUser(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    User: {
     Attributes: [
        {
       Name: "sub", 
       Value: "d16b4aa8-8633-4abd-93b3-5062a8e1b5f8"
      }, 
        {
       Name: "name", 
       Value: "John"
      }, 
        {
       Name: "phone_number", 
       Value: "+12065551212"
      }, 
        {
       Name: "email", 
       Value: "testuser@example.com"
      }
     ], 
     Enabled: true, 
     UserCreateDate: <Date Representation>, 
     UserLastModifiedDate: <Date Representation>, 
     UserStatus: "FORCE_CHANGE_PASSWORD", 
     Username: "testuser"
    }
   }
   */
 });

Calling the adminCreateUser operation

var params = {
  UserPoolId: 'STRING_VALUE', /* required */
  Username: 'STRING_VALUE', /* required */
  ClientMetadata: {
    '<StringType>': 'STRING_VALUE',
    /* '<StringType>': ... */
  },
  DesiredDeliveryMediums: [
    SMS | EMAIL,
    /* more items */
  ],
  ForceAliasCreation: true || false,
  MessageAction: RESEND | SUPPRESS,
  TemporaryPassword: 'STRING_VALUE',
  UserAttributes: [
    {
      Name: 'STRING_VALUE', /* required */
      Value: 'STRING_VALUE'
    },
    /* more items */
  ],
  ValidationData: [
    {
      Name: 'STRING_VALUE', /* required */
      Value: 'STRING_VALUE'
    },
    /* more items */
  ]
};
cognitoidentityserviceprovider.adminCreateUser(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

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

    • Username — (String)

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

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

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

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

    • UserAttributes — (Array<map>)

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

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

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

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

      • email: The email address of the user to whom the message that contains the code and username will be sent. Required if the email_verified attribute is set to True, or if "EMAIL" is specified in the DesiredDeliveryMediums parameter.

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

      • Namerequired — (String)

        The name of the attribute.

      • Value — (String)

        The value of the attribute.

    • ValidationData — (Array<map>)

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

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

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

      • Namerequired — (String)

        The name of the attribute.

      • Value — (String)

        The value of the attribute.

    • TemporaryPassword — (String)

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

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

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

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

    • ForceAliasCreation — (Boolean)

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

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

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

    • MessageAction — (String)

      Set to RESEND to resend the invitation message to a user that already exists and reset the expiration limit on the user's account. Set to SUPPRESS to suppress sending the message. You can specify only one value.

      Possible values include:
      • "RESEND"
      • "SUPPRESS"
    • DesiredDeliveryMediums — (Array<String>)

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

    • ClientMetadata — (map<String>)

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

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

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

      Note: When you use the ClientMetadata parameter, remember that Amazon Cognito won't do the following:
      • Store the ClientMetadata value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration doesn't include triggers, the ClientMetadata parameter serves no purpose.
      • Validate the ClientMetadata value.
      • Encrypt the ClientMetadata value. Don't use Amazon Cognito to provide sensitive information.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • User — (map)

        The newly created user.

        • Username — (String)

          The user name of the user you want to describe.

        • Attributes — (Array<map>)

          A container with information about the user type attributes.

          • Namerequired — (String)

            The name of the attribute.

          • Value — (String)

            The value of the attribute.

        • UserCreateDate — (Date)

          The creation date of the user.

        • UserLastModifiedDate — (Date)

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

        • Enabled — (Boolean)

          Specifies whether the user is enabled.

        • UserStatus — (String)

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

          • UNCONFIRMED - User has been created but not confirmed.

          • CONFIRMED - User has been confirmed.

          • EXTERNAL_PROVIDER - User signed in with a third-party IdP.

          • UNKNOWN - User status isn't known.

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

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

          Possible values include:
          • "UNCONFIRMED"
          • "CONFIRMED"
          • "ARCHIVED"
          • "COMPROMISED"
          • "UNKNOWN"
          • "RESET_REQUIRED"
          • "FORCE_CHANGE_PASSWORD"
          • "EXTERNAL_PROVIDER"
        • MFAOptions — (Array<map>)

          The MFA options for the user.

          • DeliveryMedium — (String)

            The delivery medium to send the MFA code. You can use this parameter to set only the SMS delivery medium value.

            Possible values include:
            • "SMS"
            • "EMAIL"
          • AttributeName — (String)

            The attribute name of the MFA option type. The only valid value is phone_number.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

adminDeleteUser(params = {}, callback) ⇒ AWS.Request

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

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

Learn more

Service Reference:

Examples:

Calling the adminDeleteUser operation

var params = {
  UserPoolId: 'STRING_VALUE', /* required */
  Username: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.adminDeleteUser(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

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

    • Username — (String)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

adminDeleteUserAttributes(params = {}, callback) ⇒ AWS.Request

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

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

Learn more

Service Reference:

Examples:

Calling the adminDeleteUserAttributes operation

var params = {
  UserAttributeNames: [ /* required */
    'STRING_VALUE',
    /* more items */
  ],
  UserPoolId: 'STRING_VALUE', /* required */
  Username: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.adminDeleteUserAttributes(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

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

    • Username — (String)

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

    • UserAttributeNames — (Array<String>)

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

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

adminDisableProviderForUser(params = {}, callback) ⇒ AWS.Request

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

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

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

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

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

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

Learn more

Service Reference:

Examples:

Calling the adminDisableProviderForUser operation

var params = {
  User: { /* required */
    ProviderAttributeName: 'STRING_VALUE',
    ProviderAttributeValue: 'STRING_VALUE',
    ProviderName: 'STRING_VALUE'
  },
  UserPoolId: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.adminDisableProviderForUser(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

      The user pool ID for the user pool.

    • User — (map)

      The user to be disabled.

      • ProviderName — (String)

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

      • ProviderAttributeName — (String)

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

      • ProviderAttributeValue — (String)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

adminDisableUser(params = {}, callback) ⇒ AWS.Request

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

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

Learn more

Service Reference:

Examples:

Calling the adminDisableUser operation

var params = {
  UserPoolId: 'STRING_VALUE', /* required */
  Username: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.adminDisableUser(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

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

    • Username — (String)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

adminEnableUser(params = {}, callback) ⇒ AWS.Request

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

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

Learn more

Service Reference:

Examples:

Calling the adminEnableUser operation

var params = {
  UserPoolId: 'STRING_VALUE', /* required */
  Username: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.adminEnableUser(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

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

    • Username — (String)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

adminForgetDevice(params = {}, callback) ⇒ AWS.Request

Forgets the device, as an administrator.

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

Learn more

Service Reference:

Examples:

Calling the adminForgetDevice operation

var params = {
  DeviceKey: 'STRING_VALUE', /* required */
  UserPoolId: 'STRING_VALUE', /* required */
  Username: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.adminForgetDevice(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

      The user pool ID.

    • Username — (String)

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

    • DeviceKey — (String)

      The device key.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

adminGetDevice(params = {}, callback) ⇒ AWS.Request

Gets the device, as an administrator.

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

Learn more

Service Reference:

Examples:

Calling the adminGetDevice operation

var params = {
  DeviceKey: 'STRING_VALUE', /* required */
  UserPoolId: 'STRING_VALUE', /* required */
  Username: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.adminGetDevice(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • DeviceKey — (String)

      The device key.

    • UserPoolId — (String)

      The user pool ID.

    • Username — (String)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Device — (map)

        The device.

        • DeviceKey — (String)

          The device key.

        • DeviceAttributes — (Array<map>)

          The device attributes.

          • Namerequired — (String)

            The name of the attribute.

          • Value — (String)

            The value of the attribute.

        • DeviceCreateDate — (Date)

          The creation date of the device.

        • DeviceLastModifiedDate — (Date)

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

        • DeviceLastAuthenticatedDate — (Date)

          The date when the device was last authenticated.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

adminGetUser(params = {}, callback) ⇒ AWS.Request

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

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

Learn more

Service Reference:

Examples:

Calling the adminGetUser operation

var params = {
  UserPoolId: 'STRING_VALUE', /* required */
  Username: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.adminGetUser(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

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

    • Username — (String)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Username — (String)

        The username of the user that you requested.

      • UserAttributes — (Array<map>)

        An array of name-value pairs representing user attributes.

        • Namerequired — (String)

          The name of the attribute.

        • Value — (String)

          The value of the attribute.

      • UserCreateDate — (Date)

        The date the user was created.

      • UserLastModifiedDate — (Date)

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

      • Enabled — (Boolean)

        Indicates that the status is enabled.

      • UserStatus — (String)

        The user status. Can be one of the following:

        • UNCONFIRMED - User has been created but not confirmed.

        • CONFIRMED - User has been confirmed.

        • UNKNOWN - User status isn't known.

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

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

        Possible values include:
        • "UNCONFIRMED"
        • "CONFIRMED"
        • "ARCHIVED"
        • "COMPROMISED"
        • "UNKNOWN"
        • "RESET_REQUIRED"
        • "FORCE_CHANGE_PASSWORD"
        • "EXTERNAL_PROVIDER"
      • MFAOptions — (Array<map>)

        This response parameter is no longer supported. It provides information only about SMS MFA configurations. It doesn't provide information about time-based one-time password (TOTP) software token MFA configurations. To look up information about either type of MFA configuration, use UserMFASettingList instead.

        • DeliveryMedium — (String)

          The delivery medium to send the MFA code. You can use this parameter to set only the SMS delivery medium value.

          Possible values include:
          • "SMS"
          • "EMAIL"
        • AttributeName — (String)

          The attribute name of the MFA option type. The only valid value is phone_number.

      • PreferredMfaSetting — (String)

        The user's preferred MFA setting.

      • UserMFASettingList — (Array<String>)

        The MFA options that are activated for the user. The possible values in this list are SMS_MFA and SOFTWARE_TOKEN_MFA.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

adminInitiateAuth(params = {}, callback) ⇒ AWS.Request

Initiates the authentication flow, as an administrator.

Note: This action might generate an SMS text message. Starting June 1, 2021, US telecom carriers require you to register an origination phone number before you can send SMS messages to US phone numbers. If you use SMS text messages in Amazon Cognito, you must register a phone number with Amazon Pinpoint. Amazon Cognito uses the registered number automatically. Otherwise, Amazon Cognito users who must receive SMS messages might not be able to sign up, activate their accounts, or sign in. If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Services service, Amazon Simple Notification Service might place your account in the SMS sandbox. In sandbox mode , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see SMS message settings for Amazon Cognito user pools in the Amazon Cognito Developer Guide.
Note: Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding IAM permission in a policy.

Learn more

Service Reference:

Examples:

Calling the adminInitiateAuth operation

var params = {
  AuthFlow: USER_SRP_AUTH | REFRESH_TOKEN_AUTH | REFRESH_TOKEN | CUSTOM_AUTH | ADMIN_NO_SRP_AUTH | USER_PASSWORD_AUTH | ADMIN_USER_PASSWORD_AUTH, /* required */
  ClientId: 'STRING_VALUE', /* required */
  UserPoolId: 'STRING_VALUE', /* required */
  AnalyticsMetadata: {
    AnalyticsEndpointId: 'STRING_VALUE'
  },
  AuthParameters: {
    '<StringType>': 'STRING_VALUE',
    /* '<StringType>': ... */
  },
  ClientMetadata: {
    '<StringType>': 'STRING_VALUE',
    /* '<StringType>': ... */
  },
  ContextData: {
    HttpHeaders: [ /* required */
      {
        headerName: 'STRING_VALUE',
        headerValue: 'STRING_VALUE'
      },
      /* more items */
    ],
    IpAddress: 'STRING_VALUE', /* required */
    ServerName: 'STRING_VALUE', /* required */
    ServerPath: 'STRING_VALUE', /* required */
    EncodedData: 'STRING_VALUE'
  }
};
cognitoidentityserviceprovider.adminInitiateAuth(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

      The ID of the Amazon Cognito user pool.

    • ClientId — (String)

      The app client ID.

    • AuthFlow — (String)

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

      • REFRESH_TOKEN_AUTH will take in a valid refresh token and return new tokens.

      • USER_SRP_AUTH will take in USERNAME and SRP_A and return the Secure Remote Password (SRP) protocol variables to be used for next challenge execution.

      • ADMIN_USER_PASSWORD_AUTH will take in USERNAME and PASSWORD and return the next challenge or tokens.

      Valid values include:

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

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

      • CUSTOM_AUTH: Custom authentication flow.

      • ADMIN_NO_SRP_AUTH: Non-SRP authentication flow; you can pass in the USERNAME and PASSWORD directly if the flow is enabled for calling the app client.

      • ADMIN_USER_PASSWORD_AUTH: Admin-based user password authentication. This replaces the ADMIN_NO_SRP_AUTH authentication flow. In this flow, Amazon Cognito receives the password in the request instead of using the SRP process to verify passwords.

      Possible values include:
      • "USER_SRP_AUTH"
      • "REFRESH_TOKEN_AUTH"
      • "REFRESH_TOKEN"
      • "CUSTOM_AUTH"
      • "ADMIN_NO_SRP_AUTH"
      • "USER_PASSWORD_AUTH"
      • "ADMIN_USER_PASSWORD_AUTH"
    • AuthParameters — (map<String>)

      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 ADMIN_USER_PASSWORD_AUTH: USERNAME (required), PASSWORD (required), SECRET_HASH (required if the app client is configured with a client secret), DEVICE_KEY.

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

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

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

    • ClientMetadata — (map<String>)

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

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

      • Pre signup

      • Pre authentication

      • User migration

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

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

      • Post authentication

      • Custom message

      • Pre token generation

      • Create auth challenge

      • Define auth challenge

      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.
    • AnalyticsMetadata — (map)

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

      • AnalyticsEndpointId — (String)

        The endpoint ID.

    • ContextData — (map)

      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.

      • IpAddressrequired — (String)

        The source IP address of your user's device.

      • ServerNamerequired — (String)

        Your server endpoint where this API is invoked.

      • ServerPathrequired — (String)

        Your server path where this API is invoked.

      • HttpHeadersrequired — (Array<map>)

        HttpHeaders received on your server in same order.

        • headerName — (String)

          The header name.

        • headerValue — (String)

          The header value.

      • EncodedData — (String)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • ChallengeName — (String)

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

        • MFA_SETUP: If MFA is required, users who don't have at least one of the MFA methods set up are presented with an MFA_SETUP challenge. The user must set up at least one MFA type to continue to authenticate.

        • SELECT_MFA_TYPE: Selects the MFA type. Valid MFA options are SMS_MFA for text SMS MFA, and SOFTWARE_TOKEN_MFA for time-based one-time password (TOTP) software token MFA.

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

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

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

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

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

        • ADMIN_NO_SRP_AUTH: This is returned if you must authenticate with USERNAME and PASSWORD directly. An app client must be enabled to use this flow.

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

          Note: In a NEW_PASSWORD_REQUIRED challenge response, you can't modify a required attribute that already has a value. In AdminRespondToAuthChallenge, set a value for any keys that Amazon Cognito returned in the requiredAttributes parameter, then use the AdminUpdateUserAttributes API operation to modify the value of any additional attributes.
        • MFA_SETUP: For users who are required to set up an MFA factor before they can sign in. The MFA types activated for the user pool will be listed in the challenge parameters MFAS_CAN_SETUP value.

          To set up software token MFA, use the session returned here from InitiateAuth as an input to AssociateSoftwareToken, and use the session returned by VerifySoftwareToken as an input to RespondToAuthChallenge with challenge name MFA_SETUP to complete sign-in. To set up SMS MFA, users will need help from an administrator to add a phone number to their account and then call InitiateAuth again to restart sign-in.

        Possible values include:
        • "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)

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

      • ChallengeParameters — (map<String>)

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

        All challenges require USERNAME and SECRET_HASH (if applicable).

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

      • AuthenticationResult — (map)

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

        • AccessToken — (String)

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

        • ExpiresIn — (Integer)

          The expiration period of the authentication result in seconds.

        • TokenType — (String)

          The token type.

        • RefreshToken — (String)

          The refresh token.

        • IdToken — (String)

          The ID token.

        • NewDeviceMetadata — (map)

          The new device metadata from an authentication result.

          • DeviceKey — (String)

            The device key.

          • DeviceGroupKey — (String)

            The device group key.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

adminLinkProviderForUser(params = {}, callback) ⇒ AWS.Request

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

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

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

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

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

Learn more

Service Reference:

Examples:

Calling the adminLinkProviderForUser operation

var params = {
  DestinationUser: { /* required */
    ProviderAttributeName: 'STRING_VALUE',
    ProviderAttributeValue: 'STRING_VALUE',
    ProviderName: 'STRING_VALUE'
  },
  SourceUser: { /* required */
    ProviderAttributeName: 'STRING_VALUE',
    ProviderAttributeValue: 'STRING_VALUE',
    ProviderName: 'STRING_VALUE'
  },
  UserPoolId: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.adminLinkProviderForUser(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

      The user pool ID for the user pool.

    • DestinationUser — (map)

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

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

      The ProviderAttributeName of the DestinationUser is ignored.

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

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

      • ProviderName — (String)

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

      • ProviderAttributeName — (String)

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

      • ProviderAttributeValue — (String)

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

    • SourceUser — (map)

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

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

      For OIDC, the ProviderAttributeName can be any value that matches a claim in the ID token, or that your app retrieves from the userInfo endpoint. You must map the claim to a user pool attribute in your IdP configuration, and set the user pool attribute name as the value of ProviderAttributeName in your AdminLinkProviderForUser request.

      For SAML, the ProviderAttributeName can be any value that matches a claim in the SAML assertion. To link SAML users based on the subject of the SAML assertion, map the subject to a claim through the SAML IdP and set that claim name as the value of ProviderAttributeName in your AdminLinkProviderForUser request.

      For both OIDC and SAML users, when you set ProviderAttributeName to Cognito_Subject, Amazon Cognito will automatically parse the default unique identifier found in the subject from the IdP token.

      • ProviderName — (String)

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

      • ProviderAttributeName — (String)

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

      • ProviderAttributeValue — (String)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

adminListDevices(params = {}, callback) ⇒ AWS.Request

Lists devices, as an administrator.

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

Learn more

Service Reference:

Examples:

Calling the adminListDevices operation

var params = {
  UserPoolId: 'STRING_VALUE', /* required */
  Username: 'STRING_VALUE', /* required */
  Limit: 'NUMBER_VALUE',
  PaginationToken: 'STRING_VALUE'
};
cognitoidentityserviceprovider.adminListDevices(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

      The user pool ID.

    • Username — (String)

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

    • Limit — (Integer)

      The limit of the devices request.

    • PaginationToken — (String)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Devices — (Array<map>)

        The devices in the list of devices response.

        • DeviceKey — (String)

          The device key.

        • DeviceAttributes — (Array<map>)

          The device attributes.

          • Namerequired — (String)

            The name of the attribute.

          • Value — (String)

            The value of the attribute.

        • DeviceCreateDate — (Date)

          The creation date of the device.

        • DeviceLastModifiedDate — (Date)

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

        • DeviceLastAuthenticatedDate — (Date)

          The date when the device was last authenticated.

      • PaginationToken — (String)

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

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

adminListGroupsForUser(params = {}, callback) ⇒ AWS.Request

Lists the groups that a user belongs to.

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

Learn more

Service Reference:

Examples:

Calling the adminListGroupsForUser operation

var params = {
  UserPoolId: 'STRING_VALUE', /* required */
  Username: 'STRING_VALUE', /* required */
  Limit: 'NUMBER_VALUE',
  NextToken: 'STRING_VALUE'
};
cognitoidentityserviceprovider.adminListGroupsForUser(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • Username — (String)

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

    • UserPoolId — (String)

      The user pool ID for the user pool.

    • Limit — (Integer)

      The limit of the request to list groups.

    • NextToken — (String)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Groups — (Array<map>)

        The groups that the user belongs to.

        • GroupName — (String)

          The name of the group.

        • UserPoolId — (String)

          The user pool ID for the user pool.

        • Description — (String)

          A string containing the description of the group.

        • RoleArn — (String)

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

        • Precedence — (Integer)

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

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

          The default Precedence value is null.

        • LastModifiedDate — (Date)

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

        • CreationDate — (Date)

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

      • NextToken — (String)

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

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

adminListUserAuthEvents(params = {}, callback) ⇒ AWS.Request

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

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

Learn more

Service Reference:

Examples:

Calling the adminListUserAuthEvents operation

var params = {
  UserPoolId: 'STRING_VALUE', /* required */
  Username: 'STRING_VALUE', /* required */
  MaxResults: 'NUMBER_VALUE',
  NextToken: 'STRING_VALUE'
};
cognitoidentityserviceprovider.adminListUserAuthEvents(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

      The user pool ID.

    • Username — (String)

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

    • MaxResults — (Integer)

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

    • NextToken — (String)

      A pagination token.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • AuthEvents — (Array<map>)

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

        • EventId — (String)

          The event ID.

        • EventType — (String)

          The event type.

          Possible values include:
          • "SignIn"
          • "SignUp"
          • "ForgotPassword"
          • "PasswordChange"
          • "ResendCode"
        • CreationDate — (Date)

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

        • EventResponse — (String)

          The event response.

          Possible values include:
          • "Pass"
          • "Fail"
          • "InProgress"
        • EventRisk — (map)

          The event risk.

          • RiskDecision — (String)

            The risk decision.

            Possible values include:
            • "NoRisk"
            • "AccountTakeover"
            • "Block"
          • RiskLevel — (String)

            The risk level.

            Possible values include:
            • "Low"
            • "Medium"
            • "High"
          • CompromisedCredentialsDetected — (Boolean)

            Indicates whether compromised credentials were detected during an authentication event.

        • ChallengeResponses — (Array<map>)

          The challenge responses.

          • ChallengeName — (String)

            The challenge name.

            Possible values include:
            • "Password"
            • "Mfa"
          • ChallengeResponse — (String)

            The challenge response.

            Possible values include:
            • "Success"
            • "Failure"
        • EventContextData — (map)

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

          • IpAddress — (String)

            The source IP address of your user's device.

          • DeviceName — (String)

            The user's device name.

          • Timezone — (String)

            The user's time zone.

          • City — (String)

            The user's city.

          • Country — (String)

            The user's country.

        • EventFeedback — (map)

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

          • FeedbackValuerequired — (String)

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

            Possible values include:
            • "Valid"
            • "Invalid"
          • Providerrequired — (String)

            The provider.

          • FeedbackDate — (Date)

            The event feedback date.

      • NextToken — (String)

        A pagination token.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

adminRemoveUserFromGroup(params = {}, callback) ⇒ AWS.Request

Removes the specified user from the specified group.

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

Learn more

Service Reference:

Examples:

Calling the adminRemoveUserFromGroup operation

var params = {
  GroupName: 'STRING_VALUE', /* required */
  UserPoolId: 'STRING_VALUE', /* required */
  Username: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.adminRemoveUserFromGroup(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

      The user pool ID for the user pool.

    • Username — (String)

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

    • GroupName — (String)

      The group name.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

adminResetUserPassword(params = {}, callback) ⇒ AWS.Request

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

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

Note: This action might generate an SMS text message. Starting June 1, 2021, US telecom carriers require you to register an origination phone number before you can send SMS messages to US phone numbers. If you use SMS text messages in Amazon Cognito, you must register a phone number with Amazon Pinpoint. Amazon Cognito uses the registered number automatically. Otherwise, Amazon Cognito users who must receive SMS messages might not be able to sign up, activate their accounts, or sign in. If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Services service, Amazon Simple Notification Service might place your account in the SMS sandbox. In sandbox mode , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see SMS message settings for Amazon Cognito user pools in the Amazon Cognito Developer Guide.

Deactivates a user's password, requiring them to change it. If a user tries to sign in after the API is called, Amazon Cognito responds with a PasswordResetRequiredException error. Your app must then perform the actions that reset your user's password: the forgot-password flow. In addition, if the user pool has phone verification selected and a verified phone number exists for the user, or if email verification is selected and a verified email exists for the user, calling this API will also result in sending a message to the end user with the code to change their password.

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

Learn more

Service Reference:

Examples:

Calling the adminResetUserPassword operation

var params = {
  UserPoolId: 'STRING_VALUE', /* required */
  Username: 'STRING_VALUE', /* required */
  ClientMetadata: {
    '<StringType>': 'STRING_VALUE',
    /* '<StringType>': ... */
  }
};
cognitoidentityserviceprovider.adminResetUserPassword(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

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

    • Username — (String)

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

    • ClientMetadata — (map<String>)

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

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

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

      Note: When you use the ClientMetadata parameter, remember that Amazon Cognito won't do the following:
      • Store the ClientMetadata value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration doesn't include triggers, the ClientMetadata parameter serves no purpose.
      • Validate the ClientMetadata value.
      • Encrypt the ClientMetadata value. Don't use Amazon Cognito to provide sensitive information.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

adminRespondToAuthChallenge(params = {}, callback) ⇒ AWS.Request

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

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

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 Services service, Amazon Simple Notification Service might place your account in the SMS sandbox. In sandbox mode , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see SMS message settings for Amazon Cognito user pools in the Amazon Cognito Developer Guide.
Note: Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding IAM permission in a policy.

Learn more

Service Reference:

Examples:

Calling the adminRespondToAuthChallenge operation

var params = {
  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, /* required */
  ClientId: 'STRING_VALUE', /* required */
  UserPoolId: 'STRING_VALUE', /* required */
  AnalyticsMetadata: {
    AnalyticsEndpointId: 'STRING_VALUE'
  },
  ChallengeResponses: {
    '<StringType>': 'STRING_VALUE',
    /* '<StringType>': ... */
  },
  ClientMetadata: {
    '<StringType>': 'STRING_VALUE',
    /* '<StringType>': ... */
  },
  ContextData: {
    HttpHeaders: [ /* required */
      {
        headerName: 'STRING_VALUE',
        headerValue: 'STRING_VALUE'
      },
      /* more items */
    ],
    IpAddress: 'STRING_VALUE', /* required */
    ServerName: 'STRING_VALUE', /* required */
    ServerPath: 'STRING_VALUE', /* required */
    EncodedData: 'STRING_VALUE'
  },
  Session: 'STRING_VALUE'
};
cognitoidentityserviceprovider.adminRespondToAuthChallenge(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

      The ID of the Amazon Cognito user pool.

    • ClientId — (String)

      The app client ID.

    • ChallengeName — (String)

      The challenge name. For more information, see AdminInitiateAuth.

      Possible values include:
      • "SMS_MFA"
      • "SOFTWARE_TOKEN_MFA"
      • "SELECT_MFA_TYPE"
      • "MFA_SETUP"
      • "PASSWORD_VERIFIER"
      • "CUSTOM_CHALLENGE"
      • "DEVICE_SRP_AUTH"
      • "DEVICE_PASSWORD_VERIFIER"
      • "ADMIN_NO_SRP_AUTH"
      • "NEW_PASSWORD_REQUIRED"
    • ChallengeResponses — (map<String>)

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

      You must provide a SECRET_HASH parameter in all challenge responses to an app client that has a client secret.

      SMS_MFA

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

      PASSWORD_VERIFIER

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

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

      CUSTOM_CHALLENGE

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

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

      NEW_PASSWORD_REQUIRED

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

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

      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

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

      DEVICE_SRP_AUTH

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

      DEVICE_PASSWORD_VERIFIER

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

      MFA_SETUP

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

      SELECT_MFA_TYPE

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

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

    • Session — (String)

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

    • AnalyticsMetadata — (map)

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

      • AnalyticsEndpointId — (String)

        The endpoint ID.

    • ContextData — (map)

      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.

      • IpAddressrequired — (String)

        The source IP address of your user's device.

      • ServerNamerequired — (String)

        Your server endpoint where this API is invoked.

      • ServerPathrequired — (String)

        Your server path where this API is invoked.

      • HttpHeadersrequired — (Array<map>)

        HttpHeaders received on your server in same order.

        • headerName — (String)

          The header name.

        • headerValue — (String)

          The header value.

      • EncodedData — (String)

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

    • ClientMetadata — (map<String>)

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

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

      • pre sign-up

      • custom message

      • post authentication

      • user migration

      • pre token generation

      • define auth challenge

      • create auth challenge

      • verify auth challenge response

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

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

      Note: When you use the ClientMetadata parameter, remember that Amazon Cognito won't do the following:
      • Store the ClientMetadata value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration doesn't include triggers, the ClientMetadata parameter serves no purpose.
      • Validate the ClientMetadata value.
      • Encrypt the ClientMetadata value. Don't use Amazon Cognito to provide sensitive information.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • ChallengeName — (String)

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

        Possible values include:
        • "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)

        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 — (map<String>)

        The challenge parameters. For more information, see AdminInitiateAuth.

      • AuthenticationResult — (map)

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

        • AccessToken — (String)

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

        • ExpiresIn — (Integer)

          The expiration period of the authentication result in seconds.

        • TokenType — (String)

          The token type.

        • RefreshToken — (String)

          The refresh token.

        • IdToken — (String)

          The ID token.

        • NewDeviceMetadata — (map)

          The new device metadata from an authentication result.

          • DeviceKey — (String)

            The device key.

          • DeviceGroupKey — (String)

            The device group key.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

adminSetUserMFAPreference(params = {}, callback) ⇒ AWS.Request

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

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

Learn more

Service Reference:

Examples:

Calling the adminSetUserMFAPreference operation

var params = {
  UserPoolId: 'STRING_VALUE', /* required */
  Username: 'STRING_VALUE', /* required */
  SMSMfaSettings: {
    Enabled: true || false,
    PreferredMfa: true || false
  },
  SoftwareTokenMfaSettings: {
    Enabled: true || false,
    PreferredMfa: true || false
  }
};
cognitoidentityserviceprovider.adminSetUserMFAPreference(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • SMSMfaSettings — (map)

      The SMS text message MFA settings.

      • Enabled — (Boolean)

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

      • PreferredMfa — (Boolean)

        Specifies whether SMS is the preferred MFA method.

    • SoftwareTokenMfaSettings — (map)

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

      • Enabled — (Boolean)

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

      • PreferredMfa — (Boolean)

        Specifies whether software token MFA is the preferred MFA method.

    • Username — (String)

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

    • UserPoolId — (String)

      The user pool ID.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

adminSetUserPassword(params = {}, callback) ⇒ AWS.Request

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

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

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

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

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

Learn more

Service Reference:

Examples:

Calling the adminSetUserPassword operation

var params = {
  Password: 'STRING_VALUE', /* required */
  UserPoolId: 'STRING_VALUE', /* required */
  Username: 'STRING_VALUE', /* required */
  Permanent: true || false
};
cognitoidentityserviceprovider.adminSetUserPassword(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

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

    • Username — (String)

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

    • Password — (String)

      The password for the user.

    • Permanent — (Boolean)

      True if the password is permanent, False if it is temporary.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

adminSetUserSettings(params = {}, callback) ⇒ AWS.Request

This action is no longer supported. You can use it to configure only SMS MFA. You can't use it to configure time-based one-time password (TOTP) software token MFA. To configure either type of MFA, use AdminSetUserMFAPreference instead.

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

Learn more

Service Reference:

Examples:

Calling the adminSetUserSettings operation

var params = {
  MFAOptions: [ /* required */
    {
      AttributeName: 'STRING_VALUE',
      DeliveryMedium: SMS | EMAIL
    },
    /* more items */
  ],
  UserPoolId: 'STRING_VALUE', /* required */
  Username: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.adminSetUserSettings(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

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

    • Username — (String)

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

    • MFAOptions — (Array<map>)

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

      • DeliveryMedium — (String)

        The delivery medium to send the MFA code. You can use this parameter to set only the SMS delivery medium value.

        Possible values include:
        • "SMS"
        • "EMAIL"
      • AttributeName — (String)

        The attribute name of the MFA option type. The only valid value is phone_number.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

adminUpdateAuthEventFeedback(params = {}, callback) ⇒ AWS.Request

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

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

Learn more

Service Reference:

Examples:

Calling the adminUpdateAuthEventFeedback operation

var params = {
  EventId: 'STRING_VALUE', /* required */
  FeedbackValue: Valid | Invalid, /* required */
  UserPoolId: 'STRING_VALUE', /* required */
  Username: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.adminUpdateAuthEventFeedback(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

      The user pool ID.

    • Username — (String)

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

    • EventId — (String)

      The authentication event ID.

    • FeedbackValue — (String)

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

      Possible values include:
      • "Valid"
      • "Invalid"

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

adminUpdateDeviceStatus(params = {}, callback) ⇒ AWS.Request

Updates the device status as an administrator.

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

Learn more

Service Reference:

Examples:

Calling the adminUpdateDeviceStatus operation

var params = {
  DeviceKey: 'STRING_VALUE', /* required */
  UserPoolId: 'STRING_VALUE', /* required */
  Username: 'STRING_VALUE', /* required */
  DeviceRememberedStatus: remembered | not_remembered
};
cognitoidentityserviceprovider.adminUpdateDeviceStatus(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

      The user pool ID.

    • Username — (String)

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

    • DeviceKey — (String)

      The device key.

    • DeviceRememberedStatus — (String)

      The status indicating whether a device has been remembered or not.

      Possible values include:
      • "remembered"
      • "not_remembered"

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

adminUpdateUserAttributes(params = {}, callback) ⇒ AWS.Request

Note: This action might generate an SMS text message. Starting June 1, 2021, US telecom carriers require you to register an origination phone number before you can send SMS messages to US phone numbers. If you use SMS text messages in Amazon Cognito, you must register a phone number with Amazon Pinpoint. Amazon Cognito uses the registered number automatically. Otherwise, Amazon Cognito users who must receive SMS messages might not be able to sign up, activate their accounts, or sign in. If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Services service, Amazon Simple Notification Service might place your account in the SMS sandbox. In sandbox mode , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see SMS message settings for Amazon Cognito user pools in the Amazon Cognito Developer Guide.

Updates the specified user's attributes, including developer attributes, as an administrator. Works on any user. To delete an attribute from your user, submit the attribute in your API request with a blank value.

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

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

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

Learn more

Service Reference:

Examples:

Calling the adminUpdateUserAttributes operation

var params = {
  UserAttributes: [ /* required */
    {
      Name: 'STRING_VALUE', /* required */
      Value: 'STRING_VALUE'
    },
    /* more items */
  ],
  UserPoolId: 'STRING_VALUE', /* required */
  Username: 'STRING_VALUE', /* required */
  ClientMetadata: {
    '<StringType>': 'STRING_VALUE',
    /* '<StringType>': ... */
  }
};
cognitoidentityserviceprovider.adminUpdateUserAttributes(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

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

    • Username — (String)

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

    • UserAttributes — (Array<map>)

      An array of name-value pairs representing user attributes.

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

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

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

      • Namerequired — (String)

        The name of the attribute.

      • Value — (String)

        The value of the attribute.

    • ClientMetadata — (map<String>)

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

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

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

      Note: When you use the ClientMetadata parameter, remember that Amazon Cognito won't do the following:
      • Store the ClientMetadata value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration doesn't include triggers, the ClientMetadata parameter serves no purpose.
      • Validate the ClientMetadata value.
      • Encrypt the ClientMetadata value. Don't use Amazon Cognito to provide sensitive information.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

adminUserGlobalSignOut(params = {}, callback) ⇒ AWS.Request

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

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

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

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

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

Other requests might be valid until your user's token expires.

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

Learn more

Service Reference:

Examples:

Calling the adminUserGlobalSignOut operation

var params = {
  UserPoolId: 'STRING_VALUE', /* required */
  Username: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.adminUserGlobalSignOut(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

      The user pool ID.

    • Username — (String)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

associateSoftwareToken(params = {}, callback) ⇒ AWS.Request

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

Note: Amazon Cognito disassociates an existing software token when you verify the new token in a VerifySoftwareToken API request. If you don't verify the software token and your user pool doesn't require MFA, the user can then authenticate with user name and password credentials alone. If your user pool requires TOTP MFA, Amazon Cognito generates an MFA_SETUP or SOFTWARE_TOKEN_SETUP challenge each time your user signs in. Complete setup with AssociateSoftwareToken and VerifySoftwareToken. After you set up software token MFA for your user, Amazon Cognito generates a SOFTWARE_TOKEN_MFA challenge when they authenticate. Respond to this challenge with your user's TOTP.
Note: Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.

Service Reference:

Examples:

Calling the associateSoftwareToken operation

var params = {
  AccessToken: 'STRING_VALUE',
  Session: 'STRING_VALUE'
};
cognitoidentityserviceprovider.associateSoftwareToken(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • AccessToken — (String)

      A valid access token that Amazon Cognito issued to the user whose software token you want to generate.

    • Session — (String)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • SecretCode — (String)

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

      • Session — (String)

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

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

changePassword(params = {}, callback) ⇒ AWS.Request

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

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

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

Service Reference:

Examples:

Calling the changePassword operation

var params = {
  AccessToken: 'STRING_VALUE', /* required */
  PreviousPassword: 'STRING_VALUE', /* required */
  ProposedPassword: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.changePassword(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • PreviousPassword — (String)

      The old password.

    • ProposedPassword — (String)

      The new password.

    • AccessToken — (String)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

confirmDevice(params = {}, callback) ⇒ AWS.Request

Confirms tracking of the device. This API call is the call that begins device tracking. For more information about device authentication, see Working with user devices in your user pool.

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

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

Service Reference:

Examples:

Calling the confirmDevice operation

var params = {
  AccessToken: 'STRING_VALUE', /* required */
  DeviceKey: 'STRING_VALUE', /* required */
  DeviceName: 'STRING_VALUE',
  DeviceSecretVerifierConfig: {
    PasswordVerifier: 'STRING_VALUE',
    Salt: 'STRING_VALUE'
  }
};
cognitoidentityserviceprovider.confirmDevice(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • AccessToken — (String)

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

    • DeviceKey — (String)

      The device key.

    • DeviceSecretVerifierConfig — (map)

      The configuration of the device secret verifier.

      • PasswordVerifier — (String)

        The password verifier.

      • Salt — (String)

        The salt

    • DeviceName — (String)

      The device name.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • UserConfirmationNecessary — (Boolean)

        Indicates whether the user confirmation must confirm the device response.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

confirmForgotPassword(params = {}, callback) ⇒ AWS.Request

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

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

Service Reference:

Examples:

Calling the confirmForgotPassword operation

var params = {
  ClientId: 'STRING_VALUE', /* required */
  ConfirmationCode: 'STRING_VALUE', /* required */
  Password: 'STRING_VALUE', /* required */
  Username: 'STRING_VALUE', /* required */
  AnalyticsMetadata: {
    AnalyticsEndpointId: 'STRING_VALUE'
  },
  ClientMetadata: {
    '<StringType>': 'STRING_VALUE',
    /* '<StringType>': ... */
  },
  SecretHash: 'STRING_VALUE',
  UserContextData: {
    EncodedData: 'STRING_VALUE',
    IpAddress: 'STRING_VALUE'
  }
};
cognitoidentityserviceprovider.confirmForgotPassword(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • ClientId — (String)

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

    • SecretHash — (String)

      A keyed-hash message authentication code (HMAC) calculated using the secret key of a user pool client and username plus the client ID in the message. For more information about SecretHash, see Computing secret hash values.

    • Username — (String)

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

    • ConfirmationCode — (String)

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

    • Password — (String)

      The new password that your user wants to set.

    • AnalyticsMetadata — (map)

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

      • AnalyticsEndpointId — (String)

        The endpoint ID.

    • UserContextData — (map)

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

      • IpAddress — (String)

        The source IP address of your user's device.

      • EncodedData — (String)

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

    • ClientMetadata — (map<String>)

      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.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

confirmSignUp(params = {}, callback) ⇒ AWS.Request

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

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

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

Service Reference:

Examples:

Calling the confirmSignUp operation

var params = {
  ClientId: 'STRING_VALUE', /* required */
  ConfirmationCode: 'STRING_VALUE', /* required */
  Username: 'STRING_VALUE', /* required */
  AnalyticsMetadata: {
    AnalyticsEndpointId: 'STRING_VALUE'
  },
  ClientMetadata: {
    '<StringType>': 'STRING_VALUE',
    /* '<StringType>': ... */
  },
  ForceAliasCreation: true || false,
  SecretHash: 'STRING_VALUE',
  UserContextData: {
    EncodedData: 'STRING_VALUE',
    IpAddress: 'STRING_VALUE'
  }
};
cognitoidentityserviceprovider.confirmSignUp(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • ClientId — (String)

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

    • SecretHash — (String)

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

    • Username — (String)

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

    • ConfirmationCode — (String)

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

    • ForceAliasCreation — (Boolean)

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

    • AnalyticsMetadata — (map)

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

      • AnalyticsEndpointId — (String)

        The endpoint ID.

    • UserContextData — (map)

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

      • IpAddress — (String)

        The source IP address of your user's device.

      • EncodedData — (String)

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

    • ClientMetadata — (map<String>)

      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.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

createGroup(params = {}, callback) ⇒ AWS.Request

Creates a new group in the specified user pool.

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

Learn more

Service Reference:

Examples:

Calling the createGroup operation

var params = {
  GroupName: 'STRING_VALUE', /* required */
  UserPoolId: 'STRING_VALUE', /* required */
  Description: 'STRING_VALUE',
  Precedence: 'NUMBER_VALUE',
  RoleArn: 'STRING_VALUE'
};
cognitoidentityserviceprovider.createGroup(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • GroupName — (String)

      The name of the group. Must be unique.

    • UserPoolId — (String)

      The user pool ID for the user pool.

    • Description — (String)

      A string containing the description of the group.

    • RoleArn — (String)

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

    • Precedence — (Integer)

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

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

      The default Precedence value is null. The maximum Precedence value is 231-1.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Group — (map)

        The group object for the group.

        • GroupName — (String)

          The name of the group.

        • UserPoolId — (String)

          The user pool ID for the user pool.

        • Description — (String)

          A string containing the description of the group.

        • RoleArn — (String)

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

        • Precedence — (Integer)

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

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

          The default Precedence value is null.

        • LastModifiedDate — (Date)

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

        • CreationDate — (Date)

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

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

createIdentityProvider(params = {}, callback) ⇒ AWS.Request

Adds a configuration and trust relationship between a third-party identity provider (IdP) and a user pool.

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

Learn more

Service Reference:

Examples:

Calling the createIdentityProvider operation

var params = {
  ProviderDetails: { /* required */
    '<StringType>': 'STRING_VALUE',
    /* '<StringType>': ... */
  },
  ProviderName: 'STRING_VALUE', /* required */
  ProviderType: SAML | Facebook | Google | LoginWithAmazon | SignInWithApple | OIDC, /* required */
  UserPoolId: 'STRING_VALUE', /* required */
  AttributeMapping: {
    '<AttributeMappingKeyType>': 'STRING_VALUE',
    /* '<AttributeMappingKeyType>': ... */
  },
  IdpIdentifiers: [
    'STRING_VALUE',
    /* more items */
  ]
};
cognitoidentityserviceprovider.createIdentityProvider(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

      The user pool ID.

    • ProviderName — (String)

      The IdP name.

    • ProviderType — (String)

      The IdP type.

      Possible values include:
      • "SAML"
      • "Facebook"
      • "Google"
      • "LoginWithAmazon"
      • "SignInWithApple"
      • "OIDC"
    • ProviderDetails — (map<String>)

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

      OpenID Connect (OIDC)

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

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

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

      SAML

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

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

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

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

      LoginWithAmazon

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

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

      Google

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

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

      SignInWithApple

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

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

      Facebook

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

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

    • AttributeMapping — (map<String>)

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

    • IdpIdentifiers — (Array<String>)

      A list of IdP identifiers.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • IdentityProvider — (map)

        The newly created IdP object.

        • UserPoolId — (String)

          The user pool ID.

        • ProviderName — (String)

          The IdP name.

        • ProviderType — (String)

          The IdP type.

          Possible values include:
          • "SAML"
          • "Facebook"
          • "Google"
          • "LoginWithAmazon"
          • "SignInWithApple"
          • "OIDC"
        • ProviderDetails — (map<String>)

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

          OpenID Connect (OIDC)

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

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

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

          SAML

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

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

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

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

          LoginWithAmazon

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

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

          Google

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

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

          SignInWithApple

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

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

          Facebook

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

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

        • AttributeMapping — (map<String>)

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

        • IdpIdentifiers — (Array<String>)

          A list of IdP identifiers.

        • LastModifiedDate — (Date)

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

        • CreationDate — (Date)

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

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

createResourceServer(params = {}, callback) ⇒ AWS.Request

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

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

Learn more

Service Reference:

Examples:

Calling the createResourceServer operation

var params = {
  Identifier: 'STRING_VALUE', /* required */
  Name: 'STRING_VALUE', /* required */
  UserPoolId: 'STRING_VALUE', /* required */
  Scopes: [
    {
      ScopeDescription: 'STRING_VALUE', /* required */
      ScopeName: 'STRING_VALUE' /* required */
    },
    /* more items */
  ]
};
cognitoidentityserviceprovider.createResourceServer(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

      The user pool ID for the user pool.

    • Identifier — (String)

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

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

    • Name — (String)

      A friendly name for the resource server.

    • Scopes — (Array<map>)

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

      • ScopeNamerequired — (String)

        The name of the scope.

      • ScopeDescriptionrequired — (String)

        A description of the scope.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • ResourceServer — (map)

        The newly created resource server.

        • UserPoolId — (String)

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

        • Identifier — (String)

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

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

        • Name — (String)

          The name of the resource server.

        • Scopes — (Array<map>)

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

          • ScopeNamerequired — (String)

            The name of the scope.

          • ScopeDescriptionrequired — (String)

            A description of the scope.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

createUserImportJob(params = {}, callback) ⇒ AWS.Request

Creates a user import job.

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

Learn more

Service Reference:

Examples:

Calling the createUserImportJob operation

var params = {
  CloudWatchLogsRoleArn: 'STRING_VALUE', /* required */
  JobName: 'STRING_VALUE', /* required */
  UserPoolId: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.createUserImportJob(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • JobName — (String)

      The job name for the user import job.

    • UserPoolId — (String)

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

    • CloudWatchLogsRoleArn — (String)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • UserImportJob — (map)

        The job object that represents the user import job.

        • JobName — (String)

          The job name for the user import job.

        • JobId — (String)

          The job ID for the user import job.

        • UserPoolId — (String)

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

        • PreSignedUrl — (String)

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

        • CreationDate — (Date)

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

        • StartDate — (Date)

          The date when the user import job was started.

        • CompletionDate — (Date)

          The date when the user import job was completed.

        • Status — (String)

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

          • Created - The job was created but not started.

          • Pending - A transition state. You have started the job, but it has not begun importing users yet.

          • InProgress - The job has started, and users are being imported.

          • Stopping - You have stopped the job, but the job has not stopped importing users yet.

          • Stopped - You have stopped the job, and the job has stopped importing users.

          • Succeeded - The job has completed successfully.

          • Failed - The job has stopped due to an error.

          • Expired - You created a job, but did not start the job within 24-48 hours. All data associated with the job was deleted, and the job can't be started.

          Possible values include:
          • "Created"
          • "Pending"
          • "InProgress"
          • "Stopping"
          • "Expired"
          • "Stopped"
          • "Failed"
          • "Succeeded"
        • CloudWatchLogsRoleArn — (String)

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

        • ImportedUsers — (Integer)

          The number of users that were successfully imported.

        • SkippedUsers — (Integer)

          The number of users that were skipped.

        • FailedUsers — (Integer)

          The number of users that couldn't be imported.

        • CompletionMessage — (String)

          The message returned when the user import job is completed.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

createUserPool(params = {}, callback) ⇒ AWS.Request

Note: This action might generate an SMS text message. Starting June 1, 2021, US telecom carriers require you to register an origination phone number before you can send SMS messages to US phone numbers. If you use SMS text messages in Amazon Cognito, you must register a phone number with Amazon Pinpoint. Amazon Cognito uses the registered number automatically. Otherwise, Amazon Cognito users who must receive SMS messages might not be able to sign up, activate their accounts, or sign in. If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Services service, Amazon Simple Notification Service might place your account in the SMS sandbox. In sandbox mode , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see SMS message settings for Amazon Cognito user pools in the Amazon Cognito Developer Guide.

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

If you don't provide a value for an attribute, Amazon Cognito sets it to its default value.

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

Learn more

Service Reference:

Examples:

Example user pool with email and username sign-in


/* The following example creates a user pool with all configurable properties set to an example value. The resulting user pool allows sign-in with username or email address, has optional MFA, and has a Lambda function assigned to each possible trigger. */

 var params = {
  AccountRecoverySetting: {
   RecoveryMechanisms: [
      {
     Name: "verified_email", 
     Priority: 1
    }
   ]
  }, 
  AdminCreateUserConfig: {
   AllowAdminCreateUserOnly: false, 
   InviteMessageTemplate: {
    EmailMessage: "Your username is {username} and temporary password is {####}.", 
    EmailSubject: "Your sign-in information", 
    SMSMessage: "Your username is {username} and temporary password is {####}."
   }
  }, 
  AliasAttributes: [
     "email"
  ], 
  AutoVerifiedAttributes: [
     "email"
  ], 
  DeletionProtection: "ACTIVE", 
  DeviceConfiguration: {
   ChallengeRequiredOnNewDevice: true, 
   DeviceOnlyRememberedOnUserPrompt: true
  }, 
  EmailConfiguration: {
   ConfigurationSet: "my-test-ses-configuration-set", 
   EmailSendingAccount: "DEVELOPER", 
   From: "support@example.com", 
   ReplyToEmailAddress: "support@example.com", 
   SourceArn: "arn:aws:ses:us-east-1:123456789012:identity/support@example.com"
  }, 
  EmailVerificationMessage: "Your verification code is {####}.", 
  EmailVerificationSubject: "Verify your email address", 
  LambdaConfig: {
   CustomEmailSender: {
    LambdaArn: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", 
    LambdaVersion: "V1_0"
   }, 
   CustomMessage: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", 
   CustomSMSSender: {
    LambdaArn: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", 
    LambdaVersion: "V1_0"
   }, 
   DefineAuthChallenge: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", 
   KMSKeyID: "arn:aws:kms:us-east-1:123456789012:key/a6c4f8e2-0c45-47db-925f-87854bc9e357", 
   PostAuthentication: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", 
   PostConfirmation: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", 
   PreAuthentication: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", 
   PreSignUp: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", 
   PreTokenGeneration: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", 
   UserMigration: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", 
   VerifyAuthChallengeResponse: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction"
  }, 
  MfaConfiguration: "OPTIONAL", 
  Policies: {
   PasswordPolicy: {
    MinimumLength: 6, 
    RequireLowercase: true, 
    RequireNumbers: true, 
    RequireSymbols: true, 
    RequireUppercase: true, 
    TemporaryPasswordValidityDays: 7
   }
  }, 
  PoolName: "my-test-user-pool", 
  Schema: [
     {
    AttributeDataType: "Number", 
    DeveloperOnlyAttribute: true, 
    Mutable: true, 
    Name: "mydev", 
    NumberAttributeConstraints: {
     MaxValue: "99", 
     MinValue: "1"
    }, 
    Required: false, 
    StringAttributeConstraints: {
     MaxLength: "99", 
     MinLength: "1"
    }
   }
  ], 
  SmsAuthenticationMessage: "Your verification code is {####}.", 
  SmsConfiguration: {
   ExternalId: "my-role-external-id", 
   SnsCallerArn: "arn:aws:iam::123456789012:role/service-role/test-cognito-SMS-Role"
  }, 
  SmsVerificationMessage: "Your verification code is {####}.", 
  UserAttributeUpdateSettings: {
   AttributesRequireVerificationBeforeUpdate: [
      "email"
   ]
  }, 
  UserPoolAddOns: {
   AdvancedSecurityMode: "OFF"
  }, 
  UserPoolTags: {
   "my-test-tag-key": "my-test-tag-key"
  }, 
  UsernameConfiguration: {
   CaseSensitive: true
  }, 
  VerificationMessageTemplate: {
   DefaultEmailOption: "CONFIRM_WITH_CODE", 
   EmailMessage: "Your confirmation code is {####}", 
   EmailMessageByLink: "Choose this link to {##verify your email##}", 
   EmailSubject: "Here is your confirmation code", 
   EmailSubjectByLink: "Here is your confirmation link", 
   SmsMessage: "Your confirmation code is {####}"
  }
 };
 cognitoidentityserviceprovider.createUserPool(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    UserPool: {
     AccountRecoverySetting: {
      RecoveryMechanisms: [
         {
        Name: "verified_email", 
        Priority: 1
       }
      ]
     }, 
     AdminCreateUserConfig: {
      AllowAdminCreateUserOnly: false, 
      InviteMessageTemplate: {
       EmailMessage: "Your username is {username} and temporary password is {####}.", 
       EmailSubject: "Your sign-in information", 
       SMSMessage: "Your username is {username} and temporary password is {####}."
      }, 
      UnusedAccountValidityDays: 7
     }, 
     AliasAttributes: [
        "email"
     ], 
     Arn: "arn:aws:cognito-idp:us-east-1:123456789012:userpool/us-east-1_EXAMPLE", 
     AutoVerifiedAttributes: [
        "email"
     ], 
     CreationDate: <Date Representation>, 
     DeletionProtection: "ACTIVE", 
     DeviceConfiguration: {
      ChallengeRequiredOnNewDevice: true, 
      DeviceOnlyRememberedOnUserPrompt: true
     }, 
     EmailConfiguration: {
      ConfigurationSet: "my-test-ses-configuration-set", 
      EmailSendingAccount: "DEVELOPER", 
      From: "support@example.com", 
      ReplyToEmailAddress: "support@example.com", 
      SourceArn: "arn:aws:ses:us-east-1:123456789012:identity/support@example.com"
     }, 
     EmailVerificationMessage: "Your verification code is {####}.", 
     EmailVerificationSubject: "Verify your email address", 
     EstimatedNumberOfUsers: 0, 
     Id: "us-east-1_EXAMPLE", 
     LambdaConfig: {
      CustomEmailSender: {
       LambdaArn: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", 
       LambdaVersion: "V1_0"
      }, 
      CustomMessage: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", 
      CustomSMSSender: {
       LambdaArn: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", 
       LambdaVersion: "V1_0"
      }, 
      DefineAuthChallenge: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", 
      KMSKeyID: "arn:aws:kms:us-east-1:767671399759:key/4d43904c-8edf-4bb4-9fca-fb1a80e41cbe", 
      PostAuthentication: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", 
      PostConfirmation: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", 
      PreAuthentication: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", 
      PreSignUp: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", 
      PreTokenGeneration: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", 
      UserMigration: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", 
      VerifyAuthChallengeResponse: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction"
     }, 
     LastModifiedDate: <Date Representation>, 
     MfaConfiguration: "OPTIONAL", 
     Name: "my-test-user-pool", 
     Policies: {
      PasswordPolicy: {
       MinimumLength: 6, 
       RequireLowercase: true, 
       RequireNumbers: true, 
       RequireSymbols: true, 
       RequireUppercase: true, 
       TemporaryPasswordValidityDays: 7
      }
     }, 
     SchemaAttributes: [
        {
       AttributeDataType: "String", 
       DeveloperOnlyAttribute: false, 
       Mutable: false, 
       Name: "sub", 
       Required: true, 
       StringAttributeConstraints: {
        MaxLength: "2048", 
        MinLength: "1"
       }
      }, 
        {
       AttributeDataType: "String", 
       DeveloperOnlyAttribute: false, 
       Mutable: true, 
       Name: "name", 
       Required: false, 
       StringAttributeConstraints: {
        MaxLength: "2048", 
        MinLength: "0"
       }
      }, 
        {
       AttributeDataType: "String", 
       DeveloperOnlyAttribute: false, 
       Mutable: true, 
       Name: "given_name", 
       Required: false, 
       StringAttributeConstraints: {
        MaxLength: "2048", 
        MinLength: "0"
       }
      }, 
        {
       AttributeDataType: "String", 
       DeveloperOnlyAttribute: false, 
       Mutable: true, 
       Name: "family_name", 
       Required: false, 
       StringAttributeConstraints: {
        MaxLength: "2048", 
        MinLength: "0"
       }
      }, 
        {
       AttributeDataType: "String", 
       DeveloperOnlyAttribute: false, 
       Mutable: true, 
       Name: "middle_name", 
       Required: false, 
       StringAttributeConstraints: {
        MaxLength: "2048", 
        MinLength: "0"
       }
      }, 
        {
       AttributeDataType: "String", 
       DeveloperOnlyAttribute: false, 
       Mutable: true, 
       Name: "nickname", 
       Required: false, 
       StringAttributeConstraints: {
        MaxLength: "2048", 
        MinLength: "0"
       }
      }, 
        {
       AttributeDataType: "String", 
       DeveloperOnlyAttribute: false, 
       Mutable: true, 
       Name: "preferred_username", 
       Required: false, 
       StringAttributeConstraints: {
        MaxLength: "2048", 
        MinLength: "0"
       }
      }, 
        {
       AttributeDataType: "String", 
       DeveloperOnlyAttribute: false, 
       Mutable: true, 
       Name: "profile", 
       Required: false, 
       StringAttributeConstraints: {
        MaxLength: "2048", 
        MinLength: "0"
       }
      }, 
        {
       AttributeDataType: "String", 
       DeveloperOnlyAttribute: false, 
       Mutable: true, 
       Name: "picture", 
       Required: false, 
       StringAttributeConstraints: {
        MaxLength: "2048", 
        MinLength: "0"
       }
      }, 
        {
       AttributeDataType: "String", 
       DeveloperOnlyAttribute: false, 
       Mutable: true, 
       Name: "website", 
       Required: false, 
       StringAttributeConstraints: {
        MaxLength: "2048", 
        MinLength: "0"
       }
      }, 
        {
       AttributeDataType: "String", 
       DeveloperOnlyAttribute: false, 
       Mutable: true, 
       Name: "email", 
       Required: false, 
       StringAttributeConstraints: {
        MaxLength: "2048", 
        MinLength: "0"
       }
      }, 
        {
       AttributeDataType: "Boolean", 
       DeveloperOnlyAttribute: false, 
       Mutable: true, 
       Name: "email_verified", 
       Required: false
      }, 
        {
       AttributeDataType: "String", 
       DeveloperOnlyAttribute: false, 
       Mutable: true, 
       Name: "gender", 
       Required: false, 
       StringAttributeConstraints: {
        MaxLength: "2048", 
        MinLength: "0"
       }
      }, 
        {
       AttributeDataType: "String", 
       DeveloperOnlyAttribute: false, 
       Mutable: true, 
       Name: "birthdate", 
       Required: false, 
       StringAttributeConstraints: {
        MaxLength: "10", 
        MinLength: "10"
       }
      }, 
        {
       AttributeDataType: "String", 
       DeveloperOnlyAttribute: false, 
       Mutable: true, 
       Name: "zoneinfo", 
       Required: false, 
       StringAttributeConstraints: {
        MaxLength: "2048", 
        MinLength: "0"
       }
      }, 
        {
       AttributeDataType: "String", 
       DeveloperOnlyAttribute: false, 
       Mutable: true, 
       Name: "locale", 
       Required: false, 
       StringAttributeConstraints: {
        MaxLength: "2048", 
        MinLength: "0"
       }
      }, 
        {
       AttributeDataType: "String", 
       DeveloperOnlyAttribute: false, 
       Mutable: true, 
       Name: "phone_number", 
       Required: false, 
       StringAttributeConstraints: {
        MaxLength: "2048", 
        MinLength: "0"
       }
      }, 
        {
       AttributeDataType: "Boolean", 
       DeveloperOnlyAttribute: false, 
       Mutable: true, 
       Name: "phone_number_verifie", 
       Required: false
      }, 
        {
       AttributeDataType: "String", 
       DeveloperOnlyAttribute: false, 
       Mutable: true, 
       Name: "address", 
       Required: false, 
       StringAttributeConstraints: {
        MaxLength: "2048", 
        MinLength: "0"
       }
      }, 
        {
       AttributeDataType: "Number", 
       DeveloperOnlyAttribute: false, 
       Mutable: true, 
       Name: "updated_at", 
       NumberAttributeConstraints: {
        MinValue: "0"
       }, 
       Required: false
      }, 
        {
       AttributeDataType: "Number", 
       DeveloperOnlyAttribute: true, 
       Mutable: true, 
       Name: "dev:custom:mydev", 
       NumberAttributeConstraints: {
        MaxValue: "99", 
        MinValue: "1"
       }, 
       Required: false
      }
     ], 
     SmsAuthenticationMessage: "Your verification code is {####}.", 
     SmsConfiguration: {
      ExternalId: "my-role-external-id", 
      SnsCallerArn: "arn:aws:iam::123456789012:role/service-role/test-cognito-SMS-Role", 
      SnsRegion: "us-east-1"
     }, 
     SmsVerificationMessage: "Your verification code is {####}.", 
     UserAttributeUpdateSettings: {
      AttributesRequireVerificationBeforeUpdate: [
         "email"
      ]
     }, 
     UserPoolAddOns: {
      AdvancedSecurityMode: "OFF"
     }, 
     UserPoolTags: {
      "my-test-tag-key": "my-test-tag-value"
     }, 
     UsernameConfiguration: {
      CaseSensitive: true
     }, 
     VerificationMessageTemplate: {
      DefaultEmailOption: "CONFIRM_WITH_CODE", 
      EmailMessage: "Your confirmation code is {####}", 
      EmailMessageByLink: "Choose this link to {##verify your email##}", 
      EmailSubject: "Here is your confirmation code", 
      EmailSubjectByLink: "Here is your confirmation link", 
      SmsMessage: "Your confirmation code is {####}"
     }
    }
   }
   */
 });

Calling the createUserPool operation

var params = {
  PoolName: 'STRING_VALUE', /* required */
  AccountRecoverySetting: {
    RecoveryMechanisms: [
      {
        Name: verified_email | verified_phone_number | admin_only, /* required */
        Priority: 'NUMBER_VALUE' /* required */
      },
      /* more items */
    ]
  },
  AdminCreateUserConfig: {
    AllowAdminCreateUserOnly: true || false,
    InviteMessageTemplate: {
      EmailMessage: 'STRING_VALUE',
      EmailSubject: 'STRING_VALUE',
      SMSMessage: 'STRING_VALUE'
    },
    UnusedAccountValidityDays: 'NUMBER_VALUE'
  },
  AliasAttributes: [
    phone_number | email | preferred_username,
    /* more items */
  ],
  AutoVerifiedAttributes: [
    phone_number | email,
    /* more items */
  ],
  DeletionProtection: ACTIVE | INACTIVE,
  DeviceConfiguration: {
    ChallengeRequiredOnNewDevice: true || false,
    DeviceOnlyRememberedOnUserPrompt: true || false
  },
  EmailConfiguration: {
    ConfigurationSet: 'STRING_VALUE',
    EmailSendingAccount: COGNITO_DEFAULT | DEVELOPER,
    From: 'STRING_VALUE',
    ReplyToEmailAddress: 'STRING_VALUE',
    SourceArn: 'STRING_VALUE'
  },
  EmailVerificationMessage: 'STRING_VALUE',
  EmailVerificationSubject: 'STRING_VALUE',
  LambdaConfig: {
    CreateAuthChallenge: 'STRING_VALUE',
    CustomEmailSender: {
      LambdaArn: 'STRING_VALUE', /* required */
      LambdaVersion: V1_0 /* required */
    },
    CustomMessage: 'STRING_VALUE',
    CustomSMSSender: {
      LambdaArn: 'STRING_VALUE', /* required */
      LambdaVersion: V1_0 /* required */
    },
    DefineAuthChallenge: 'STRING_VALUE',
    KMSKeyID: 'STRING_VALUE',
    PostAuthentication: 'STRING_VALUE',
    PostConfirmation: 'STRING_VALUE',
    PreAuthentication: 'STRING_VALUE',
    PreSignUp: 'STRING_VALUE',
    PreTokenGeneration: 'STRING_VALUE',
    PreTokenGenerationConfig: {
      LambdaArn: 'STRING_VALUE', /* required */
      LambdaVersion: V1_0 | V2_0 /* required */
    },
    UserMigration: 'STRING_VALUE',
    VerifyAuthChallengeResponse: 'STRING_VALUE'
  },
  MfaConfiguration: OFF | ON | OPTIONAL,
  Policies: {
    PasswordPolicy: {
      MinimumLength: 'NUMBER_VALUE',
      PasswordHistorySize: 'NUMBER_VALUE',
      RequireLowercase: true || false,
      RequireNumbers: true || false,
      RequireSymbols: true || false,
      RequireUppercase: true || false,
      TemporaryPasswordValidityDays: 'NUMBER_VALUE'
    }
  },
  Schema: [
    {
      AttributeDataType: String | Number | DateTime | Boolean,
      DeveloperOnlyAttribute: true || false,
      Mutable: true || false,
      Name: 'STRING_VALUE',
      NumberAttributeConstraints: {
        MaxValue: 'STRING_VALUE',
        MinValue: 'STRING_VALUE'
      },
      Required: true || false,
      StringAttributeConstraints: {
        MaxLength: 'STRING_VALUE',
        MinLength: 'STRING_VALUE'
      }
    },
    /* more items */
  ],
  SmsAuthenticationMessage: 'STRING_VALUE',
  SmsConfiguration: {
    SnsCallerArn: 'STRING_VALUE', /* required */
    ExternalId: 'STRING_VALUE',
    SnsRegion: 'STRING_VALUE'
  },
  SmsVerificationMessage: 'STRING_VALUE',
  UserAttributeUpdateSettings: {
    AttributesRequireVerificationBeforeUpdate: [
      phone_number | email,
      /* more items */
    ]
  },
  UserPoolAddOns: {
    AdvancedSecurityMode: OFF | AUDIT | ENFORCED, /* required */
    AdvancedSecurityAdditionalFlows: {
      CustomAuthMode: AUDIT | ENFORCED
    }
  },
  UserPoolTags: {
    '<TagKeysType>': 'STRING_VALUE',
    /* '<TagKeysType>': ... */
  },
  UsernameAttributes: [
    phone_number | email,
    /* more items */
  ],
  UsernameConfiguration: {
    CaseSensitive: true || false /* required */
  },
  VerificationMessageTemplate: {
    DefaultEmailOption: CONFIRM_WITH_LINK | CONFIRM_WITH_CODE,
    EmailMessage: 'STRING_VALUE',
    EmailMessageByLink: 'STRING_VALUE',
    EmailSubject: 'STRING_VALUE',
    EmailSubjectByLink: 'STRING_VALUE',
    SmsMessage: 'STRING_VALUE'
  }
};
cognitoidentityserviceprovider.createUserPool(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • PoolName — (String)

      A string used to name the user pool.

    • Policies — (map)

      The policies associated with the new user pool.

      • PasswordPolicy — (map)

        The password policy.

        • MinimumLength — (Integer)

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

        • RequireUppercase — (Boolean)

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

        • RequireLowercase — (Boolean)

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

        • RequireNumbers — (Boolean)

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

        • RequireSymbols — (Boolean)

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

        • PasswordHistorySize — (Integer)

          The number of previous passwords that you want Amazon Cognito to restrict each user from reusing. Users can't set a password that matches any of n previous passwords, where n is the value of PasswordHistorySize.

          Password history isn't enforced and isn't displayed in DescribeUserPool responses when you set this value to 0 or don't provide it. To activate this setting, advanced security features must be active in your user pool.

        • TemporaryPasswordValidityDays — (Integer)

          The number of days a temporary password is valid in the password policy. If the user doesn't sign in during this time, an administrator must reset their password. Defaults to 7. If you submit a value of 0, Amazon Cognito treats it as a null value and sets TemporaryPasswordValidityDays to its default value.

          Note: When you set TemporaryPasswordValidityDays for a user pool, you can no longer set a value for the legacy UnusedAccountValidityDays parameter in that user pool.
    • DeletionProtection — (String)

      When active, DeletionProtection prevents accidental deletion of your user pool. Before you can delete a user pool that you have protected against deletion, you must deactivate this feature.

      When you try to delete a protected user pool in a DeleteUserPool API request, Amazon Cognito returns an InvalidParameterException error. To delete a protected user pool, send a new DeleteUserPool request after you deactivate deletion protection in an UpdateUserPool API request.

      Possible values include:
      • "ACTIVE"
      • "INACTIVE"
    • LambdaConfig — (map)

      The Lambda trigger configuration information for the new user pool.

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

      For more information on using the Lambda API to add permission, see AddPermission . For adding permission using the CLI, see add-permission .

      • PreSignUp — (String)

        A pre-registration Lambda trigger.

      • CustomMessage — (String)

        A custom Message Lambda trigger.

      • PostConfirmation — (String)

        A post-confirmation Lambda trigger.

      • PreAuthentication — (String)

        A pre-authentication Lambda trigger.

      • PostAuthentication — (String)

        A post-authentication Lambda trigger.

      • DefineAuthChallenge — (String)

        Defines the authentication challenge.

      • CreateAuthChallenge — (String)

        Creates an authentication challenge.

      • VerifyAuthChallengeResponse — (String)

        Verifies the authentication challenge response.

      • PreTokenGeneration — (String)

        The Amazon Resource Name (ARN) of the function that you want to assign to your Lambda trigger.

        Set this parameter for legacy purposes. If you also set an ARN in PreTokenGenerationConfig, its value must be identical to PreTokenGeneration. For new instances of pre token generation triggers, set the LambdaArn of PreTokenGenerationConfig.

        You can set

      • UserMigration — (String)

        The user migration Lambda config type.

      • PreTokenGenerationConfig — (map)

        The detailed configuration of a pre token generation trigger. If you also set an ARN in PreTokenGeneration, its value must be identical to PreTokenGenerationConfig.

        • LambdaVersionrequired — (String)

          The user pool trigger version of the request that Amazon Cognito sends to your Lambda function. Higher-numbered versions add fields that support new features.

          Possible values include:
          • "V1_0"
          • "V2_0"
        • LambdaArnrequired — (String)

          The Amazon Resource Name (ARN) of the function that you want to assign to your Lambda trigger.

          This parameter and the PreTokenGeneration property of LambdaConfig have the same value. For new instances of pre token generation triggers, set LambdaArn.

      • CustomSMSSender — (map)

        A custom SMS sender Lambda trigger.

        • LambdaVersionrequired — (String)

          The user pool trigger version of the request that Amazon Cognito sends to your Lambda function. Higher-numbered versions add fields that support new features.

          You must use a LambdaVersion of V1_0 with a custom sender function.

          Possible values include:
          • "V1_0"
        • LambdaArnrequired — (String)

          The Amazon Resource Name (ARN) of the function that you want to assign to your Lambda trigger.

      • CustomEmailSender — (map)

        A custom email sender Lambda trigger.

        • LambdaVersionrequired — (String)

          The user pool trigger version of the request that Amazon Cognito sends to your Lambda function. Higher-numbered versions add fields that support new features.

          You must use a LambdaVersion of V1_0 with a custom sender function.

          Possible values include:
          • "V1_0"
        • LambdaArnrequired — (String)

          The Amazon Resource Name (ARN) of the function that you want to assign to your Lambda trigger.

      • KMSKeyID — (String)

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

    • AutoVerifiedAttributes — (Array<String>)

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

    • AliasAttributes — (Array<String>)

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

    • UsernameAttributes — (Array<String>)

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

    • SmsVerificationMessage — (String)

      This parameter is no longer used. See VerificationMessageTemplateType.

    • EmailVerificationMessage — (String)

      This parameter is no longer used. See VerificationMessageTemplateType.

    • EmailVerificationSubject — (String)

      This parameter is no longer used. See VerificationMessageTemplateType.

    • VerificationMessageTemplate — (map)

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

      • SmsMessage — (String)

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

      • EmailMessage — (String)

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

      • EmailSubject — (String)

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

      • EmailMessageByLink — (String)

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

      • EmailSubjectByLink — (String)

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

      • DefaultEmailOption — (String)

        The default email option.

        Possible values include:
        • "CONFIRM_WITH_LINK"
        • "CONFIRM_WITH_CODE"
    • SmsAuthenticationMessage — (String)

      A string representing the SMS authentication message.

    • MfaConfiguration — (String)

      Specifies MFA configuration details.

      Possible values include:
      • "OFF"
      • "ON"
      • "OPTIONAL"
    • UserAttributeUpdateSettings — (map)

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

      • AttributesRequireVerificationBeforeUpdate — (Array<String>)

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

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

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

    • DeviceConfiguration — (map)

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

      Note: When you provide a value for any DeviceConfiguration field, you activate the Amazon Cognito device-remembering feature.
      • ChallengeRequiredOnNewDevice — (Boolean)

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

        Note: Whether or not ChallengeRequiredOnNewDevice is true, users who sign in with devices that have not been confirmed or remembered must still provide a second factor in a user pool that requires MFA.
      • DeviceOnlyRememberedOnUserPrompt — (Boolean)

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

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

    • EmailConfiguration — (map)

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

      • SourceArn — (String)

        The ARN of a verified email address or an address from a verified domain in Amazon SES. You can set a SourceArn email from a verified domain only with an API request. You can set a verified email address, but not an address in a verified domain, in the Amazon Cognito console. Amazon Cognito uses the email address that you provide in one of the following ways, depending on the value that you specify for the EmailSendingAccount parameter:

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

        • If you specify DEVELOPER, Amazon Cognito emails your users with this address by calling Amazon SES on your behalf.

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

      • ReplyToEmailAddress — (String)

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

      • EmailSendingAccount — (String)

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

        COGNITO_DEFAULT

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

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

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

        DEVELOPER

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

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

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

        Possible values include:
        • "COGNITO_DEFAULT"
        • "DEVELOPER"
      • From — (String)

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

      • ConfigurationSet — (String)

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

        Event publishing

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

        IP pool management

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

    • SmsConfiguration — (map)

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

      • SnsCallerArnrequired — (String)

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

      • ExternalId — (String)

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

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

      • SnsRegion — (String)

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

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

    • UserPoolTags — (map<String>)

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

    • AdminCreateUserConfig — (map)

      The configuration for AdminCreateUser requests.

      • AllowAdminCreateUserOnly — (Boolean)

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

      • UnusedAccountValidityDays — (Integer)

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

        Note: If you set a value for TemporaryPasswordValidityDays in PasswordPolicy, that value will be used, and UnusedAccountValidityDays will be no longer be an available parameter for that user pool.
      • InviteMessageTemplate — (map)

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

        See also Customizing User Invitation Messages.

        • SMSMessage — (String)

          The message template for SMS messages.

        • EmailMessage — (String)

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

        • EmailSubject — (String)

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

    • Schema — (Array<map>)

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

      • Name — (String)

        The name of your user pool attribute. When you create or update a user pool, adding a schema attribute creates a custom or developer-only attribute. When you add an attribute with a Name value of MyAttribute, Amazon Cognito creates the custom attribute custom:MyAttribute. When DeveloperOnlyAttribute is true, Amazon Cognito creates your attribute as dev:MyAttribute. In an operation that describes a user pool, Amazon Cognito returns this value as value for standard attributes, custom:value for custom attributes, and dev:value for developer-only attributes..

      • AttributeDataType — (String)

        The data format of the values for your attribute. When you choose an AttributeDataType, Amazon Cognito validates the input against the data type. A custom attribute value in your user's ID token is always a string, for example "custom:isMember" : "true" or "custom:YearsAsMember" : "12".

        Possible values include:
        • "String"
        • "Number"
        • "DateTime"
        • "Boolean"
      • DeveloperOnlyAttribute — (Boolean)
        Note: You should use WriteAttributes in the user pool client to control how attributes can be mutated for new use cases instead of using DeveloperOnlyAttribute.

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

      • Mutable — (Boolean)

        Specifies whether the value of the attribute can be changed.

        Any user pool attribute whose value you map from an IdP attribute must be mutable, with a parameter value of true. Amazon Cognito updates mapped attributes when users sign in to your application through an IdP. If an attribute is immutable, Amazon Cognito throws an error when it attempts to update the attribute. For more information, see Specifying Identity Provider Attribute Mappings for Your User Pool.

      • Required — (Boolean)

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

      • NumberAttributeConstraints — (map)

        Specifies the constraints for an attribute of the number type.

        • MinValue — (String)

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

        • MaxValue — (String)

          The maximum length of a number attribute value. Must be a number less than or equal to 21023, represented as a string with a length of 131072 characters or fewer.

      • StringAttributeConstraints — (map)

        Specifies the constraints for an attribute of the string type.

        • MinLength — (String)

          The minimum length.

        • MaxLength — (String)

          The maximum length of a string attribute value. Must be a number less than or equal to 21023, represented as a string with a length of 131072 characters or fewer.

    • UserPoolAddOns — (map)

      User pool add-ons. Contains settings for activation of advanced security features. To log user security information but take no action, set to AUDIT. To configure automatic security responses to risky traffic to your user pool, set to ENFORCED.

      For more information, see Adding advanced security to a user pool.

      • AdvancedSecurityModerequired — (String)

        The operating mode of advanced security features for standard authentication types in your user pool, including username-password and secure remote password (SRP) authentication.

        Possible values include:
        • "OFF"
        • "AUDIT"
        • "ENFORCED"
      • AdvancedSecurityAdditionalFlows — (map)

        Advanced security configuration options for additional authentication types in your user pool, including custom authentication.

    • UsernameConfiguration — (map)

      Case sensitivity on the username input for the selected sign-in option. When case sensitivity is set to False (case insensitive), users can sign in with any combination of capital and lowercase letters. For example, username, USERNAME, or UserName, or for email, email@example.com or EMaiL@eXamplE.Com. For most use cases, set case sensitivity to False (case insensitive) as a best practice. When usernames and email addresses are case insensitive, Amazon Cognito treats any variation in case as the same user, and prevents a case variation from being assigned to the same attribute for a different user.

      This configuration is immutable after you set it. For more information, see UsernameConfigurationType.

      • CaseSensitiverequired — (Boolean)

        Specifies whether user name case sensitivity will be applied for all users in the user pool through Amazon Cognito APIs. For most use cases, set case sensitivity to False (case insensitive) as a best practice. When usernames and email addresses are case insensitive, users can sign in as the same user when they enter a different capitalization of their user name.

        Valid values include:

        True

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

        False

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

    • AccountRecoverySetting — (map)

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

      • RecoveryMechanisms — (Array<map>)

        The list of RecoveryOptionTypes.

        • Priorityrequired — (Integer)

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

        • Namerequired — (String)

          The recovery method for a user.

          Possible values include:
          • "verified_email"
          • "verified_phone_number"
          • "admin_only"

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • UserPool — (map)

        A container for the user pool details.

        • Id — (String)

          The ID of the user pool.

        • Name — (String)

          The name of the user pool.

        • Policies — (map)

          The policies associated with the user pool.

          • PasswordPolicy — (map)

            The password policy.

            • MinimumLength — (Integer)

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

            • RequireUppercase — (Boolean)

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

            • RequireLowercase — (Boolean)

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

            • RequireNumbers — (Boolean)

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

            • RequireSymbols — (Boolean)

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

            • PasswordHistorySize — (Integer)

              The number of previous passwords that you want Amazon Cognito to restrict each user from reusing. Users can't set a password that matches any of n previous passwords, where n is the value of PasswordHistorySize.

              Password history isn't enforced and isn't displayed in DescribeUserPool responses when you set this value to 0 or don't provide it. To activate this setting, advanced security features must be active in your user pool.

            • TemporaryPasswordValidityDays — (Integer)

              The number of days a temporary password is valid in the password policy. If the user doesn't sign in during this time, an administrator must reset their password. Defaults to 7. If you submit a value of 0, Amazon Cognito treats it as a null value and sets TemporaryPasswordValidityDays to its default value.

              Note: When you set TemporaryPasswordValidityDays for a user pool, you can no longer set a value for the legacy UnusedAccountValidityDays parameter in that user pool.
        • DeletionProtection — (String)

          When active, DeletionProtection prevents accidental deletion of your user pool. Before you can delete a user pool that you have protected against deletion, you must deactivate this feature.

          When you try to delete a protected user pool in a DeleteUserPool API request, Amazon Cognito returns an InvalidParameterException error. To delete a protected user pool, send a new DeleteUserPool request after you deactivate deletion protection in an UpdateUserPool API request.

          Possible values include:
          • "ACTIVE"
          • "INACTIVE"
        • LambdaConfig — (map)

          The Lambda triggers associated with the user pool.

          • PreSignUp — (String)

            A pre-registration Lambda trigger.

          • CustomMessage — (String)

            A custom Message Lambda trigger.

          • PostConfirmation — (String)

            A post-confirmation Lambda trigger.

          • PreAuthentication — (String)

            A pre-authentication Lambda trigger.

          • PostAuthentication — (String)

            A post-authentication Lambda trigger.

          • DefineAuthChallenge — (String)

            Defines the authentication challenge.

          • CreateAuthChallenge — (String)

            Creates an authentication challenge.

          • VerifyAuthChallengeResponse — (String)

            Verifies the authentication challenge response.

          • PreTokenGeneration — (String)

            The Amazon Resource Name (ARN) of the function that you want to assign to your Lambda trigger.

            Set this parameter for legacy purposes. If you also set an ARN in PreTokenGenerationConfig, its value must be identical to PreTokenGeneration. For new instances of pre token generation triggers, set the LambdaArn of PreTokenGenerationConfig.

            You can set

          • UserMigration — (String)

            The user migration Lambda config type.

          • PreTokenGenerationConfig — (map)

            The detailed configuration of a pre token generation trigger. If you also set an ARN in PreTokenGeneration, its value must be identical to PreTokenGenerationConfig.

            • LambdaVersionrequired — (String)

              The user pool trigger version of the request that Amazon Cognito sends to your Lambda function. Higher-numbered versions add fields that support new features.

              Possible values include:
              • "V1_0"
              • "V2_0"
            • LambdaArnrequired — (String)

              The Amazon Resource Name (ARN) of the function that you want to assign to your Lambda trigger.

              This parameter and the PreTokenGeneration property of LambdaConfig have the same value. For new instances of pre token generation triggers, set LambdaArn.

          • CustomSMSSender — (map)

            A custom SMS sender Lambda trigger.

            • LambdaVersionrequired — (String)

              The user pool trigger version of the request that Amazon Cognito sends to your Lambda function. Higher-numbered versions add fields that support new features.

              You must use a LambdaVersion of V1_0 with a custom sender function.

              Possible values include:
              • "V1_0"
            • LambdaArnrequired — (String)

              The Amazon Resource Name (ARN) of the function that you want to assign to your Lambda trigger.

          • CustomEmailSender — (map)

            A custom email sender Lambda trigger.

            • LambdaVersionrequired — (String)

              The user pool trigger version of the request that Amazon Cognito sends to your Lambda function. Higher-numbered versions add fields that support new features.

              You must use a LambdaVersion of V1_0 with a custom sender function.

              Possible values include:
              • "V1_0"
            • LambdaArnrequired — (String)

              The Amazon Resource Name (ARN) of the function that you want to assign to your Lambda trigger.

          • KMSKeyID — (String)

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

        • Status — (String)

          This parameter is no longer used.

          Possible values include:
          • "Enabled"
          • "Disabled"
        • LastModifiedDate — (Date)

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

        • CreationDate — (Date)

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

        • SchemaAttributes — (Array<map>)

          A list of the user attributes and their properties in your user pool. The attribute schema contains standard attributes, custom attributes with a custom: prefix, and developer attributes with a dev: prefix. For more information, see User pool attributes.

          Developer-only attributes are a legacy feature of user pools, are read-only to all app clients. You can create and update developer-only attributes only with IAM-authenticated API operations. Use app client read/write permissions instead.

          • Name — (String)

            The name of your user pool attribute. When you create or update a user pool, adding a schema attribute creates a custom or developer-only attribute. When you add an attribute with a Name value of MyAttribute, Amazon Cognito creates the custom attribute custom:MyAttribute. When DeveloperOnlyAttribute is true, Amazon Cognito creates your attribute as dev:MyAttribute. In an operation that describes a user pool, Amazon Cognito returns this value as value for standard attributes, custom:value for custom attributes, and dev:value for developer-only attributes..

          • AttributeDataType — (String)

            The data format of the values for your attribute. When you choose an AttributeDataType, Amazon Cognito validates the input against the data type. A custom attribute value in your user's ID token is always a string, for example "custom:isMember" : "true" or "custom:YearsAsMember" : "12".

            Possible values include:
            • "String"
            • "Number"
            • "DateTime"
            • "Boolean"
          • DeveloperOnlyAttribute — (Boolean)
            Note: You should use WriteAttributes in the user pool client to control how attributes can be mutated for new use cases instead of using DeveloperOnlyAttribute.

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

          • Mutable — (Boolean)

            Specifies whether the value of the attribute can be changed.

            Any user pool attribute whose value you map from an IdP attribute must be mutable, with a parameter value of true. Amazon Cognito updates mapped attributes when users sign in to your application through an IdP. If an attribute is immutable, Amazon Cognito throws an error when it attempts to update the attribute. For more information, see Specifying Identity Provider Attribute Mappings for Your User Pool.

          • Required — (Boolean)

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

          • NumberAttributeConstraints — (map)

            Specifies the constraints for an attribute of the number type.

            • MinValue — (String)

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

            • MaxValue — (String)

              The maximum length of a number attribute value. Must be a number less than or equal to 21023, represented as a string with a length of 131072 characters or fewer.

          • StringAttributeConstraints — (map)

            Specifies the constraints for an attribute of the string type.

            • MinLength — (String)

              The minimum length.

            • MaxLength — (String)

              The maximum length of a string attribute value. Must be a number less than or equal to 21023, represented as a string with a length of 131072 characters or fewer.

        • AutoVerifiedAttributes — (Array<String>)

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

        • AliasAttributes — (Array<String>)

          The attributes that are aliased in a user pool.

        • UsernameAttributes — (Array<String>)

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

        • SmsVerificationMessage — (String)

          This parameter is no longer used. See VerificationMessageTemplateType.

        • EmailVerificationMessage — (String)

          This parameter is no longer used. See VerificationMessageTemplateType.

        • EmailVerificationSubject — (String)

          This parameter is no longer used. See VerificationMessageTemplateType.

        • VerificationMessageTemplate — (map)

          The template for verification messages.

          • SmsMessage — (String)

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

          • EmailMessage — (String)

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

          • EmailSubject — (String)

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

          • EmailMessageByLink — (String)

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

          • EmailSubjectByLink — (String)

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

          • DefaultEmailOption — (String)

            The default email option.

            Possible values include:
            • "CONFIRM_WITH_LINK"
            • "CONFIRM_WITH_CODE"
        • SmsAuthenticationMessage — (String)

          The contents of the SMS authentication message.

        • UserAttributeUpdateSettings — (map)

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

          • AttributesRequireVerificationBeforeUpdate — (Array<String>)

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

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

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

        • MfaConfiguration — (String)

          Can be one of the following values:

          • OFF - MFA tokens aren't required and can't be specified during user registration.

          • ON - MFA tokens are required for all user registrations. You can only specify required when you're initially creating a user pool.

          • OPTIONAL - Users have the option when registering to create an MFA token.

          Possible values include:
          • "OFF"
          • "ON"
          • "OPTIONAL"
        • DeviceConfiguration — (map)

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

          Note: When you provide a value for any DeviceConfiguration field, you activate the Amazon Cognito device-remembering feature.
          • ChallengeRequiredOnNewDevice — (Boolean)

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

            Note: Whether or not ChallengeRequiredOnNewDevice is true, users who sign in with devices that have not been confirmed or remembered must still provide a second factor in a user pool that requires MFA.
          • DeviceOnlyRememberedOnUserPrompt — (Boolean)

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

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

        • EstimatedNumberOfUsers — (Integer)

          A number estimating the size of the user pool.

        • EmailConfiguration — (map)

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

          • SourceArn — (String)

            The ARN of a verified email address or an address from a verified domain in Amazon SES. You can set a SourceArn email from a verified domain only with an API request. You can set a verified email address, but not an address in a verified domain, in the Amazon Cognito console. Amazon Cognito uses the email address that you provide in one of the following ways, depending on the value that you specify for the EmailSendingAccount parameter:

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

            • If you specify DEVELOPER, Amazon Cognito emails your users with this address by calling Amazon SES on your behalf.

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

          • ReplyToEmailAddress — (String)

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

          • EmailSendingAccount — (String)

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

            COGNITO_DEFAULT

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

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

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

            DEVELOPER

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

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

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

            Possible values include:
            • "COGNITO_DEFAULT"
            • "DEVELOPER"
          • From — (String)

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

          • ConfigurationSet — (String)

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

            Event publishing

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

            IP pool management

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

        • SmsConfiguration — (map)

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

          • SnsCallerArnrequired — (String)

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

          • ExternalId — (String)

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

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

          • SnsRegion — (String)

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

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

        • UserPoolTags — (map<String>)

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

        • SmsConfigurationFailure — (String)

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

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

          InvalidSmsRoleAccessPolicyException

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

          SNSSandbox

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

        • EmailConfigurationFailure — (String)

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

        • Domain — (String)

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

        • CustomDomain — (String)

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

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

        • AdminCreateUserConfig — (map)

          The configuration for AdminCreateUser requests.

          • AllowAdminCreateUserOnly — (Boolean)

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

          • UnusedAccountValidityDays — (Integer)

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

            Note: If you set a value for TemporaryPasswordValidityDays in PasswordPolicy, that value will be used, and UnusedAccountValidityDays will be no longer be an available parameter for that user pool.
          • InviteMessageTemplate — (map)

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

            See also Customizing User Invitation Messages.

            • SMSMessage — (String)

              The message template for SMS messages.

            • EmailMessage — (String)

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

            • EmailSubject — (String)

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

        • UserPoolAddOns — (map)

          User pool add-ons. Contains settings for activation of advanced security features. To log user security information but take no action, set to AUDIT. To configure automatic security responses to risky traffic to your user pool, set to ENFORCED.

          For more information, see Adding advanced security to a user pool.

          • AdvancedSecurityModerequired — (String)

            The operating mode of advanced security features for standard authentication types in your user pool, including username-password and secure remote password (SRP) authentication.

            Possible values include:
            • "OFF"
            • "AUDIT"
            • "ENFORCED"
          • AdvancedSecurityAdditionalFlows — (map)

            Advanced security configuration options for additional authentication types in your user pool, including custom authentication.

        • UsernameConfiguration — (map)

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

          • CaseSensitiverequired — (Boolean)

            Specifies whether user name case sensitivity will be applied for all users in the user pool through Amazon Cognito APIs. For most use cases, set case sensitivity to False (case insensitive) as a best practice. When usernames and email addresses are case insensitive, users can sign in as the same user when they enter a different capitalization of their user name.

            Valid values include:

            True

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

            False

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

        • Arn — (String)

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

        • AccountRecoverySetting — (map)

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

          • RecoveryMechanisms — (Array<map>)

            The list of RecoveryOptionTypes.

            • Priorityrequired — (Integer)

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

            • Namerequired — (String)

              The recovery method for a user.

              Possible values include:
              • "verified_email"
              • "verified_phone_number"
              • "admin_only"

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

createUserPoolClient(params = {}, callback) ⇒ AWS.Request

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.

If you don't provide a value for an attribute, Amazon Cognito sets it to its default value.

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

Learn more

Service Reference:

Examples:

Example user pool app client with email and username sign-in


/* The following example creates an app client with all configurable properties set to an example value. The resulting user pool client connects to an analytics client, allows sign-in with username and password, and has two external identity providers associated with it. */

 var params = {
  AccessTokenValidity: 6, 
  AllowedOAuthFlows: [
     "code"
  ], 
  AllowedOAuthFlowsUserPoolClient: true, 
  AllowedOAuthScopes: [
     "aws.cognito.signin.user.admin", 
     "openid"
  ], 
  AnalyticsConfiguration: {
   ApplicationId: "d70b2ba36a8c4dc5a04a0451a31a1e12", 
   ExternalId: "my-external-id", 
   RoleArn: "arn:aws:iam::123456789012:role/test-cognitouserpool-role", 
   UserDataShared: true
  }, 
  CallbackURLs: [
     "https://example.com", 
     "http://localhost", 
     "myapp://example"
  ], 
  ClientName: "my-test-app-client", 
  DefaultRedirectURI: "https://example.com", 
  ExplicitAuthFlows: [
     "ALLOW_ADMIN_USER_PASSWORD_AUTH", 
     "ALLOW_USER_PASSWORD_AUTH", 
     "ALLOW_REFRESH_TOKEN_AUTH"
  ], 
  GenerateSecret: true, 
  IdTokenValidity: 6, 
  LogoutURLs: [
     "https://example.com/logout"
  ], 
  PreventUserExistenceErrors: "ENABLED", 
  ReadAttributes: [
     "email", 
     "address", 
     "preferred_username"
  ], 
  RefreshTokenValidity: 6, 
  SupportedIdentityProviders: [
     "SignInWithApple", 
     "MySSO"
  ], 
  TokenValidityUnits: {
   AccessToken: "hours", 
   IdToken: "minutes", 
   RefreshToken: "days"
  }, 
  UserPoolId: "us-east-1_EXAMPLE", 
  WriteAttributes: [
     "family_name", 
     "email"
  ]
 };
 cognitoidentityserviceprovider.createUserPoolClient(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    UserPoolClient: {
     AccessTokenValidity: 6, 
     AllowedOAuthFlows: [
        "code"
     ], 
     AllowedOAuthFlowsUserPoolClient: true, 
     AllowedOAuthScopes: [
        "aws.cognito.signin.user.admin", 
        "openid"
     ], 
     AnalyticsConfiguration: {
      ApplicationId: "d70b2ba36a8c4dc5a04a0451a31a1e12", 
      ExternalId: "my-external-id", 
      RoleArn: "arn:aws:iam::123456789012:role/test-cognitouserpool-role", 
      UserDataShared: true
     }, 
     AuthSessionValidity: 3, 
     CallbackURLs: [
        "https://example.com", 
        "http://localhost", 
        "myapp://example"
     ], 
     ClientId: "26cb2c60kq7nbmas7rbme9b6pp", 
     ClientName: "my-test-app-client", 
     ClientSecret: "13ka4h7u28d9oo44tqpq9djqsfvhvu8rk4d2ighvpu0k8fj1c2r9", 
     CreationDate: <Date Representation>, 
     DefaultRedirectURI: "https://example.com", 
     EnablePropagateAdditionalUserContextData: false, 
     EnableTokenRevocation: true, 
     ExplicitAuthFlows: [
        "ALLOW_USER_PASSWORD_AUTH", 
        "ALLOW_ADMIN_USER_PASSWORD_AUTH", 
        "ALLOW_REFRESH_TOKEN_AUTH"
     ], 
     IdTokenValidity: 6, 
     LastModifiedDate: <Date Representation>, 
     LogoutURLs: [
        "https://example.com/logout"
     ], 
     PreventUserExistenceErrors: "ENABLED", 
     ReadAttributes: [
        "address", 
        "preferred_username", 
        "email"
     ], 
     RefreshTokenValidity: 6, 
     SupportedIdentityProviders: [
        "SignInWithApple", 
        "MySSO"
     ], 
     TokenValidityUnits: {
      AccessToken: "hours", 
      IdToken: "minutes", 
      RefreshToken: "days"
     }, 
     UserPoolId: "us-east-1_EXAMPLE", 
     WriteAttributes: [
        "family_name", 
        "email"
     ]
    }
   }
   */
 });

Calling the createUserPoolClient operation

var params = {
  ClientName: 'STRING_VALUE', /* required */
  UserPoolId: 'STRING_VALUE', /* required */
  AccessTokenValidity: 'NUMBER_VALUE',
  AllowedOAuthFlows: [
    code | implicit | client_credentials,
    /* more items */
  ],
  AllowedOAuthFlowsUserPoolClient: true || false,
  AllowedOAuthScopes: [
    'STRING_VALUE',
    /* more items */
  ],
  AnalyticsConfiguration: {
    ApplicationArn: 'STRING_VALUE',
    ApplicationId: 'STRING_VALUE',
    ExternalId: 'STRING_VALUE',
    RoleArn: 'STRING_VALUE',
    UserDataShared: true || false
  },
  AuthSessionValidity: 'NUMBER_VALUE',
  CallbackURLs: [
    'STRING_VALUE',
    /* more items */
  ],
  DefaultRedirectURI: 'STRING_VALUE',
  EnablePropagateAdditionalUserContextData: true || false,
  EnableTokenRevocation: true || false,
  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,
    /* more items */
  ],
  GenerateSecret: true || false,
  IdTokenValidity: 'NUMBER_VALUE',
  LogoutURLs: [
    'STRING_VALUE',
    /* more items */
  ],
  PreventUserExistenceErrors: LEGACY | ENABLED,
  ReadAttributes: [
    'STRING_VALUE',
    /* more items */
  ],
  RefreshTokenValidity: 'NUMBER_VALUE',
  SupportedIdentityProviders: [
    'STRING_VALUE',
    /* more items */
  ],
  TokenValidityUnits: {
    AccessToken: seconds | minutes | hours | days,
    IdToken: seconds | minutes | hours | days,
    RefreshToken: seconds | minutes | hours | days
  },
  WriteAttributes: [
    'STRING_VALUE',
    /* more items */
  ]
};
cognitoidentityserviceprovider.createUserPoolClient(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

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

    • ClientName — (String)

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

    • GenerateSecret — (Boolean)

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

    • RefreshTokenValidity — (Integer)

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

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

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

      If you don't specify otherwise in the configuration of your app client, your refresh tokens are valid for 30 days.

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

      If you don't specify otherwise in the configuration of your app client, your access tokens are valid for one hour.

    • 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 IdTokenValidity in an API request is hours. Valid range is displayed below in seconds.

      If you don't specify otherwise in the configuration of your app client, your ID tokens are valid for one hour.

    • TokenValidityUnits — (map)

      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. AccessTokenValidity duration can range from five minutes to one day.

        Possible values include:
        • "seconds"
        • "minutes"
        • "hours"
        • "days"
      • 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. IdTokenValidity duration can range from five minutes to one day.

        Possible values include:
        • "seconds"
        • "minutes"
        • "hours"
        • "days"
      • 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. RefreshTokenValidity duration can range from 60 minutes to 10 years.

        Possible values include:
        • "seconds"
        • "minutes"
        • "hours"
        • "days"
    • ReadAttributes — (Array<String>)

      The list of user attributes that you want your app client to have read-only access to. After your user authenticates in your app, their access token authorizes them to read their own attribute value for any attribute in this list. An example of this kind of activity is when your user selects a link to view their profile information. Your app makes a GetUser API request to retrieve and display your user's profile data.

      When you don't specify the ReadAttributes for your app client, your app can read the values of email_verified, phone_number_verified, and the Standard attributes of your user pool. When your user pool has read access to these default attributes, ReadAttributes doesn't return any information. Amazon Cognito only populates ReadAttributes in the API response if you have specified your own custom set of read attributes.

    • WriteAttributes — (Array<String>)

      The list of user attributes that you want your app client to have write access to. After your user authenticates in your app, their access token authorizes them to set or modify their own attribute value for any attribute in this list. An example of this kind of activity is when you present your user with a form to update their profile information and they change their last name. Your app then makes an UpdateUserAttributes API request and sets family_name to the new value.

      When you don't specify the WriteAttributes for your app client, your app can write the values of the Standard attributes of your user pool. When your user pool has write access to these default attributes, WriteAttributes doesn't return any information. Amazon Cognito only populates WriteAttributes in the API response if you have specified your own custom set of write attributes.

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

    • ExplicitAuthFlows — (Array<String>)

      The authentication flows that you want your user pool client to support. For each app client in your user pool, you can sign in your users with any combination of one or more flows, including with a user name and Secure Remote Password (SRP), a user name and password, or a custom authentication process that you define with Lambda functions.

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

      Valid values include:

      • ALLOW_ADMIN_USER_PASSWORD_AUTH: Enable admin based user password authentication flow ADMIN_USER_PASSWORD_AUTH. This setting replaces the ADMIN_NO_SRP_AUTH setting. With this authentication flow, your app passes a user name and password to Amazon Cognito in the request, instead of using the Secure Remote Password (SRP) protocol to securely transmit the password.

      • ALLOW_CUSTOM_AUTH: Enable Lambda trigger based authentication.

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

      • ALLOW_USER_SRP_AUTH: Enable SRP-based authentication.

      • ALLOW_REFRESH_TOKEN_AUTH: Enable authflow to refresh tokens.

      In some environments, you will see the values ADMIN_NO_SRP_AUTH, CUSTOM_AUTH_FLOW_ONLY, or USER_PASSWORD_AUTH. You can't assign these legacy ExplicitAuthFlows values to user pool clients at the same time as values that begin with ALLOW_, like ALLOW_USER_SRP_AUTH.

    • SupportedIdentityProviders — (Array<String>)

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

    • CallbackURLs — (Array<String>)

      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.

    • LogoutURLs — (Array<String>)

      A list of allowed logout URLs for the IdPs.

    • DefaultRedirectURI — (String)

      The default redirect URI. In app clients with one assigned IdP, replaces redirect_uri in authentication requests. 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.

      For more information, see Default redirect URI.

      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 — (Array<String>)

      The OAuth grant types that you want your app client to generate. To create an app client that generates client credentials grants, you must add client_credentials as the only allowed OAuth flow.

      code

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

      implicit

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

      client_credentials

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

    • AllowedOAuthScopes — (Array<String>)

      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.

    • AllowedOAuthFlowsUserPoolClient — (Boolean)

      Set to true to use OAuth 2.0 features in your user pool app client.

      AllowedOAuthFlowsUserPoolClient must be true before you can configure the following features in your app client.

      • CallBackURLs: Callback URLs.

      • LogoutURLs: Sign-out redirect URLs.

      • AllowedOAuthScopes: OAuth 2.0 scopes.

      • AllowedOAuthFlows: Support for authorization code, implicit, and client credentials OAuth 2.0 grants.

      To use OAuth 2.0 features, configure one of these features in the Amazon Cognito console or set AllowedOAuthFlowsUserPoolClient to true in a CreateUserPoolClient or UpdateUserPoolClient API request. If you don't set a value for AllowedOAuthFlowsUserPoolClient in a request with the CLI or SDKs, it defaults to false.

    • AnalyticsConfiguration — (map)

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

      Note: In Amazon Web Services Regions where Amazon Pinpoint isn't available, user pools only support sending events to Amazon Pinpoint projects in Amazon Web Services Region us-east-1. In Regions where Amazon Pinpoint is available, user pools support sending events to Amazon Pinpoint projects within that same Region.
      • ApplicationId — (String)

        The application ID for an Amazon Pinpoint application.

      • ApplicationArn — (String)

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

      • RoleArn — (String)

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

      • ExternalId — (String)

        The external ID.

      • UserDataShared — (Boolean)

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

    • PreventUserExistenceErrors — (String)

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

      Valid values include:

      • ENABLED - This prevents user existence-related errors.

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

      Defaults to LEGACY when you don't provide a value.

      Possible values include:
      • "LEGACY"
      • "ENABLED"
    • EnableTokenRevocation — (Boolean)

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

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

    • EnablePropagateAdditionalUserContextData — (Boolean)

      Activates the propagation of additional user context data. For more information about propagation of user context data, see Adding advanced security to a user pool. If you don’t include this parameter, you can't send device fingerprint information, including source IP address, to Amazon Cognito advanced security. You can only activate EnablePropagateAdditionalUserContextData in an app client that has a client secret.

    • AuthSessionValidity — (Integer)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • UserPoolClient — (map)

        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 — (Date)

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

        • CreationDate — (Date)

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

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

          If you don't specify otherwise in the configuration of your app client, your refresh tokens are valid for 30 days.

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

          If you don't specify otherwise in the configuration of your app client, your access tokens are valid for one hour.

        • 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 IdTokenValidity in an API request is hours. Valid range is displayed below in seconds.

          If you don't specify otherwise in the configuration of your app client, your ID tokens are valid for one hour.

        • TokenValidityUnits — (map)

          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. AccessTokenValidity duration can range from five minutes to one day.

            Possible values include:
            • "seconds"
            • "minutes"
            • "hours"
            • "days"
          • 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. IdTokenValidity duration can range from five minutes to one day.

            Possible values include:
            • "seconds"
            • "minutes"
            • "hours"
            • "days"
          • 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. RefreshTokenValidity duration can range from 60 minutes to 10 years.

            Possible values include:
            • "seconds"
            • "minutes"
            • "hours"
            • "days"
        • ReadAttributes — (Array<String>)

          The list of user attributes that you want your app client to have read-only access to. After your user authenticates in your app, their access token authorizes them to read their own attribute value for any attribute in this list. An example of this kind of activity is when your user selects a link to view their profile information. Your app makes a GetUser API request to retrieve and display your user's profile data.

          When you don't specify the ReadAttributes for your app client, your app can read the values of email_verified, phone_number_verified, and the Standard attributes of your user pool. When your user pool has read access to these default attributes, ReadAttributes doesn't return any information. Amazon Cognito only populates ReadAttributes in the API response if you have specified your own custom set of read attributes.

        • WriteAttributes — (Array<String>)

          The list of user attributes that you want your app client to have write access to. After your user authenticates in your app, their access token authorizes them to set or modify their own attribute value for any attribute in this list. An example of this kind of activity is when you present your user with a form to update their profile information and they change their last name. Your app then makes an UpdateUserAttributes API request and sets family_name to the new value.

          When you don't specify the WriteAttributes for your app client, your app can write the values of the Standard attributes of your user pool. When your user pool has write access to these default attributes, WriteAttributes doesn't return any information. Amazon Cognito only populates WriteAttributes in the API response if you have specified your own custom set of write attributes.

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

        • ExplicitAuthFlows — (Array<String>)

          The authentication flows that you want your user pool client to support. For each app client in your user pool, you can sign in your users with any combination of one or more flows, including with a user name and Secure Remote Password (SRP), a user name and password, or a custom authentication process that you define with Lambda functions.

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

          Valid values include:

          • ALLOW_ADMIN_USER_PASSWORD_AUTH: Enable admin based user password authentication flow ADMIN_USER_PASSWORD_AUTH. This setting replaces the ADMIN_NO_SRP_AUTH setting. With this authentication flow, your app passes a user name and password to Amazon Cognito in the request, instead of using the Secure Remote Password (SRP) protocol to securely transmit the password.

          • ALLOW_CUSTOM_AUTH: Enable Lambda trigger based authentication.

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

          • ALLOW_USER_SRP_AUTH: Enable SRP-based authentication.

          • ALLOW_REFRESH_TOKEN_AUTH: Enable authflow to refresh tokens.

          In some environments, you will see the values ADMIN_NO_SRP_AUTH, CUSTOM_AUTH_FLOW_ONLY, or USER_PASSWORD_AUTH. You can't assign these legacy ExplicitAuthFlows values to user pool clients at the same time as values that begin with ALLOW_, like ALLOW_USER_SRP_AUTH.

        • SupportedIdentityProviders — (Array<String>)

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

        • CallbackURLs — (Array<String>)

          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.

        • LogoutURLs — (Array<String>)

          A list of allowed logout URLs for the IdPs.

        • 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 — (Array<String>)

          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.

        • AllowedOAuthScopes — (Array<String>)

          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.

        • AllowedOAuthFlowsUserPoolClient — (Boolean)

          Set to true to use OAuth 2.0 features in your user pool app client.

          AllowedOAuthFlowsUserPoolClient must be true before you can configure the following features in your app client.

          • CallBackURLs: Callback URLs.

          • LogoutURLs: Sign-out redirect URLs.

          • AllowedOAuthScopes: OAuth 2.0 scopes.

          • AllowedOAuthFlows: Support for authorization code, implicit, and client credentials OAuth 2.0 grants.

          To use OAuth 2.0 features, configure one of these features in the Amazon Cognito console or set AllowedOAuthFlowsUserPoolClient to true in a CreateUserPoolClient or UpdateUserPoolClient API request. If you don't set a value for AllowedOAuthFlowsUserPoolClient in a request with the CLI or SDKs, it defaults to false.

        • AnalyticsConfiguration — (map)

          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 early behavior of Amazon Cognito where user existence related errors aren't prevented.

          Defaults to LEGACY when you don't provide a value.

          Possible values include:
          • "LEGACY"
          • "ENABLED"
        • EnableTokenRevocation — (Boolean)

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

        • EnablePropagateAdditionalUserContextData — (Boolean)

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

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

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

        • AuthSessionValidity — (Integer)

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

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

createUserPoolDomain(params = {}, callback) ⇒ AWS.Request

Creates a new domain for a user pool.

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

Learn more

Service Reference:

Examples:

Calling the createUserPoolDomain operation

var params = {
  Domain: 'STRING_VALUE', /* required */
  UserPoolId: 'STRING_VALUE', /* required */
  CustomDomainConfig: {
    CertificateArn: 'STRING_VALUE' /* required */
  }
};
cognitoidentityserviceprovider.createUserPoolDomain(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • Domain — (String)

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

    • UserPoolId — (String)

      The user pool ID.

    • CustomDomainConfig — (map)

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

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

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

      • CertificateArnrequired — (String)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • CloudFrontDomain — (String)

        The Amazon CloudFront endpoint that you use as the target of the alias that you set up with your Domain Name Service (DNS) provider. Amazon Cognito returns this value if you set a custom domain with CustomDomainConfig. If you set an Amazon Cognito prefix domain, this operation returns a blank response.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

deleteGroup(params = {}, callback) ⇒ AWS.Request

Deletes a group.

Calling this action requires developer credentials.

Service Reference:

Examples:

Calling the deleteGroup operation

var params = {
  GroupName: 'STRING_VALUE', /* required */
  UserPoolId: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.deleteGroup(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • GroupName — (String)

      The name of the group.

    • UserPoolId — (String)

      The user pool ID for the user pool.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

deleteIdentityProvider(params = {}, callback) ⇒ AWS.Request

Deletes an IdP for a user pool.

Service Reference:

Examples:

Calling the deleteIdentityProvider operation

var params = {
  ProviderName: 'STRING_VALUE', /* required */
  UserPoolId: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.deleteIdentityProvider(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

      The user pool ID.

    • ProviderName — (String)

      The IdP name.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

deleteResourceServer(params = {}, callback) ⇒ AWS.Request

Deletes a resource server.

Service Reference:

Examples:

Calling the deleteResourceServer operation

var params = {
  Identifier: 'STRING_VALUE', /* required */
  UserPoolId: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.deleteResourceServer(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

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

    • Identifier — (String)

      The identifier for the resource server.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

deleteUser(params = {}, callback) ⇒ AWS.Request

Allows a user to delete their own user profile.

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

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

Service Reference:

Examples:

Calling the deleteUser operation

var params = {
  AccessToken: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.deleteUser(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • AccessToken — (String)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

deleteUserAttributes(params = {}, callback) ⇒ AWS.Request

Deletes the attributes for a user.

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

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

Service Reference:

Examples:

Calling the deleteUserAttributes operation

var params = {
  AccessToken: 'STRING_VALUE', /* required */
  UserAttributeNames: [ /* required */
    'STRING_VALUE',
    /* more items */
  ]
};
cognitoidentityserviceprovider.deleteUserAttributes(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserAttributeNames — (Array<String>)

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

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

    • AccessToken — (String)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

deleteUserPool(params = {}, callback) ⇒ AWS.Request

Deletes the specified Amazon Cognito user pool.

Service Reference:

Examples:

Calling the deleteUserPool operation

var params = {
  UserPoolId: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.deleteUserPool(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

deleteUserPoolClient(params = {}, callback) ⇒ AWS.Request

Allows the developer to delete the user pool client.

Service Reference:

Examples:

Calling the deleteUserPoolClient operation

var params = {
  ClientId: 'STRING_VALUE', /* required */
  UserPoolId: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.deleteUserPoolClient(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

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

    • ClientId — (String)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

deleteUserPoolDomain(params = {}, callback) ⇒ AWS.Request

Deletes a domain for a user pool.

Service Reference:

Examples:

Calling the deleteUserPoolDomain operation

var params = {
  Domain: 'STRING_VALUE', /* required */
  UserPoolId: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.deleteUserPoolDomain(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • Domain — (String)

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

    • UserPoolId — (String)

      The user pool ID.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

describeIdentityProvider(params = {}, callback) ⇒ AWS.Request

Gets information about a specific IdP.

Service Reference:

Examples:

Calling the describeIdentityProvider operation

var params = {
  ProviderName: 'STRING_VALUE', /* required */
  UserPoolId: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.describeIdentityProvider(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

      The user pool ID.

    • ProviderName — (String)

      The IdP name.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • IdentityProvider — (map)

        The identity provider details.

        • UserPoolId — (String)

          The user pool ID.

        • ProviderName — (String)

          The IdP name.

        • ProviderType — (String)

          The IdP type.

          Possible values include:
          • "SAML"
          • "Facebook"
          • "Google"
          • "LoginWithAmazon"
          • "SignInWithApple"
          • "OIDC"
        • ProviderDetails — (map<String>)

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

          OpenID Connect (OIDC)

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

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

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

          SAML

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

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

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

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

          LoginWithAmazon

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

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

          Google

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

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

          SignInWithApple

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

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

          Facebook

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

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

        • AttributeMapping — (map<String>)

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

        • IdpIdentifiers — (Array<String>)

          A list of IdP identifiers.

        • LastModifiedDate — (Date)

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

        • CreationDate — (Date)

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

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

describeResourceServer(params = {}, callback) ⇒ AWS.Request

Describes a resource server.

Service Reference:

Examples:

Calling the describeResourceServer operation

var params = {
  Identifier: 'STRING_VALUE', /* required */
  UserPoolId: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.describeResourceServer(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

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

    • Identifier — (String)

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

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • ResourceServer — (map)

        The resource server.

        • UserPoolId — (String)

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

        • Identifier — (String)

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

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

        • Name — (String)

          The name of the resource server.

        • Scopes — (Array<map>)

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

          • ScopeNamerequired — (String)

            The name of the scope.

          • ScopeDescriptionrequired — (String)

            A description of the scope.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

describeRiskConfiguration(params = {}, callback) ⇒ AWS.Request

Describes the risk configuration.

Service Reference:

Examples:

Calling the describeRiskConfiguration operation

var params = {
  UserPoolId: 'STRING_VALUE', /* required */
  ClientId: 'STRING_VALUE'
};
cognitoidentityserviceprovider.describeRiskConfiguration(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

      The user pool ID.

    • ClientId — (String)

      The app client ID.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • RiskConfiguration — (map)

        The risk configuration.

        • UserPoolId — (String)

          The user pool ID.

        • ClientId — (String)

          The app client ID.

        • CompromisedCredentialsRiskConfiguration — (map)

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

          • EventFilter — (Array<String>)

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

          • Actionsrequired — (map)

            The compromised credentials risk configuration actions.

            • EventActionrequired — (String)

              The event action.

              Possible values include:
              • "BLOCK"
              • "NO_ACTION"
        • AccountTakeoverRiskConfiguration — (map)

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

          • NotifyConfiguration — (map)

            The notify configuration used to construct email notifications.

            • From — (String)

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

            • ReplyTo — (String)

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

            • SourceArnrequired — (String)

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

            • BlockEmail — (map)

              Email template used when a detected risk event is blocked.

              • Subjectrequired — (String)

                The email subject.

              • HtmlBody — (String)

                The email HTML body.

              • TextBody — (String)

                The email text body.

            • NoActionEmail — (map)

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

              • Subjectrequired — (String)

                The email subject.

              • HtmlBody — (String)

                The email HTML body.

              • TextBody — (String)

                The email text body.

            • MfaEmail — (map)

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

              • Subjectrequired — (String)

                The email subject.

              • HtmlBody — (String)

                The email HTML body.

              • TextBody — (String)

                The email text body.

          • Actionsrequired — (map)

            Account takeover risk configuration actions.

            • LowAction — (map)

              Action to take for a low risk.

              • Notifyrequired — (Boolean)

                Flag specifying whether to send a notification.

              • EventActionrequired — (String)

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

                • BLOCK Choosing this action will block the request.

                • MFA_IF_CONFIGURED Present an MFA challenge if user has configured it, else allow the request.

                • MFA_REQUIRED Present an MFA challenge if user has configured it, else block the request.

                • NO_ACTION Allow the user to sign in.

                Possible values include:
                • "BLOCK"
                • "MFA_IF_CONFIGURED"
                • "MFA_REQUIRED"
                • "NO_ACTION"
            • MediumAction — (map)

              Action to take for a medium risk.

              • Notifyrequired — (Boolean)

                Flag specifying whether to send a notification.

              • EventActionrequired — (String)

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

                • BLOCK Choosing this action will block the request.

                • MFA_IF_CONFIGURED Present an MFA challenge if user has configured it, else allow the request.

                • MFA_REQUIRED Present an MFA challenge if user has configured it, else block the request.

                • NO_ACTION Allow the user to sign in.

                Possible values include:
                • "BLOCK"
                • "MFA_IF_CONFIGURED"
                • "MFA_REQUIRED"
                • "NO_ACTION"
            • HighAction — (map)

              Action to take for a high risk.

              • Notifyrequired — (Boolean)

                Flag specifying whether to send a notification.

              • EventActionrequired — (String)

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

                • BLOCK Choosing this action will block the request.

                • MFA_IF_CONFIGURED Present an MFA challenge if user has configured it, else allow the request.

                • MFA_REQUIRED Present an MFA challenge if user has configured it, else block the request.

                • NO_ACTION Allow the user to sign in.

                Possible values include:
                • "BLOCK"
                • "MFA_IF_CONFIGURED"
                • "MFA_REQUIRED"
                • "NO_ACTION"
        • RiskExceptionConfiguration — (map)

          The configuration to override the risk decision.

          • BlockedIPRangeList — (Array<String>)

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

          • SkippedIPRangeList — (Array<String>)

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

        • LastModifiedDate — (Date)

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

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

describeUserImportJob(params = {}, callback) ⇒ AWS.Request

Describes the user import job.

Service Reference:

Examples:

Calling the describeUserImportJob operation

var params = {
  JobId: 'STRING_VALUE', /* required */
  UserPoolId: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.describeUserImportJob(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

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

    • JobId — (String)

      The job ID for the user import job.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • UserImportJob — (map)

        The job object that represents the user import job.

        • JobName — (String)

          The job name for the user import job.

        • JobId — (String)

          The job ID for the user import job.

        • UserPoolId — (String)

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

        • PreSignedUrl — (String)

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

        • CreationDate — (Date)

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

        • StartDate — (Date)

          The date when the user import job was started.

        • CompletionDate — (Date)

          The date when the user import job was completed.

        • Status — (String)

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

          • Created - The job was created but not started.

          • Pending - A transition state. You have started the job, but it has not begun importing users yet.

          • InProgress - The job has started, and users are being imported.

          • Stopping - You have stopped the job, but the job has not stopped importing users yet.

          • Stopped - You have stopped the job, and the job has stopped importing users.

          • Succeeded - The job has completed successfully.

          • Failed - The job has stopped due to an error.

          • Expired - You created a job, but did not start the job within 24-48 hours. All data associated with the job was deleted, and the job can't be started.

          Possible values include:
          • "Created"
          • "Pending"
          • "InProgress"
          • "Stopping"
          • "Expired"
          • "Stopped"
          • "Failed"
          • "Succeeded"
        • CloudWatchLogsRoleArn — (String)

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

        • ImportedUsers — (Integer)

          The number of users that were successfully imported.

        • SkippedUsers — (Integer)

          The number of users that were skipped.

        • FailedUsers — (Integer)

          The number of users that couldn't be imported.

        • CompletionMessage — (String)

          The message returned when the user import job is completed.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

describeUserPool(params = {}, callback) ⇒ AWS.Request

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

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

Learn more

Service Reference:

Examples:

Calling the describeUserPool operation

var params = {
  UserPoolId: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.describeUserPool(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • UserPool — (map)

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

        • Id — (String)

          The ID of the user pool.

        • Name — (String)

          The name of the user pool.

        • Policies — (map)

          The policies associated with the user pool.

          • PasswordPolicy — (map)

            The password policy.

            • MinimumLength — (Integer)

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

            • RequireUppercase — (Boolean)

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

            • RequireLowercase — (Boolean)

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

            • RequireNumbers — (Boolean)

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

            • RequireSymbols — (Boolean)

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

            • PasswordHistorySize — (Integer)

              The number of previous passwords that you want Amazon Cognito to restrict each user from reusing. Users can't set a password that matches any of n previous passwords, where n is the value of PasswordHistorySize.

              Password history isn't enforced and isn't displayed in DescribeUserPool responses when you set this value to 0 or don't provide it. To activate this setting, advanced security features must be active in your user pool.

            • TemporaryPasswordValidityDays — (Integer)

              The number of days a temporary password is valid in the password policy. If the user doesn't sign in during this time, an administrator must reset their password. Defaults to 7. If you submit a value of 0, Amazon Cognito treats it as a null value and sets TemporaryPasswordValidityDays to its default value.

              Note: When you set TemporaryPasswordValidityDays for a user pool, you can no longer set a value for the legacy UnusedAccountValidityDays parameter in that user pool.
        • DeletionProtection — (String)

          When active, DeletionProtection prevents accidental deletion of your user pool. Before you can delete a user pool that you have protected against deletion, you must deactivate this feature.

          When you try to delete a protected user pool in a DeleteUserPool API request, Amazon Cognito returns an InvalidParameterException error. To delete a protected user pool, send a new DeleteUserPool request after you deactivate deletion protection in an UpdateUserPool API request.

          Possible values include:
          • "ACTIVE"
          • "INACTIVE"
        • LambdaConfig — (map)

          The Lambda triggers associated with the user pool.

          • PreSignUp — (String)

            A pre-registration Lambda trigger.

          • CustomMessage — (String)

            A custom Message Lambda trigger.

          • PostConfirmation — (String)

            A post-confirmation Lambda trigger.

          • PreAuthentication — (String)

            A pre-authentication Lambda trigger.

          • PostAuthentication — (String)

            A post-authentication Lambda trigger.

          • DefineAuthChallenge — (String)

            Defines the authentication challenge.

          • CreateAuthChallenge — (String)

            Creates an authentication challenge.

          • VerifyAuthChallengeResponse — (String)

            Verifies the authentication challenge response.

          • PreTokenGeneration — (String)

            The Amazon Resource Name (ARN) of the function that you want to assign to your Lambda trigger.

            Set this parameter for legacy purposes. If you also set an ARN in PreTokenGenerationConfig, its value must be identical to PreTokenGeneration. For new instances of pre token generation triggers, set the LambdaArn of PreTokenGenerationConfig.

            You can set

          • UserMigration — (String)

            The user migration Lambda config type.

          • PreTokenGenerationConfig — (map)

            The detailed configuration of a pre token generation trigger. If you also set an ARN in PreTokenGeneration, its value must be identical to PreTokenGenerationConfig.

            • LambdaVersionrequired — (String)

              The user pool trigger version of the request that Amazon Cognito sends to your Lambda function. Higher-numbered versions add fields that support new features.

              Possible values include:
              • "V1_0"
              • "V2_0"
            • LambdaArnrequired — (String)

              The Amazon Resource Name (ARN) of the function that you want to assign to your Lambda trigger.

              This parameter and the PreTokenGeneration property of LambdaConfig have the same value. For new instances of pre token generation triggers, set LambdaArn.

          • CustomSMSSender — (map)

            A custom SMS sender Lambda trigger.

            • LambdaVersionrequired — (String)

              The user pool trigger version of the request that Amazon Cognito sends to your Lambda function. Higher-numbered versions add fields that support new features.

              You must use a LambdaVersion of V1_0 with a custom sender function.

              Possible values include:
              • "V1_0"
            • LambdaArnrequired — (String)

              The Amazon Resource Name (ARN) of the function that you want to assign to your Lambda trigger.

          • CustomEmailSender — (map)

            A custom email sender Lambda trigger.

            • LambdaVersionrequired — (String)

              The user pool trigger version of the request that Amazon Cognito sends to your Lambda function. Higher-numbered versions add fields that support new features.

              You must use a LambdaVersion of V1_0 with a custom sender function.

              Possible values include:
              • "V1_0"
            • LambdaArnrequired — (String)

              The Amazon Resource Name (ARN) of the function that you want to assign to your Lambda trigger.

          • KMSKeyID — (String)

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

        • Status — (String)

          This parameter is no longer used.

          Possible values include:
          • "Enabled"
          • "Disabled"
        • LastModifiedDate — (Date)

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

        • CreationDate — (Date)

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

        • SchemaAttributes — (Array<map>)

          A list of the user attributes and their properties in your user pool. The attribute schema contains standard attributes, custom attributes with a custom: prefix, and developer attributes with a dev: prefix. For more information, see User pool attributes.

          Developer-only attributes are a legacy feature of user pools, are read-only to all app clients. You can create and update developer-only attributes only with IAM-authenticated API operations. Use app client read/write permissions instead.

          • Name — (String)

            The name of your user pool attribute. When you create or update a user pool, adding a schema attribute creates a custom or developer-only attribute. When you add an attribute with a Name value of MyAttribute, Amazon Cognito creates the custom attribute custom:MyAttribute. When DeveloperOnlyAttribute is true, Amazon Cognito creates your attribute as dev:MyAttribute. In an operation that describes a user pool, Amazon Cognito returns this value as value for standard attributes, custom:value for custom attributes, and dev:value for developer-only attributes..

          • AttributeDataType — (String)

            The data format of the values for your attribute. When you choose an AttributeDataType, Amazon Cognito validates the input against the data type. A custom attribute value in your user's ID token is always a string, for example "custom:isMember" : "true" or "custom:YearsAsMember" : "12".

            Possible values include:
            • "String"
            • "Number"
            • "DateTime"
            • "Boolean"
          • DeveloperOnlyAttribute — (Boolean)
            Note: You should use WriteAttributes in the user pool client to control how attributes can be mutated for new use cases instead of using DeveloperOnlyAttribute.

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

          • Mutable — (Boolean)

            Specifies whether the value of the attribute can be changed.

            Any user pool attribute whose value you map from an IdP attribute must be mutable, with a parameter value of true. Amazon Cognito updates mapped attributes when users sign in to your application through an IdP. If an attribute is immutable, Amazon Cognito throws an error when it attempts to update the attribute. For more information, see Specifying Identity Provider Attribute Mappings for Your User Pool.

          • Required — (Boolean)

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

          • NumberAttributeConstraints — (map)

            Specifies the constraints for an attribute of the number type.

            • MinValue — (String)

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

            • MaxValue — (String)

              The maximum length of a number attribute value. Must be a number less than or equal to 21023, represented as a string with a length of 131072 characters or fewer.

          • StringAttributeConstraints — (map)

            Specifies the constraints for an attribute of the string type.

            • MinLength — (String)

              The minimum length.

            • MaxLength — (String)

              The maximum length of a string attribute value. Must be a number less than or equal to 21023, represented as a string with a length of 131072 characters or fewer.

        • AutoVerifiedAttributes — (Array<String>)

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

        • AliasAttributes — (Array<String>)

          The attributes that are aliased in a user pool.

        • UsernameAttributes — (Array<String>)

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

        • SmsVerificationMessage — (String)

          This parameter is no longer used. See VerificationMessageTemplateType.

        • EmailVerificationMessage — (String)

          This parameter is no longer used. See VerificationMessageTemplateType.

        • EmailVerificationSubject — (String)

          This parameter is no longer used. See VerificationMessageTemplateType.

        • VerificationMessageTemplate — (map)

          The template for verification messages.

          • SmsMessage — (String)

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

          • EmailMessage — (String)

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

          • EmailSubject — (String)

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

          • EmailMessageByLink — (String)

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

          • EmailSubjectByLink — (String)

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

          • DefaultEmailOption — (String)

            The default email option.

            Possible values include:
            • "CONFIRM_WITH_LINK"
            • "CONFIRM_WITH_CODE"
        • SmsAuthenticationMessage — (String)

          The contents of the SMS authentication message.

        • UserAttributeUpdateSettings — (map)

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

          • AttributesRequireVerificationBeforeUpdate — (Array<String>)

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

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

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

        • MfaConfiguration — (String)

          Can be one of the following values:

          • OFF - MFA tokens aren't required and can't be specified during user registration.

          • ON - MFA tokens are required for all user registrations. You can only specify required when you're initially creating a user pool.

          • OPTIONAL - Users have the option when registering to create an MFA token.

          Possible values include:
          • "OFF"
          • "ON"
          • "OPTIONAL"
        • DeviceConfiguration — (map)

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

          Note: When you provide a value for any DeviceConfiguration field, you activate the Amazon Cognito device-remembering feature.
          • ChallengeRequiredOnNewDevice — (Boolean)

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

            Note: Whether or not ChallengeRequiredOnNewDevice is true, users who sign in with devices that have not been confirmed or remembered must still provide a second factor in a user pool that requires MFA.
          • DeviceOnlyRememberedOnUserPrompt — (Boolean)

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

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

        • EstimatedNumberOfUsers — (Integer)

          A number estimating the size of the user pool.

        • EmailConfiguration — (map)

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

          • SourceArn — (String)

            The ARN of a verified email address or an address from a verified domain in Amazon SES. You can set a SourceArn email from a verified domain only with an API request. You can set a verified email address, but not an address in a verified domain, in the Amazon Cognito console. Amazon Cognito uses the email address that you provide in one of the following ways, depending on the value that you specify for the EmailSendingAccount parameter:

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

            • If you specify DEVELOPER, Amazon Cognito emails your users with this address by calling Amazon SES on your behalf.

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

          • ReplyToEmailAddress — (String)

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

          • EmailSendingAccount — (String)

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

            COGNITO_DEFAULT

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

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

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

            DEVELOPER

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

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

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

            Possible values include:
            • "COGNITO_DEFAULT"
            • "DEVELOPER"
          • From — (String)

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

          • ConfigurationSet — (String)

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

            Event publishing

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

            IP pool management

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

        • SmsConfiguration — (map)

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

          • SnsCallerArnrequired — (String)

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

          • ExternalId — (String)

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

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

          • SnsRegion — (String)

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

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

        • UserPoolTags — (map<String>)

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

        • SmsConfigurationFailure — (String)

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

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

          InvalidSmsRoleAccessPolicyException

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

          SNSSandbox

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

        • EmailConfigurationFailure — (String)

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

        • Domain — (String)

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

        • CustomDomain — (String)

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

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

        • AdminCreateUserConfig — (map)

          The configuration for AdminCreateUser requests.

          • AllowAdminCreateUserOnly — (Boolean)

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

          • UnusedAccountValidityDays — (Integer)

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

            Note: If you set a value for TemporaryPasswordValidityDays in PasswordPolicy, that value will be used, and UnusedAccountValidityDays will be no longer be an available parameter for that user pool.
          • InviteMessageTemplate — (map)

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

            See also Customizing User Invitation Messages.

            • SMSMessage — (String)

              The message template for SMS messages.

            • EmailMessage — (String)

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

            • EmailSubject — (String)

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

        • UserPoolAddOns — (map)

          User pool add-ons. Contains settings for activation of advanced security features. To log user security information but take no action, set to AUDIT. To configure automatic security responses to risky traffic to your user pool, set to ENFORCED.

          For more information, see Adding advanced security to a user pool.

          • AdvancedSecurityModerequired — (String)

            The operating mode of advanced security features for standard authentication types in your user pool, including username-password and secure remote password (SRP) authentication.

            Possible values include:
            • "OFF"
            • "AUDIT"
            • "ENFORCED"
          • AdvancedSecurityAdditionalFlows — (map)

            Advanced security configuration options for additional authentication types in your user pool, including custom authentication.

        • UsernameConfiguration — (map)

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

          • CaseSensitiverequired — (Boolean)

            Specifies whether user name case sensitivity will be applied for all users in the user pool through Amazon Cognito APIs. For most use cases, set case sensitivity to False (case insensitive) as a best practice. When usernames and email addresses are case insensitive, users can sign in as the same user when they enter a different capitalization of their user name.

            Valid values include:

            True

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

            False

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

        • Arn — (String)

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

        • AccountRecoverySetting — (map)

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

          • RecoveryMechanisms — (Array<map>)

            The list of RecoveryOptionTypes.

            • Priorityrequired — (Integer)

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

            • Namerequired — (String)

              The recovery method for a user.

              Possible values include:
              • "verified_email"
              • "verified_phone_number"
              • "admin_only"

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

describeUserPoolClient(params = {}, callback) ⇒ AWS.Request

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

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

Learn more

Service Reference:

Examples:

Calling the describeUserPoolClient operation

var params = {
  ClientId: 'STRING_VALUE', /* required */
  UserPoolId: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.describeUserPoolClient(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

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

    • ClientId — (String)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • UserPoolClient — (map)

        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 — (Date)

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

        • CreationDate — (Date)

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

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

          If you don't specify otherwise in the configuration of your app client, your refresh tokens are valid for 30 days.

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

          If you don't specify otherwise in the configuration of your app client, your access tokens are valid for one hour.

        • 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 IdTokenValidity in an API request is hours. Valid range is displayed below in seconds.

          If you don't specify otherwise in the configuration of your app client, your ID tokens are valid for one hour.

        • TokenValidityUnits — (map)

          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. AccessTokenValidity duration can range from five minutes to one day.

            Possible values include:
            • "seconds"
            • "minutes"
            • "hours"
            • "days"
          • 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. IdTokenValidity duration can range from five minutes to one day.

            Possible values include:
            • "seconds"
            • "minutes"
            • "hours"
            • "days"
          • 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. RefreshTokenValidity duration can range from 60 minutes to 10 years.

            Possible values include:
            • "seconds"
            • "minutes"
            • "hours"
            • "days"
        • ReadAttributes — (Array<String>)

          The list of user attributes that you want your app client to have read-only access to. After your user authenticates in your app, their access token authorizes them to read their own attribute value for any attribute in this list. An example of this kind of activity is when your user selects a link to view their profile information. Your app makes a GetUser API request to retrieve and display your user's profile data.

          When you don't specify the ReadAttributes for your app client, your app can read the values of email_verified, phone_number_verified, and the Standard attributes of your user pool. When your user pool has read access to these default attributes, ReadAttributes doesn't return any information. Amazon Cognito only populates ReadAttributes in the API response if you have specified your own custom set of read attributes.

        • WriteAttributes — (Array<String>)

          The list of user attributes that you want your app client to have write access to. After your user authenticates in your app, their access token authorizes them to set or modify their own attribute value for any attribute in this list. An example of this kind of activity is when you present your user with a form to update their profile information and they change their last name. Your app then makes an UpdateUserAttributes API request and sets family_name to the new value.

          When you don't specify the WriteAttributes for your app client, your app can write the values of the Standard attributes of your user pool. When your user pool has write access to these default attributes, WriteAttributes doesn't return any information. Amazon Cognito only populates WriteAttributes in the API response if you have specified your own custom set of write attributes.

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

        • ExplicitAuthFlows — (Array<String>)

          The authentication flows that you want your user pool client to support. For each app client in your user pool, you can sign in your users with any combination of one or more flows, including with a user name and Secure Remote Password (SRP), a user name and password, or a custom authentication process that you define with Lambda functions.

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

          Valid values include:

          • ALLOW_ADMIN_USER_PASSWORD_AUTH: Enable admin based user password authentication flow ADMIN_USER_PASSWORD_AUTH. This setting replaces the ADMIN_NO_SRP_AUTH setting. With this authentication flow, your app passes a user name and password to Amazon Cognito in the request, instead of using the Secure Remote Password (SRP) protocol to securely transmit the password.

          • ALLOW_CUSTOM_AUTH: Enable Lambda trigger based authentication.

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

          • ALLOW_USER_SRP_AUTH: Enable SRP-based authentication.

          • ALLOW_REFRESH_TOKEN_AUTH: Enable authflow to refresh tokens.

          In some environments, you will see the values ADMIN_NO_SRP_AUTH, CUSTOM_AUTH_FLOW_ONLY, or USER_PASSWORD_AUTH. You can't assign these legacy ExplicitAuthFlows values to user pool clients at the same time as values that begin with ALLOW_, like ALLOW_USER_SRP_AUTH.

        • SupportedIdentityProviders — (Array<String>)

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

        • CallbackURLs — (Array<String>)

          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.

        • LogoutURLs — (Array<String>)

          A list of allowed logout URLs for the IdPs.

        • 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 — (Array<String>)

          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.

        • AllowedOAuthScopes — (Array<String>)

          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.

        • AllowedOAuthFlowsUserPoolClient — (Boolean)

          Set to true to use OAuth 2.0 features in your user pool app client.

          AllowedOAuthFlowsUserPoolClient must be true before you can configure the following features in your app client.

          • CallBackURLs: Callback URLs.

          • LogoutURLs: Sign-out redirect URLs.

          • AllowedOAuthScopes: OAuth 2.0 scopes.

          • AllowedOAuthFlows: Support for authorization code, implicit, and client credentials OAuth 2.0 grants.

          To use OAuth 2.0 features, configure one of these features in the Amazon Cognito console or set AllowedOAuthFlowsUserPoolClient to true in a CreateUserPoolClient or UpdateUserPoolClient API request. If you don't set a value for AllowedOAuthFlowsUserPoolClient in a request with the CLI or SDKs, it defaults to false.

        • AnalyticsConfiguration — (map)

          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 early behavior of Amazon Cognito where user existence related errors aren't prevented.

          Defaults to LEGACY when you don't provide a value.

          Possible values include:
          • "LEGACY"
          • "ENABLED"
        • EnableTokenRevocation — (Boolean)

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

        • EnablePropagateAdditionalUserContextData — (Boolean)

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

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

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

        • AuthSessionValidity — (Integer)

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

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

describeUserPoolDomain(params = {}, callback) ⇒ AWS.Request

Gets information about a domain.

Service Reference:

Examples:

Calling the describeUserPoolDomain operation

var params = {
  Domain: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.describeUserPoolDomain(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • Domain — (String)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • DomainDescription — (map)

        A domain description object containing information about the domain.

        • UserPoolId — (String)

          The user pool ID.

        • AWSAccountId — (String)

          The Amazon Web Services ID for the user pool owner.

        • Domain — (String)

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

        • S3Bucket — (String)

          The Amazon S3 bucket where the static files for this domain are stored.

        • CloudFrontDistribution — (String)

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

        • Version — (String)

          The app version.

        • Status — (String)

          The domain status.

          Possible values include:
          • "CREATING"
          • "DELETING"
          • "UPDATING"
          • "ACTIVE"
          • "FAILED"
        • CustomDomainConfig — (map)

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

          • CertificateArnrequired — (String)

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

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

forgetDevice(params = {}, callback) ⇒ AWS.Request

Forgets the specified device. For more information about device authentication, see Working with user devices in your user pool.

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

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

Service Reference:

Examples:

Calling the forgetDevice operation

var params = {
  DeviceKey: 'STRING_VALUE', /* required */
  AccessToken: 'STRING_VALUE'
};
cognitoidentityserviceprovider.forgetDevice(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • AccessToken — (String)

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

    • DeviceKey — (String)

      The device key.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

forgotPassword(params = {}, callback) ⇒ AWS.Request

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

If neither a verified phone number nor a verified email exists, this API returns InvalidParameterException. If your app client has a client secret and you don't provide a SECRET_HASH parameter, this API returns NotAuthorizedException.

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

Note: Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.
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 Services service, Amazon Simple Notification Service might place your account in the SMS sandbox. In sandbox mode , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see SMS message settings for Amazon Cognito user pools in the Amazon Cognito Developer Guide.

Service Reference:

Examples:

Calling the forgotPassword operation

var params = {
  ClientId: 'STRING_VALUE', /* required */
  Username: 'STRING_VALUE', /* required */
  AnalyticsMetadata: {
    AnalyticsEndpointId: 'STRING_VALUE'
  },
  ClientMetadata: {
    '<StringType>': 'STRING_VALUE',
    /* '<StringType>': ... */
  },
  SecretHash: 'STRING_VALUE',
  UserContextData: {
    EncodedData: 'STRING_VALUE',
    IpAddress: 'STRING_VALUE'
  }
};
cognitoidentityserviceprovider.forgotPassword(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • ClientId — (String)

      The ID of the client associated with the user pool.

    • SecretHash — (String)

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

    • UserContextData — (map)

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

      • IpAddress — (String)

        The source IP address of your user's device.

      • EncodedData — (String)

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

    • Username — (String)

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

    • AnalyticsMetadata — (map)

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

      • AnalyticsEndpointId — (String)

        The endpoint ID.

    • ClientMetadata — (map<String>)

      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.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • CodeDeliveryDetails — (map)

        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.

          Possible values include:
          • "SMS"
          • "EMAIL"
        • AttributeName — (String)

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

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

getCSVHeader(params = {}, callback) ⇒ AWS.Request

Gets the header information for the comma-separated value (CSV) file to be used as input for the user import job.

Service Reference:

Examples:

Calling the getCSVHeader operation

var params = {
  UserPoolId: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.getCSVHeader(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • UserPoolId — (String)

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

      • CSVHeader — (Array<String>)

        The header information of the CSV file for the user import job.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

getDevice(params = {}, callback) ⇒ AWS.Request

Gets the device. For more information about device authentication, see Working with user devices in your user pool.

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

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

Service Reference:

Examples:

Calling the getDevice operation

var params = {
  DeviceKey: 'STRING_VALUE', /* required */
  AccessToken: 'STRING_VALUE'
};
cognitoidentityserviceprovider.getDevice(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • DeviceKey — (String)

      The device key.

    • AccessToken — (String)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Device — (map)

        The device.

        • DeviceKey — (String)

          The device key.

        • DeviceAttributes — (Array<map>)

          The device attributes.

          • Namerequired — (String)

            The name of the attribute.

          • Value — (String)

            The value of the attribute.

        • DeviceCreateDate — (Date)

          The creation date of the device.

        • DeviceLastModifiedDate — (Date)

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

        • DeviceLastAuthenticatedDate — (Date)

          The date when the device was last authenticated.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

getGroup(params = {}, callback) ⇒ AWS.Request

Gets a group.

Calling this action requires developer credentials.

Service Reference:

Examples:

Calling the getGroup operation

var params = {
  GroupName: 'STRING_VALUE', /* required */
  UserPoolId: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.getGroup(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • GroupName — (String)

      The name of the group.

    • UserPoolId — (String)

      The user pool ID for the user pool.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Group — (map)

        The group object for the group.

        • GroupName — (String)

          The name of the group.

        • UserPoolId — (String)

          The user pool ID for the user pool.

        • Description — (String)

          A string containing the description of the group.

        • RoleArn — (String)

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

        • Precedence — (Integer)

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

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

          The default Precedence value is null.

        • LastModifiedDate — (Date)

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

        • CreationDate — (Date)

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

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

getIdentityProviderByIdentifier(params = {}, callback) ⇒ AWS.Request

Gets the specified IdP.

Service Reference:

Examples:

Calling the getIdentityProviderByIdentifier operation

var params = {
  IdpIdentifier: 'STRING_VALUE', /* required */
  UserPoolId: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.getIdentityProviderByIdentifier(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

      The user pool ID.

    • IdpIdentifier — (String)

      The IdP identifier.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • IdentityProvider — (map)

        The identity provider details.

        • UserPoolId — (String)

          The user pool ID.

        • ProviderName — (String)

          The IdP name.

        • ProviderType — (String)

          The IdP type.

          Possible values include:
          • "SAML"
          • "Facebook"
          • "Google"
          • "LoginWithAmazon"
          • "SignInWithApple"
          • "OIDC"
        • ProviderDetails — (map<String>)

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

          OpenID Connect (OIDC)

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

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

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

          SAML

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

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

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

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

          LoginWithAmazon

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

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

          Google

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

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

          SignInWithApple

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

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

          Facebook

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

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

        • AttributeMapping — (map<String>)

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

        • IdpIdentifiers — (Array<String>)

          A list of IdP identifiers.

        • LastModifiedDate — (Date)

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

        • CreationDate — (Date)

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

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

getLogDeliveryConfiguration(params = {}, callback) ⇒ AWS.Request

Gets the logging configuration of a user pool.

Service Reference:

Examples:

Calling the getLogDeliveryConfiguration operation

var params = {
  UserPoolId: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.getLogDeliveryConfiguration(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

      The ID of the user pool that has the logging configuration that you want to view.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • LogDeliveryConfiguration — (map)

        The logging configuration of the requested user pool.

        • UserPoolIdrequired — (String)

          The ID of the user pool where you configured logging.

        • LogConfigurationsrequired — (Array<map>)

          A logging destination of a user pool. User pools can have multiple logging destinations for message-delivery and user-activity logs.

          • LogLevelrequired — (String)

            The errorlevel selection of logs that a user pool sends for detailed activity logging. To send userNotification activity with information about message delivery, choose ERROR with CloudWatchLogsConfiguration. To send userAuthEvents activity with user logs from advanced security features, choose INFO with one of CloudWatchLogsConfiguration, FirehoseConfiguration, or S3Configuration.

            Possible values include:
            • "ERROR"
            • "INFO"
          • EventSourcerequired — (String)

            The source of events that your user pool sends for logging. To send error-level logs about user notification activity, set to userNotification. To send info-level logs about advanced security features user activity, set to userAuthEvents.

            Possible values include:
            • "userNotification"
            • "userAuthEvents"
          • CloudWatchLogsConfiguration — (map)

            The CloudWatch log group destination of user pool detailed activity logs, or of user activity log export with advanced security features.

            • LogGroupArn — (String)

              The Amazon Resource Name (arn) of a CloudWatch Logs log group where your user pool sends logs. The log group must not be encrypted with Key Management Service and must be in the same Amazon Web Services account as your user pool.

              To send logs to log groups with a resource policy of a size greater than 5120 characters, configure a log group with a path that starts with /aws/vendedlogs. For more information, see Enabling logging from certain Amazon Web Services services.

          • S3Configuration — (map)

            The Amazon S3 bucket destination of user activity log export with advanced security features. To activate this setting, advanced security features must be active in your user pool.

            • BucketArn — (String)

              The ARN of an Amazon S3 bucket that's the destination for advanced security features log export.

          • FirehoseConfiguration — (map)

            The Amazon Data Firehose stream destination of user activity log export with advanced security features. To activate this setting, advanced security features must be active in your user pool.

            • StreamArn — (String)

              The ARN of an Amazon Data Firehose stream that's the destination for advanced security features log export.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

getSigningCertificate(params = {}, callback) ⇒ AWS.Request

This method takes a user pool ID, and returns the signing certificate. The issued certificate is valid for 10 years from the date of issue.

Amazon Cognito issues and assigns a new signing certificate annually. This process returns a new value in the response to GetSigningCertificate, but doesn't invalidate the original certificate.

Service Reference:

Examples:

Calling the getSigningCertificate operation

var params = {
  UserPoolId: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.getSigningCertificate(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

      The user pool ID.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Certificate — (String)

        The signing certificate.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

getUICustomization(params = {}, callback) ⇒ AWS.Request

Gets the user interface (UI) Customization information for a particular app client's app UI, if any such information exists for the client. If nothing is set for the particular client, but there is an existing pool level customization (the app clientId is ALL), then that information is returned. If nothing is present, then an empty shape is returned.

Service Reference:

Examples:

Calling the getUICustomization operation

var params = {
  UserPoolId: 'STRING_VALUE', /* required */
  ClientId: 'STRING_VALUE'
};
cognitoidentityserviceprovider.getUICustomization(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

      The user pool ID for the user pool.

    • ClientId — (String)

      The client ID for the client app.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • UICustomization — (map)

        The UI customization information.

        • UserPoolId — (String)

          The user pool ID for the user pool.

        • ClientId — (String)

          The client ID for the client app.

        • ImageUrl — (String)

          The logo image for the UI customization.

        • CSS — (String)

          The CSS values in the UI customization.

        • CSSVersion — (String)

          The CSS version number.

        • LastModifiedDate — (Date)

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

        • CreationDate — (Date)

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

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

getUser(params = {}, callback) ⇒ AWS.Request

Gets the user attributes and metadata for a user.

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

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

Service Reference:

Examples:

Calling the getUser operation

var params = {
  AccessToken: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.getUser(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • AccessToken — (String)

      A non-expired access token for the user whose information you want to query.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Username — (String)

        The username of the user that you requested.

      • UserAttributes — (Array<map>)

        An array of name-value pairs representing user attributes.

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

        • Namerequired — (String)

          The name of the attribute.

        • Value — (String)

          The value of the attribute.

      • MFAOptions — (Array<map>)

        This response parameter is no longer supported. It provides information only about SMS MFA configurations. It doesn't provide information about time-based one-time password (TOTP) software token MFA configurations. To look up information about either type of MFA configuration, use UserMFASettingList instead.

        • DeliveryMedium — (String)

          The delivery medium to send the MFA code. You can use this parameter to set only the SMS delivery medium value.

          Possible values include:
          • "SMS"
          • "EMAIL"
        • AttributeName — (String)

          The attribute name of the MFA option type. The only valid value is phone_number.

      • PreferredMfaSetting — (String)

        The user's preferred MFA setting.

      • UserMFASettingList — (Array<String>)

        The MFA options that are activated for the user. The possible values in this list are SMS_MFA and SOFTWARE_TOKEN_MFA.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

getUserAttributeVerificationCode(params = {}, callback) ⇒ AWS.Request

Generates a user attribute verification code for the specified attribute name. Sends a message to a user with a code that they must return in a VerifyUserAttribute request.

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

Note: Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.
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 Services service, Amazon Simple Notification Service might place your account in the SMS sandbox. In sandbox mode , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see SMS message settings for Amazon Cognito user pools in the Amazon Cognito Developer Guide.

Examples:

Calling the getUserAttributeVerificationCode operation

var params = {
  AccessToken: 'STRING_VALUE', /* required */
  AttributeName: 'STRING_VALUE', /* required */
  ClientMetadata: {
    '<StringType>': 'STRING_VALUE',
    /* '<StringType>': ... */
  }
};
cognitoidentityserviceprovider.getUserAttributeVerificationCode(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • AccessToken — (String)

      A non-expired access token for the user whose attribute verification code you want to generate.

    • AttributeName — (String)

      The attribute name returned by the server response to get the user attribute verification code.

    • ClientMetadata — (map<String>)

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

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

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

      Note: When you use the ClientMetadata parameter, remember that Amazon Cognito won't do the following:
      • Store the ClientMetadata value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration doesn't include triggers, the ClientMetadata parameter serves no purpose.
      • Validate the ClientMetadata value.
      • Encrypt the ClientMetadata value. Don't use Amazon Cognito to provide sensitive information.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • CodeDeliveryDetails — (map)

        The code delivery details returned by the server in response to the request to get the user attribute verification code.

        • Destination — (String)

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

        • DeliveryMedium — (String)

          The method that Amazon Cognito used to send the code.

          Possible values include:
          • "SMS"
          • "EMAIL"
        • AttributeName — (String)

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

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

getUserPoolMfaConfig(params = {}, callback) ⇒ AWS.Request

Gets the user pool multi-factor authentication (MFA) configuration.

Service Reference:

Examples:

Calling the getUserPoolMfaConfig operation

var params = {
  UserPoolId: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.getUserPoolMfaConfig(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

      The user pool ID.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • SmsMfaConfiguration — (map)

        The SMS text message multi-factor authentication (MFA) configuration.

        • SmsAuthenticationMessage — (String)

          The SMS authentication message that will be sent to users with the code they must sign in. The message must contain the ‘{####}’ placeholder, which is replaced with the code. If the message isn't included, and default message will be used.

        • SmsConfiguration — (map)

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

          • SnsCallerArnrequired — (String)

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

          • ExternalId — (String)

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

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

          • SnsRegion — (String)

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

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

      • SoftwareTokenMfaConfiguration — (map)

        The software token multi-factor authentication (MFA) configuration.

        • Enabled — (Boolean)

          Specifies whether software token MFA is activated.

      • MfaConfiguration — (String)

        The multi-factor authentication (MFA) configuration. Valid values include:

        • OFF MFA won't be used for any users.

        • ON MFA is required for all users to sign in.

        • OPTIONAL MFA will be required only for individual users who have an MFA factor activated.

        Possible values include:
        • "OFF"
        • "ON"
        • "OPTIONAL"

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

globalSignOut(params = {}, callback) ⇒ AWS.Request

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

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

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

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

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

Other requests might be valid until your user's token expires.

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

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

Service Reference:

Examples:

Calling the globalSignOut operation

var params = {
  AccessToken: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.globalSignOut(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • AccessToken — (String)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

initiateAuth(params = {}, callback) ⇒ AWS.Request

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: Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.
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 Services service, Amazon Simple Notification Service might place your account in the SMS sandbox. In sandbox mode , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see SMS message settings for Amazon Cognito user pools in the Amazon Cognito Developer Guide.

Service Reference:

Examples:

Example username and password sign-in for a user who has TOTP MFA


/* The following example signs in the user mytestuser with analytics data, client metadata, and user context data for advanced security. */

 var params = {
  AnalyticsMetadata: {
   AnalyticsEndpointId: "d70b2ba36a8c4dc5a04a0451a31a1e12"
  }, 
  AuthFlow: "USER_PASSWORD_AUTH", 
  AuthParameters: {
   "PASSWORD": "This-is-my-test-99!", 
   "SECRET_HASH": "oT5ZkS8ctnrhYeeGsGTvOzPhoc/Jd1cO5fueBWFVmp8=", 
   "USERNAME": "mytestuser"
  }, 
  ClientId: "1example23456789", 
  ClientMetadata: {
   "MyTestKey": "MyTestValue"
  }, 
  UserContextData: {
   EncodedData: "AmazonCognitoAdvancedSecurityData_object", 
   IpAddress: "192.0.2.1"
  }
 };
 cognitoidentityserviceprovider.initiateAuth(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    ChallengeName: "SOFTWARE_TOKEN_MFA", 
    ChallengeParameters: {
     "FRIENDLY_DEVICE_NAME": "mytestauthenticator", 
     "USER_ID_FOR_SRP": "mytestuser"
    }, 
    Session: "AYABeC1-y8qooiuysEv0uM4wAqQAHQABAAdTZXJ2aWNlABBDb2duaXRvVXNlclBvb2xzAAEAB2F3cy1rbXMAS2Fybjphd3M6a21zOnVzLXdlc3QtMjowMTU3MzY3MjcxOTg6a2V5LzI5OTFhNGE5LTM5YTAtNDQ0Mi04MWU4LWRkYjY4NTllMTg2MQC4AQIBAHhjxv5lVLhE2_WNrC1zuomqn08qDUUp3z9v4EGAjazZ-wGP3HuBF5Izvxf-9WkCT5uyAAAAfjB8BgkqhkiG9w0BBwagbzBtAgEAMGgGCSqGSIb3DQEHATAeBglghkgBZQMEAS4wEQQMeQoT5e6Dpfh52caqAgEQgDvuL8uLMhPt0WmQpZnkNED1gob6xbqt5LaQo_H4L5CuT4Kj499dGCoZ1q1trmlZSRgRm0wwGGG8lFU37QIAAAAADAAAEAAAAAAAAAAAAAAAAADuLe9_UJ4oZAMsQYr0ntiT_____wAAAAEAAAAAAAAAAAAAAAEAAADnLDGmKBQtsCafNokRmPLgl2itBKuKR2dfZBQb5ucCYkzThM5HOfQUSEL-A3dZzfYDC0IODsrcMkrbeeVyMJk-FCzsxS9Og8BEBVnvi9WjZkPJ4mF0YS6FUXnoPSBV5oUqGzRaT-tJ169SUFZAUfFM1fGeJ8T57-QdCxjyISRCWV1VG5_7TiCioyRGfWwzNVWh7exJortF3ccfOyiEyxeqJ2VJvJq3m_w8NP24_PMDpktpRMKftObIMlD5ewRTNCdrUXQ1BW5KIxhJLGjYfRzJDZuKzmEgS-VHsKz0z76w-AlAgdfvdAjflLnsgduU5kUX4YP6jqnetg"
   }
   */
 });

Calling the initiateAuth operation

var params = {
  AuthFlow: USER_SRP_AUTH | REFRESH_TOKEN_AUTH | REFRESH_TOKEN | CUSTOM_AUTH | ADMIN_NO_SRP_AUTH | USER_PASSWORD_AUTH | ADMIN_USER_PASSWORD_AUTH, /* required */
  ClientId: 'STRING_VALUE', /* required */
  AnalyticsMetadata: {
    AnalyticsEndpointId: 'STRING_VALUE'
  },
  AuthParameters: {
    '<StringType>': 'STRING_VALUE',
    /* '<StringType>': ... */
  },
  ClientMetadata: {
    '<StringType>': 'STRING_VALUE',
    /* '<StringType>': ... */
  },
  UserContextData: {
    EncodedData: 'STRING_VALUE',
    IpAddress: 'STRING_VALUE'
  }
};
cognitoidentityserviceprovider.initiateAuth(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • AuthFlow — (String)

      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.

      Possible values include:
      • "USER_SRP_AUTH"
      • "REFRESH_TOKEN_AUTH"
      • "REFRESH_TOKEN"
      • "CUSTOM_AUTH"
      • "ADMIN_NO_SRP_AUTH"
      • "USER_PASSWORD_AUTH"
      • "ADMIN_USER_PASSWORD_AUTH"
    • AuthParameters — (map<String>)

      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 USER_PASSWORD_AUTH: USERNAME (required), PASSWORD (required), SECRET_HASH (required if the app client is configured with a client secret), DEVICE_KEY.

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

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

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

    • ClientMetadata — (map<String>)

      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

      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.
    • ClientId — (String)

      The app client ID.

    • AnalyticsMetadata — (map)

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

      • AnalyticsEndpointId — (String)

        The endpoint ID.

    • UserContextData — (map)

      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.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • ChallengeName — (String)

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

        Valid values include the following:

        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 MFAS_CAN_SETUP value.

          To set up software token MFA, use the session returned here from InitiateAuth as an input to AssociateSoftwareToken. Use the session returned by VerifySoftwareToken as an input to RespondToAuthChallenge with challenge name MFA_SETUP to complete sign-in. To set up SMS MFA, an administrator should help the user to add a phone number to their account, and then the user should call InitiateAuth again to restart sign-in.

        Possible values include:
        • "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)

        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 — (map<String>)

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

      • AuthenticationResult — (map)

        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 — (map)

          The new device metadata from an authentication result.

          • DeviceKey — (String)

            The device key.

          • DeviceGroupKey — (String)

            The device group key.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

listDevices(params = {}, callback) ⇒ AWS.Request

Lists the sign-in devices that Amazon Cognito has registered to the current user. For more information about device authentication, see Working with user devices in your user pool.

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

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

Service Reference:

Examples:

Calling the listDevices operation

var params = {
  AccessToken: 'STRING_VALUE', /* required */
  Limit: 'NUMBER_VALUE',
  PaginationToken: 'STRING_VALUE'
};
cognitoidentityserviceprovider.listDevices(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • AccessToken — (String)

      A valid access token that Amazon Cognito issued to the user whose list of devices you want to view.

    • Limit — (Integer)

      The limit of the device request.

    • PaginationToken — (String)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Devices — (Array<map>)

        The devices returned in the list devices response.

        • DeviceKey — (String)

          The device key.

        • DeviceAttributes — (Array<map>)

          The device attributes.

          • Namerequired — (String)

            The name of the attribute.

          • Value — (String)

            The value of the attribute.

        • DeviceCreateDate — (Date)

          The creation date of the device.

        • DeviceLastModifiedDate — (Date)

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

        • DeviceLastAuthenticatedDate — (Date)

          The date when the device was last authenticated.

      • PaginationToken — (String)

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

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

listGroups(params = {}, callback) ⇒ AWS.Request

Lists the groups associated with a user pool.

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

Learn more

Service Reference:

Examples:

Calling the listGroups operation

var params = {
  UserPoolId: 'STRING_VALUE', /* required */
  Limit: 'NUMBER_VALUE',
  NextToken: 'STRING_VALUE'
};
cognitoidentityserviceprovider.listGroups(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

      The user pool ID for the user pool.

    • Limit — (Integer)

      The limit of the request to list groups.

    • NextToken — (String)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Groups — (Array<map>)

        The group objects for the groups.

        • GroupName — (String)

          The name of the group.

        • UserPoolId — (String)

          The user pool ID for the user pool.

        • Description — (String)

          A string containing the description of the group.

        • RoleArn — (String)

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

        • Precedence — (Integer)

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

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

          The default Precedence value is null.

        • LastModifiedDate — (Date)

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

        • CreationDate — (Date)

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

      • NextToken — (String)

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

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

listIdentityProviders(params = {}, callback) ⇒ AWS.Request

Lists information about all IdPs for a user pool.

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

Learn more

Service Reference:

Examples:

Calling the listIdentityProviders operation

var params = {
  UserPoolId: 'STRING_VALUE', /* required */
  MaxResults: 'NUMBER_VALUE',
  NextToken: 'STRING_VALUE'
};
cognitoidentityserviceprovider.listIdentityProviders(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

      The user pool ID.

    • MaxResults — (Integer)

      The maximum number of IdPs to return.

    • NextToken — (String)

      A pagination token.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Providers — (Array<map>)

        A list of IdP objects.

        • ProviderName — (String)

          The IdP name.

        • ProviderType — (String)

          The IdP type.

          Possible values include:
          • "SAML"
          • "Facebook"
          • "Google"
          • "LoginWithAmazon"
          • "SignInWithApple"
          • "OIDC"
        • LastModifiedDate — (Date)

          The date the provider was last modified.

        • CreationDate — (Date)

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

      • NextToken — (String)

        A pagination token.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

listResourceServers(params = {}, callback) ⇒ AWS.Request

Lists the resource servers for a user pool.

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

Learn more

Service Reference:

Examples:

Calling the listResourceServers operation

var params = {
  UserPoolId: 'STRING_VALUE', /* required */
  MaxResults: 'NUMBER_VALUE',
  NextToken: 'STRING_VALUE'
};
cognitoidentityserviceprovider.listResourceServers(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

      The user pool ID for the user pool.

    • MaxResults — (Integer)

      The maximum number of resource servers to return.

    • NextToken — (String)

      A pagination token.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • ResourceServers — (Array<map>)

        The resource servers.

        • UserPoolId — (String)

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

        • Identifier — (String)

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

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

        • Name — (String)

          The name of the resource server.

        • Scopes — (Array<map>)

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

          • ScopeNamerequired — (String)

            The name of the scope.

          • ScopeDescriptionrequired — (String)

            A description of the scope.

      • NextToken — (String)

        A pagination token.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

listTagsForResource(params = {}, callback) ⇒ AWS.Request

Lists the tags that are assigned to an Amazon Cognito user pool.

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

You can use this action up to 10 times per second, per account.

Service Reference:

Examples:

Calling the listTagsForResource operation

var params = {
  ResourceArn: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.listTagsForResource(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • ResourceArn — (String)

      The Amazon Resource Name (ARN) of the user pool that the tags are assigned to.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Tags — (map<String>)

        The tags that are assigned to the user pool.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

listUserImportJobs(params = {}, callback) ⇒ AWS.Request

Lists user import jobs for a user pool.

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

Learn more

Service Reference:

Examples:

Calling the listUserImportJobs operation

var params = {
  MaxResults: 'NUMBER_VALUE', /* required */
  UserPoolId: 'STRING_VALUE', /* required */
  PaginationToken: 'STRING_VALUE'
};
cognitoidentityserviceprovider.listUserImportJobs(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

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

    • MaxResults — (Integer)

      The maximum number of import jobs you want the request to return.

    • PaginationToken — (String)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • UserImportJobs — (Array<map>)

        The user import jobs.

        • JobName — (String)

          The job name for the user import job.

        • JobId — (String)

          The job ID for the user import job.

        • UserPoolId — (String)

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

        • PreSignedUrl — (String)

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

        • CreationDate — (Date)

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

        • StartDate — (Date)

          The date when the user import job was started.

        • CompletionDate — (Date)

          The date when the user import job was completed.

        • Status — (String)

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

          • Created - The job was created but not started.

          • Pending - A transition state. You have started the job, but it has not begun importing users yet.

          • InProgress - The job has started, and users are being imported.

          • Stopping - You have stopped the job, but the job has not stopped importing users yet.

          • Stopped - You have stopped the job, and the job has stopped importing users.

          • Succeeded - The job has completed successfully.

          • Failed - The job has stopped due to an error.

          • Expired - You created a job, but did not start the job within 24-48 hours. All data associated with the job was deleted, and the job can't be started.

          Possible values include:
          • "Created"
          • "Pending"
          • "InProgress"
          • "Stopping"
          • "Expired"
          • "Stopped"
          • "Failed"
          • "Succeeded"
        • CloudWatchLogsRoleArn — (String)

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

        • ImportedUsers — (Integer)

          The number of users that were successfully imported.

        • SkippedUsers — (Integer)

          The number of users that were skipped.

        • FailedUsers — (Integer)

          The number of users that couldn't be imported.

        • CompletionMessage — (String)

          The message returned when the user import job is completed.

      • PaginationToken — (String)

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

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

listUserPoolClients(params = {}, callback) ⇒ AWS.Request

Lists the clients that have been created for the specified user pool.

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

Learn more

Service Reference:

Examples:

Calling the listUserPoolClients operation

var params = {
  UserPoolId: 'STRING_VALUE', /* required */
  MaxResults: 'NUMBER_VALUE',
  NextToken: 'STRING_VALUE'
};
cognitoidentityserviceprovider.listUserPoolClients(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

      The user pool ID for the user pool where you want to list user pool clients.

    • MaxResults — (Integer)

      The maximum number of results you want the request to return when listing the user pool clients.

    • NextToken — (String)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • UserPoolClients — (Array<map>)

        The user pool clients in the response that lists user pool clients.

        • ClientId — (String)

          The ID of the client associated with the user pool.

        • UserPoolId — (String)

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

        • ClientName — (String)

          The client name from the user pool client description.

      • NextToken — (String)

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

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

listUserPools(params = {}, callback) ⇒ AWS.Request

Lists the user pools associated with an Amazon Web Services account.

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

Learn more

Service Reference:

Examples:

Calling the listUserPools operation

var params = {
  MaxResults: 'NUMBER_VALUE', /* required */
  NextToken: 'STRING_VALUE'
};
cognitoidentityserviceprovider.listUserPools(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • NextToken — (String)

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

    • MaxResults — (Integer)

      The maximum number of results you want the request to return when listing the user pools.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • UserPools — (Array<map>)

        The user pools from the response to list users.

        • Id — (String)

          The ID in a user pool description.

        • Name — (String)

          The name in a user pool description.

        • LambdaConfig — (map)

          The Lambda configuration information in a user pool description.

          • PreSignUp — (String)

            A pre-registration Lambda trigger.

          • CustomMessage — (String)

            A custom Message Lambda trigger.

          • PostConfirmation — (String)

            A post-confirmation Lambda trigger.

          • PreAuthentication — (String)

            A pre-authentication Lambda trigger.

          • PostAuthentication — (String)

            A post-authentication Lambda trigger.

          • DefineAuthChallenge — (String)

            Defines the authentication challenge.

          • CreateAuthChallenge — (String)

            Creates an authentication challenge.

          • VerifyAuthChallengeResponse — (String)

            Verifies the authentication challenge response.

          • PreTokenGeneration — (String)

            The Amazon Resource Name (ARN) of the function that you want to assign to your Lambda trigger.

            Set this parameter for legacy purposes. If you also set an ARN in PreTokenGenerationConfig, its value must be identical to PreTokenGeneration. For new instances of pre token generation triggers, set the LambdaArn of PreTokenGenerationConfig.

            You can set

          • UserMigration — (String)

            The user migration Lambda config type.

          • PreTokenGenerationConfig — (map)

            The detailed configuration of a pre token generation trigger. If you also set an ARN in PreTokenGeneration, its value must be identical to PreTokenGenerationConfig.

            • LambdaVersionrequired — (String)

              The user pool trigger version of the request that Amazon Cognito sends to your Lambda function. Higher-numbered versions add fields that support new features.

              Possible values include:
              • "V1_0"
              • "V2_0"
            • LambdaArnrequired — (String)

              The Amazon Resource Name (ARN) of the function that you want to assign to your Lambda trigger.

              This parameter and the PreTokenGeneration property of LambdaConfig have the same value. For new instances of pre token generation triggers, set LambdaArn.

          • CustomSMSSender — (map)

            A custom SMS sender Lambda trigger.

            • LambdaVersionrequired — (String)

              The user pool trigger version of the request that Amazon Cognito sends to your Lambda function. Higher-numbered versions add fields that support new features.

              You must use a LambdaVersion of V1_0 with a custom sender function.

              Possible values include:
              • "V1_0"
            • LambdaArnrequired — (String)

              The Amazon Resource Name (ARN) of the function that you want to assign to your Lambda trigger.

          • CustomEmailSender — (map)

            A custom email sender Lambda trigger.

            • LambdaVersionrequired — (String)

              The user pool trigger version of the request that Amazon Cognito sends to your Lambda function. Higher-numbered versions add fields that support new features.

              You must use a LambdaVersion of V1_0 with a custom sender function.

              Possible values include:
              • "V1_0"
            • LambdaArnrequired — (String)

              The Amazon Resource Name (ARN) of the function that you want to assign to your Lambda trigger.

          • KMSKeyID — (String)

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

        • Status — (String)

          The user pool status in a user pool description.

          Possible values include:
          • "Enabled"
          • "Disabled"
        • LastModifiedDate — (Date)

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

        • CreationDate — (Date)

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

      • NextToken — (String)

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

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

listUsers(params = {}, callback) ⇒ AWS.Request

Lists users and their basic details in a user pool.

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

Learn more

Service Reference:

Examples:

A ListUsers request for the next 3 users whose email address starts with "testuser."


/* This request submits a value for all possible parameters for ListUsers. By iterating the PaginationToken, you can page through and collect all users in a user pool. */

 var params = {
  AttributesToGet: [
     "email", 
     "sub"
  ], 
  Filter: "\"email\"^=\"testuser\"", 
  Limit: 3, 
  PaginationToken: "abcd1234EXAMPLE", 
  UserPoolId: "us-east-1_EXAMPLE"
 };
 cognitoidentityserviceprovider.listUsers(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    PaginationToken: "efgh5678EXAMPLE", 
    Users: [
       {
      Attributes: [
         {
        Name: "sub", 
        Value: "eaad0219-2117-439f-8d46-4db20e59268f"
       }, 
         {
        Name: "email", 
        Value: "testuser@example.com"
       }
      ], 
      Enabled: true, 
      UserCreateDate: <Date Representation>, 
      UserLastModifiedDate: <Date Representation>, 
      UserStatus: "CONFIRMED", 
      Username: "testuser"
     }, 
       {
      Attributes: [
         {
        Name: "sub", 
        Value: "3b994cfd-0b07-4581-be46-3c82f9a70c90"
       }, 
         {
        Name: "email", 
        Value: "testuser2@example.com"
       }
      ], 
      Enabled: true, 
      UserCreateDate: <Date Representation>, 
      UserLastModifiedDate: <Date Representation>, 
      UserStatus: "UNCONFIRMED", 
      Username: "testuser2"
     }, 
       {
      Attributes: [
         {
        Name: "sub", 
        Value: "5929e0d1-4c34-42d1-9b79-a5ecacfe66f7"
       }, 
         {
        Name: "email", 
        Value: "testuser3@example.com"
       }
      ], 
      Enabled: true, 
      UserCreateDate: <Date Representation>, 
      UserLastModifiedDate: <Date Representation>, 
      UserStatus: "UNCONFIRMED", 
      Username: "testuser3@example.com"
     }
    ]
   }
   */
 });

Calling the listUsers operation

var params = {
  UserPoolId: 'STRING_VALUE', /* required */
  AttributesToGet: [
    'STRING_VALUE',
    /* more items */
  ],
  Filter: 'STRING_VALUE',
  Limit: 'NUMBER_VALUE',
  PaginationToken: 'STRING_VALUE'
};
cognitoidentityserviceprovider.listUsers(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

      The user pool ID for the user pool on which the search should be performed.

    • AttributesToGet — (Array<String>)

      A JSON array of user attribute names, for example given_name, that you want Amazon Cognito to include in the response for each user. When you don't provide an AttributesToGet parameter, Amazon Cognito returns all attributes for each user.

      Use AttributesToGet with required attributes in your user pool, or in conjunction with Filter. Amazon Cognito returns an error if not all users in the results have set a value for the attribute you request. Attributes that you can't filter on, including custom attributes, must have a value set in every user profile before an AttributesToGet parameter returns results.

    • Limit — (Integer)

      Maximum number of users to be returned.

    • PaginationToken — (String)

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

    • Filter — (String)

      A filter string of the form "AttributeName Filter-Type "AttributeValue"". Quotation marks within the filter string must be escaped using the backslash (\) character. For example, "family_name = \"Reddy\"".

      • AttributeName: The name of the attribute to search for. You can only search for one attribute at a time.

      • Filter-Type: For an exact match, use =, for example, "given_name = \"Jon\"". For a prefix ("starts with") match, use ^=, for example, "given_name ^= \"Jon\"".

      • AttributeValue: The attribute value that must be matched for each user.

      If the filter string is empty, ListUsers returns all users in the user pool.

      You can only search for the following standard attributes:

      • username (case-sensitive)

      • email

      • phone_number

      • name

      • given_name

      • family_name

      • preferred_username

      • cognito:user_status (called Status in the Console) (case-insensitive)

      • status (called Enabled in the Console) (case-sensitive)

      • sub

      Custom attributes aren't searchable.

      Note: You can also list users with a client-side filter. The server-side filter matches no more than one attribute. For an advanced search, use a client-side filter with the --query parameter of the list-users action in the CLI. When you use a client-side filter, ListUsers returns a paginated list of zero or more users. You can receive multiple pages in a row with zero results. Repeat the query with each pagination token that is returned until you receive a null pagination token value, and then review the combined result. For more information about server-side and client-side filtering, see FilteringCLI output in the Command Line Interface User Guide.

      For more information, see Searching for Users Using the ListUsers API and Examples of Using the ListUsers API in the Amazon Cognito Developer Guide.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Users — (Array<map>)

        A list of the user pool users, and their attributes, that match your query.

        Note: Amazon Cognito creates a profile in your user pool for each native user in your user pool, and each unique user ID from your third-party identity providers (IdPs). When you link users with the AdminLinkProviderForUser API operation, the output of ListUsers displays both the IdP user and the native user that you linked. You can identify IdP users in the Users object of this API response by the IdP prefix that Amazon Cognito appends to Username.
        • Username — (String)

          The user name of the user you want to describe.

        • Attributes — (Array<map>)

          A container with information about the user type attributes.

          • Namerequired — (String)

            The name of the attribute.

          • Value — (String)

            The value of the attribute.

        • UserCreateDate — (Date)

          The creation date of the user.

        • UserLastModifiedDate — (Date)

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

        • Enabled — (Boolean)

          Specifies whether the user is enabled.

        • UserStatus — (String)

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

          • UNCONFIRMED - User has been created but not confirmed.

          • CONFIRMED - User has been confirmed.

          • EXTERNAL_PROVIDER - User signed in with a third-party IdP.

          • UNKNOWN - User status isn't known.

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

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

          Possible values include:
          • "UNCONFIRMED"
          • "CONFIRMED"
          • "ARCHIVED"
          • "COMPROMISED"
          • "UNKNOWN"
          • "RESET_REQUIRED"
          • "FORCE_CHANGE_PASSWORD"
          • "EXTERNAL_PROVIDER"
        • MFAOptions — (Array<map>)

          The MFA options for the user.

          • DeliveryMedium — (String)

            The delivery medium to send the MFA code. You can use this parameter to set only the SMS delivery medium value.

            Possible values include:
            • "SMS"
            • "EMAIL"
          • AttributeName — (String)

            The attribute name of the MFA option type. The only valid value is phone_number.

      • PaginationToken — (String)

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

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

listUsersInGroup(params = {}, callback) ⇒ AWS.Request

Lists the users in the specified group.

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

Learn more

Service Reference:

Examples:

Calling the listUsersInGroup operation

var params = {
  GroupName: 'STRING_VALUE', /* required */
  UserPoolId: 'STRING_VALUE', /* required */
  Limit: 'NUMBER_VALUE',
  NextToken: 'STRING_VALUE'
};
cognitoidentityserviceprovider.listUsersInGroup(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

      The user pool ID for the user pool.

    • GroupName — (String)

      The name of the group.

    • Limit — (Integer)

      The maximum number of users that you want to retrieve before pagination.

    • NextToken — (String)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Users — (Array<map>)

        A list of users in the group, and their attributes.

        • Username — (String)

          The user name of the user you want to describe.

        • Attributes — (Array<map>)

          A container with information about the user type attributes.

          • Namerequired — (String)

            The name of the attribute.

          • Value — (String)

            The value of the attribute.

        • UserCreateDate — (Date)

          The creation date of the user.

        • UserLastModifiedDate — (Date)

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

        • Enabled — (Boolean)

          Specifies whether the user is enabled.

        • UserStatus — (String)

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

          • UNCONFIRMED - User has been created but not confirmed.

          • CONFIRMED - User has been confirmed.

          • EXTERNAL_PROVIDER - User signed in with a third-party IdP.

          • UNKNOWN - User status isn't known.

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

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

          Possible values include:
          • "UNCONFIRMED"
          • "CONFIRMED"
          • "ARCHIVED"
          • "COMPROMISED"
          • "UNKNOWN"
          • "RESET_REQUIRED"
          • "FORCE_CHANGE_PASSWORD"
          • "EXTERNAL_PROVIDER"
        • MFAOptions — (Array<map>)

          The MFA options for the user.

          • DeliveryMedium — (String)

            The delivery medium to send the MFA code. You can use this parameter to set only the SMS delivery medium value.

            Possible values include:
            • "SMS"
            • "EMAIL"
          • AttributeName — (String)

            The attribute name of the MFA option type. The only valid value is phone_number.

      • NextToken — (String)

        An identifier that you can use in a later request to return the next set of items in the list.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

resendConfirmationCode(params = {}, callback) ⇒ AWS.Request

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

Note: Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.
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 Services service, Amazon Simple Notification Service might place your account in the SMS sandbox. In sandbox mode , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see SMS message settings for Amazon Cognito user pools in the Amazon Cognito Developer Guide.

Service Reference:

Examples:

Calling the resendConfirmationCode operation

var params = {
  ClientId: 'STRING_VALUE', /* required */
  Username: 'STRING_VALUE', /* required */
  AnalyticsMetadata: {
    AnalyticsEndpointId: 'STRING_VALUE'
  },
  ClientMetadata: {
    '<StringType>': 'STRING_VALUE',
    /* '<StringType>': ... */
  },
  SecretHash: 'STRING_VALUE',
  UserContextData: {
    EncodedData: 'STRING_VALUE',
    IpAddress: 'STRING_VALUE'
  }
};
cognitoidentityserviceprovider.resendConfirmationCode(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • ClientId — (String)

      The ID of the client associated with the user pool.

    • SecretHash — (String)

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

    • UserContextData — (map)

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

      • IpAddress — (String)

        The source IP address of your user's device.

      • EncodedData — (String)

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

    • Username — (String)

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

    • AnalyticsMetadata — (map)

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

      • AnalyticsEndpointId — (String)

        The endpoint ID.

    • ClientMetadata — (map<String>)

      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.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • CodeDeliveryDetails — (map)

        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.

          Possible values include:
          • "SMS"
          • "EMAIL"
        • AttributeName — (String)

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

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

respondToAuthChallenge(params = {}, callback) ⇒ AWS.Request

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

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

Note: Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.
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 Services service, Amazon Simple Notification Service might place your account in the SMS sandbox. In sandbox mode , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see SMS message settings for Amazon Cognito user pools in the Amazon Cognito Developer Guide.

Service Reference:

Examples:

Calling the respondToAuthChallenge operation

var params = {
  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, /* required */
  ClientId: 'STRING_VALUE', /* required */
  AnalyticsMetadata: {
    AnalyticsEndpointId: 'STRING_VALUE'
  },
  ChallengeResponses: {
    '<StringType>': 'STRING_VALUE',
    /* '<StringType>': ... */
  },
  ClientMetadata: {
    '<StringType>': 'STRING_VALUE',
    /* '<StringType>': ... */
  },
  Session: 'STRING_VALUE',
  UserContextData: {
    EncodedData: 'STRING_VALUE',
    IpAddress: 'STRING_VALUE'
  }
};
cognitoidentityserviceprovider.respondToAuthChallenge(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • ClientId — (String)

      The app client ID.

    • ChallengeName — (String)

      The challenge name. For more information, see InitiateAuth.

      ADMIN_NO_SRP_AUTH isn't a valid value.

      Possible values include:
      • "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)

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

    • ChallengeResponses — (map<String>)

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

      You must provide a SECRET_HASH parameter in all challenge responses to an app client that has a client secret.

      SMS_MFA

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

      PASSWORD_VERIFIER

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

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

      CUSTOM_CHALLENGE

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

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

      NEW_PASSWORD_REQUIRED

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

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

      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

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

      DEVICE_SRP_AUTH

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

      DEVICE_PASSWORD_VERIFIER

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

      MFA_SETUP

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

      SELECT_MFA_TYPE

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

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

    • AnalyticsMetadata — (map)

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

      • AnalyticsEndpointId — (String)

        The endpoint ID.

    • UserContextData — (map)

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

      • IpAddress — (String)

        The source IP address of your user's device.

      • EncodedData — (String)

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

    • ClientMetadata — (map<String>)

      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.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • ChallengeName — (String)

        The challenge name. For more information, see InitiateAuth.

        Possible values include:
        • "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)

        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 — (map<String>)

        The challenge parameters. For more information, see InitiateAuth.

      • AuthenticationResult — (map)

        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 — (map)

          The new device metadata from an authentication result.

          • DeviceKey — (String)

            The device key.

          • DeviceGroupKey — (String)

            The device group key.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

revokeToken(params = {}, callback) ⇒ AWS.Request

Revokes all of the access tokens generated by, and at the same time as, the specified refresh token. After a token is revoked, you can't use the revoked token to access Amazon Cognito user APIs, or to authorize access to your resource server.

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

Service Reference:

Examples:

Calling the revokeToken operation

var params = {
  ClientId: 'STRING_VALUE', /* required */
  Token: 'STRING_VALUE', /* required */
  ClientSecret: 'STRING_VALUE'
};
cognitoidentityserviceprovider.revokeToken(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • Token — (String)

      The refresh token that you want to revoke.

    • ClientId — (String)

      The client ID for the token that you want to revoke.

    • ClientSecret — (String)

      The secret for the client ID. This is required only if the client ID has a secret.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

setLogDeliveryConfiguration(params = {}, callback) ⇒ AWS.Request

Sets up or modifies the logging configuration of a user pool. User pools can export user notification logs and advanced security features user activity logs.

Service Reference:

Examples:

Calling the setLogDeliveryConfiguration operation

var params = {
  LogConfigurations: [ /* required */
    {
      EventSource: userNotification | userAuthEvents, /* required */
      LogLevel: ERROR | INFO, /* required */
      CloudWatchLogsConfiguration: {
        LogGroupArn: 'STRING_VALUE'
      },
      FirehoseConfiguration: {
        StreamArn: 'STRING_VALUE'
      },
      S3Configuration: {
        BucketArn: 'STRING_VALUE'
      }
    },
    /* more items */
  ],
  UserPoolId: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.setLogDeliveryConfiguration(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

      The ID of the user pool where you want to configure logging.

    • LogConfigurations — (Array<map>)

      A collection of the logging configurations for a user pool.

      • LogLevelrequired — (String)

        The errorlevel selection of logs that a user pool sends for detailed activity logging. To send userNotification activity with information about message delivery, choose ERROR with CloudWatchLogsConfiguration. To send userAuthEvents activity with user logs from advanced security features, choose INFO with one of CloudWatchLogsConfiguration, FirehoseConfiguration, or S3Configuration.

        Possible values include:
        • "ERROR"
        • "INFO"
      • EventSourcerequired — (String)

        The source of events that your user pool sends for logging. To send error-level logs about user notification activity, set to userNotification. To send info-level logs about advanced security features user activity, set to userAuthEvents.

        Possible values include:
        • "userNotification"
        • "userAuthEvents"
      • CloudWatchLogsConfiguration — (map)

        The CloudWatch log group destination of user pool detailed activity logs, or of user activity log export with advanced security features.

        • LogGroupArn — (String)

          The Amazon Resource Name (arn) of a CloudWatch Logs log group where your user pool sends logs. The log group must not be encrypted with Key Management Service and must be in the same Amazon Web Services account as your user pool.

          To send logs to log groups with a resource policy of a size greater than 5120 characters, configure a log group with a path that starts with /aws/vendedlogs. For more information, see Enabling logging from certain Amazon Web Services services.

      • S3Configuration — (map)

        The Amazon S3 bucket destination of user activity log export with advanced security features. To activate this setting, advanced security features must be active in your user pool.

        • BucketArn — (String)

          The ARN of an Amazon S3 bucket that's the destination for advanced security features log export.

      • FirehoseConfiguration — (map)

        The Amazon Data Firehose stream destination of user activity log export with advanced security features. To activate this setting, advanced security features must be active in your user pool.

        • StreamArn — (String)

          The ARN of an Amazon Data Firehose stream that's the destination for advanced security features log export.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • LogDeliveryConfiguration — (map)

        The detailed activity logging configuration that you applied to the requested user pool.

        • UserPoolIdrequired — (String)

          The ID of the user pool where you configured logging.

        • LogConfigurationsrequired — (Array<map>)

          A logging destination of a user pool. User pools can have multiple logging destinations for message-delivery and user-activity logs.

          • LogLevelrequired — (String)

            The errorlevel selection of logs that a user pool sends for detailed activity logging. To send userNotification activity with information about message delivery, choose ERROR with CloudWatchLogsConfiguration. To send userAuthEvents activity with user logs from advanced security features, choose INFO with one of CloudWatchLogsConfiguration, FirehoseConfiguration, or S3Configuration.

            Possible values include:
            • "ERROR"
            • "INFO"
          • EventSourcerequired — (String)

            The source of events that your user pool sends for logging. To send error-level logs about user notification activity, set to userNotification. To send info-level logs about advanced security features user activity, set to userAuthEvents.

            Possible values include:
            • "userNotification"
            • "userAuthEvents"
          • CloudWatchLogsConfiguration — (map)

            The CloudWatch log group destination of user pool detailed activity logs, or of user activity log export with advanced security features.

            • LogGroupArn — (String)

              The Amazon Resource Name (arn) of a CloudWatch Logs log group where your user pool sends logs. The log group must not be encrypted with Key Management Service and must be in the same Amazon Web Services account as your user pool.

              To send logs to log groups with a resource policy of a size greater than 5120 characters, configure a log group with a path that starts with /aws/vendedlogs. For more information, see Enabling logging from certain Amazon Web Services services.

          • S3Configuration — (map)

            The Amazon S3 bucket destination of user activity log export with advanced security features. To activate this setting, advanced security features must be active in your user pool.

            • BucketArn — (String)

              The ARN of an Amazon S3 bucket that's the destination for advanced security features log export.

          • FirehoseConfiguration — (map)

            The Amazon Data Firehose stream destination of user activity log export with advanced security features. To activate this setting, advanced security features must be active in your user pool.

            • StreamArn — (String)

              The ARN of an Amazon Data Firehose stream that's the destination for advanced security features log export.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

setRiskConfiguration(params = {}, callback) ⇒ AWS.Request

Configures actions on detected risks. To delete the risk configuration for UserPoolId or ClientId, pass null values for all four configuration types.

To activate Amazon Cognito advanced security features, update the user pool to include the UserPoolAddOns keyAdvancedSecurityMode.

Service Reference:

Examples:

Calling the setRiskConfiguration operation

var params = {
  UserPoolId: 'STRING_VALUE', /* required */
  AccountTakeoverRiskConfiguration: {
    Actions: { /* required */
      HighAction: {
        EventAction: BLOCK | MFA_IF_CONFIGURED | MFA_REQUIRED | NO_ACTION, /* required */
        Notify: true || false /* required */
      },
      LowAction: {
        EventAction: BLOCK | MFA_IF_CONFIGURED | MFA_REQUIRED | NO_ACTION, /* required */
        Notify: true || false /* required */
      },
      MediumAction: {
        EventAction: BLOCK | MFA_IF_CONFIGURED | MFA_REQUIRED | NO_ACTION, /* required */
        Notify: true || false /* required */
      }
    },
    NotifyConfiguration: {
      SourceArn: 'STRING_VALUE', /* required */
      BlockEmail: {
        Subject: 'STRING_VALUE', /* required */
        HtmlBody: 'STRING_VALUE',
        TextBody: 'STRING_VALUE'
      },
      From: 'STRING_VALUE',
      MfaEmail: {
        Subject: 'STRING_VALUE', /* required */
        HtmlBody: 'STRING_VALUE',
        TextBody: 'STRING_VALUE'
      },
      NoActionEmail: {
        Subject: 'STRING_VALUE', /* required */
        HtmlBody: 'STRING_VALUE',
        TextBody: 'STRING_VALUE'
      },
      ReplyTo: 'STRING_VALUE'
    }
  },
  ClientId: 'STRING_VALUE',
  CompromisedCredentialsRiskConfiguration: {
    Actions: { /* required */
      EventAction: BLOCK | NO_ACTION /* required */
    },
    EventFilter: [
      SIGN_IN | PASSWORD_CHANGE | SIGN_UP,
      /* more items */
    ]
  },
  RiskExceptionConfiguration: {
    BlockedIPRangeList: [
      'STRING_VALUE',
      /* more items */
    ],
    SkippedIPRangeList: [
      'STRING_VALUE',
      /* more items */
    ]
  }
};
cognitoidentityserviceprovider.setRiskConfiguration(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

      The user pool ID.

    • ClientId — (String)

      The app client ID. If ClientId is null, then the risk configuration is mapped to userPoolId. When the client ID is null, the same risk configuration is applied to all the clients in the userPool.

      Otherwise, ClientId is mapped to the client. When the client ID isn't null, the user pool configuration is overridden and the risk configuration for the client is used instead.

    • CompromisedCredentialsRiskConfiguration — (map)

      The compromised credentials risk configuration.

      • EventFilter — (Array<String>)

        Perform the action for these events. The default is to perform all events if no event filter is specified.

      • Actionsrequired — (map)

        The compromised credentials risk configuration actions.

        • EventActionrequired — (String)

          The event action.

          Possible values include:
          • "BLOCK"
          • "NO_ACTION"
    • AccountTakeoverRiskConfiguration — (map)

      The account takeover risk configuration.

      • NotifyConfiguration — (map)

        The notify configuration used to construct email notifications.

        • From — (String)

          The email address that is sending the email. The address must be either individually verified with Amazon Simple Email Service, or from a domain that has been verified with Amazon SES.

        • ReplyTo — (String)

          The destination to which the receiver of an email should reply to.

        • SourceArnrequired — (String)

          The Amazon Resource Name (ARN) of the identity that is associated with the sending authorization policy. This identity permits Amazon Cognito to send for the email address specified in the From parameter.

        • BlockEmail — (map)

          Email template used when a detected risk event is blocked.

          • Subjectrequired — (String)

            The email subject.

          • HtmlBody — (String)

            The email HTML body.

          • TextBody — (String)

            The email text body.

        • NoActionEmail — (map)

          The email template used when a detected risk event is allowed.

          • Subjectrequired — (String)

            The email subject.

          • HtmlBody — (String)

            The email HTML body.

          • TextBody — (String)

            The email text body.

        • MfaEmail — (map)

          The multi-factor authentication (MFA) email template used when MFA is challenged as part of a detected risk.

          • Subjectrequired — (String)

            The email subject.

          • HtmlBody — (String)

            The email HTML body.

          • TextBody — (String)

            The email text body.

      • Actionsrequired — (map)

        Account takeover risk configuration actions.

        • LowAction — (map)

          Action to take for a low risk.

          • Notifyrequired — (Boolean)

            Flag specifying whether to send a notification.

          • EventActionrequired — (String)

            The action to take in response to the account takeover action. Valid values are as follows:

            • BLOCK Choosing this action will block the request.

            • MFA_IF_CONFIGURED Present an MFA challenge if user has configured it, else allow the request.

            • MFA_REQUIRED Present an MFA challenge if user has configured it, else block the request.

            • NO_ACTION Allow the user to sign in.

            Possible values include:
            • "BLOCK"
            • "MFA_IF_CONFIGURED"
            • "MFA_REQUIRED"
            • "NO_ACTION"
        • MediumAction — (map)

          Action to take for a medium risk.

          • Notifyrequired — (Boolean)

            Flag specifying whether to send a notification.

          • EventActionrequired — (String)

            The action to take in response to the account takeover action. Valid values are as follows:

            • BLOCK Choosing this action will block the request.

            • MFA_IF_CONFIGURED Present an MFA challenge if user has configured it, else allow the request.

            • MFA_REQUIRED Present an MFA challenge if user has configured it, else block the request.

            • NO_ACTION Allow the user to sign in.

            Possible values include:
            • "BLOCK"
            • "MFA_IF_CONFIGURED"
            • "MFA_REQUIRED"
            • "NO_ACTION"
        • HighAction — (map)

          Action to take for a high risk.

          • Notifyrequired — (Boolean)

            Flag specifying whether to send a notification.

          • EventActionrequired — (String)

            The action to take in response to the account takeover action. Valid values are as follows:

            • BLOCK Choosing this action will block the request.

            • MFA_IF_CONFIGURED Present an MFA challenge if user has configured it, else allow the request.

            • MFA_REQUIRED Present an MFA challenge if user has configured it, else block the request.

            • NO_ACTION Allow the user to sign in.

            Possible values include:
            • "BLOCK"
            • "MFA_IF_CONFIGURED"
            • "MFA_REQUIRED"
            • "NO_ACTION"
    • RiskExceptionConfiguration — (map)

      The configuration to override the risk decision.

      • BlockedIPRangeList — (Array<String>)

        Overrides the risk decision to always block the pre-authentication requests. The IP range is in CIDR notation, a compact representation of an IP address and its routing prefix.

      • SkippedIPRangeList — (Array<String>)

        Risk detection isn't performed on the IP addresses in this range list. The IP range is in CIDR notation.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • RiskConfiguration — (map)

        The risk configuration.

        • UserPoolId — (String)

          The user pool ID.

        • ClientId — (String)

          The app client ID.

        • CompromisedCredentialsRiskConfiguration — (map)

          The compromised credentials risk configuration object, including the EventFilter and the EventAction.

          • EventFilter — (Array<String>)

            Perform the action for these events. The default is to perform all events if no event filter is specified.

          • Actionsrequired — (map)

            The compromised credentials risk configuration actions.

            • EventActionrequired — (String)

              The event action.

              Possible values include:
              • "BLOCK"
              • "NO_ACTION"
        • AccountTakeoverRiskConfiguration — (map)

          The account takeover risk configuration object, including the NotifyConfiguration object and Actions to take if there is an account takeover.

          • NotifyConfiguration — (map)

            The notify configuration used to construct email notifications.

            • From — (String)

              The email address that is sending the email. The address must be either individually verified with Amazon Simple Email Service, or from a domain that has been verified with Amazon SES.

            • ReplyTo — (String)

              The destination to which the receiver of an email should reply to.

            • SourceArnrequired — (String)

              The Amazon Resource Name (ARN) of the identity that is associated with the sending authorization policy. This identity permits Amazon Cognito to send for the email address specified in the From parameter.

            • BlockEmail — (map)

              Email template used when a detected risk event is blocked.

              • Subjectrequired — (String)

                The email subject.

              • HtmlBody — (String)

                The email HTML body.

              • TextBody — (String)

                The email text body.

            • NoActionEmail — (map)

              The email template used when a detected risk event is allowed.

              • Subjectrequired — (String)

                The email subject.

              • HtmlBody — (String)

                The email HTML body.

              • TextBody — (String)

                The email text body.

            • MfaEmail — (map)

              The multi-factor authentication (MFA) email template used when MFA is challenged as part of a detected risk.

              • Subjectrequired — (String)

                The email subject.

              • HtmlBody — (String)

                The email HTML body.

              • TextBody — (String)

                The email text body.

          • Actionsrequired — (map)

            Account takeover risk configuration actions.

            • LowAction — (map)

              Action to take for a low risk.

              • Notifyrequired — (Boolean)

                Flag specifying whether to send a notification.

              • EventActionrequired — (String)

                The action to take in response to the account takeover action. Valid values are as follows:

                • BLOCK Choosing this action will block the request.

                • MFA_IF_CONFIGURED Present an MFA challenge if user has configured it, else allow the request.

                • MFA_REQUIRED Present an MFA challenge if user has configured it, else block the request.

                • NO_ACTION Allow the user to sign in.

                Possible values include:
                • "BLOCK"
                • "MFA_IF_CONFIGURED"
                • "MFA_REQUIRED"
                • "NO_ACTION"
            • MediumAction — (map)

              Action to take for a medium risk.

              • Notifyrequired — (Boolean)

                Flag specifying whether to send a notification.

              • EventActionrequired — (String)

                The action to take in response to the account takeover action. Valid values are as follows:

                • BLOCK Choosing this action will block the request.

                • MFA_IF_CONFIGURED Present an MFA challenge if user has configured it, else allow the request.

                • MFA_REQUIRED Present an MFA challenge if user has configured it, else block the request.

                • NO_ACTION Allow the user to sign in.

                Possible values include:
                • "BLOCK"
                • "MFA_IF_CONFIGURED"
                • "MFA_REQUIRED"
                • "NO_ACTION"
            • HighAction — (map)

              Action to take for a high risk.

              • Notifyrequired — (Boolean)

                Flag specifying whether to send a notification.

              • EventActionrequired — (String)

                The action to take in response to the account takeover action. Valid values are as follows:

                • BLOCK Choosing this action will block the request.

                • MFA_IF_CONFIGURED Present an MFA challenge if user has configured it, else allow the request.

                • MFA_REQUIRED Present an MFA challenge if user has configured it, else block the request.

                • NO_ACTION Allow the user to sign in.

                Possible values include:
                • "BLOCK"
                • "MFA_IF_CONFIGURED"
                • "MFA_REQUIRED"
                • "NO_ACTION"
        • RiskExceptionConfiguration — (map)

          The configuration to override the risk decision.

          • BlockedIPRangeList — (Array<String>)

            Overrides the risk decision to always block the pre-authentication requests. The IP range is in CIDR notation, a compact representation of an IP address and its routing prefix.

          • SkippedIPRangeList — (Array<String>)

            Risk detection isn't performed on the IP addresses in this range list. The IP range is in CIDR notation.

        • LastModifiedDate — (Date)

          The date and time when the item was modified. Amazon Cognito returns this timestamp in UNIX epoch time format. Your SDK might render the output in a human-readable format like ISO 8601 or a Java Date object.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

setUICustomization(params = {}, callback) ⇒ AWS.Request

Sets the user interface (UI) customization information for a user pool's built-in app UI.

You can specify app UI customization settings for a single client (with a specific clientId) or for all clients (by setting the clientId to ALL). If you specify ALL, the default configuration is used for every client that has no previously set UI customization. If you specify UI customization settings for a particular client, it will no longer return to the ALL configuration.

Note: To use this API, your user pool must have a domain associated with it. Otherwise, there is no place to host the app's pages, and the service will throw an error.

Service Reference:

Examples:

Calling the setUICustomization operation

var params = {
  UserPoolId: 'STRING_VALUE', /* required */
  CSS: 'STRING_VALUE',
  ClientId: 'STRING_VALUE',
  ImageFile: Buffer.from('...') || 'STRING_VALUE' /* Strings will be Base-64 encoded on your behalf */
};
cognitoidentityserviceprovider.setUICustomization(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

      The user pool ID for the user pool.

    • ClientId — (String)

      The client ID for the client app.

    • CSS — (String)

      The CSS values in the UI customization.

    • ImageFile — (Buffer, Typed Array, Blob, String)

      The uploaded logo image for the UI customization.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • UICustomization — (map)

        The UI customization information.

        • UserPoolId — (String)

          The user pool ID for the user pool.

        • ClientId — (String)

          The client ID for the client app.

        • ImageUrl — (String)

          The logo image for the UI customization.

        • CSS — (String)

          The CSS values in the UI customization.

        • CSSVersion — (String)

          The CSS version number.

        • LastModifiedDate — (Date)

          The date and time when the item was modified. Amazon Cognito returns this timestamp in UNIX epoch time format. Your SDK might render the output in a human-readable format like ISO 8601 or a Java Date object.

        • CreationDate — (Date)

          The date and time when the item was created. Amazon Cognito returns this timestamp in UNIX epoch time format. Your SDK might render the output in a human-readable format like ISO 8601 or a Java Date object.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

setUserMFAPreference(params = {}, callback) ⇒ AWS.Request

Set the user's multi-factor authentication (MFA) method preference, including which MFA factors are activated and if any are preferred. Only one factor can be set as preferred. The preferred MFA factor will be used to authenticate a user if multiple factors are activated. If multiple options are activated and no preference is set, a challenge to choose an MFA option will be returned during sign-in. If an MFA type is activated for a user, the user will be prompted for MFA during all sign-in attempts unless device tracking is turned on and the device has been trusted. If you want MFA to be applied selectively based on the assessed risk level of sign-in attempts, deactivate MFA for users and turn on Adaptive Authentication for the user pool.

Authorize this action with a signed-in user's access token. It must include the scope aws.cognito.signin.user.admin.

Note: Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.

Service Reference:

Examples:

Calling the setUserMFAPreference operation

var params = {
  AccessToken: 'STRING_VALUE', /* required */
  SMSMfaSettings: {
    Enabled: true || false,
    PreferredMfa: true || false
  },
  SoftwareTokenMfaSettings: {
    Enabled: true || false,
    PreferredMfa: true || false
  }
};
cognitoidentityserviceprovider.setUserMFAPreference(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • SMSMfaSettings — (map)

      The SMS text message multi-factor authentication (MFA) settings.

      • Enabled — (Boolean)

        Specifies whether SMS text message MFA is activated. If an MFA type is activated for a user, the user will be prompted for MFA during all sign-in attempts, unless device tracking is turned on and the device has been trusted.

      • PreferredMfa — (Boolean)

        Specifies whether SMS is the preferred MFA method.

    • SoftwareTokenMfaSettings — (map)

      The time-based one-time password (TOTP) software token MFA settings.

      • Enabled — (Boolean)

        Specifies whether software token MFA is activated. If an MFA type is activated for a user, the user will be prompted for MFA during all sign-in attempts, unless device tracking is turned on and the device has been trusted.

      • PreferredMfa — (Boolean)

        Specifies whether software token MFA is the preferred MFA method.

    • AccessToken — (String)

      A valid access token that Amazon Cognito issued to the user whose MFA preference you want to set.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

setUserPoolMfaConfig(params = {}, callback) ⇒ AWS.Request

Sets the user pool multi-factor authentication (MFA) configuration.

Note: This action might generate an SMS text message. Starting June 1, 2021, US telecom carriers require you to register an origination phone number before you can send SMS messages to US phone numbers. If you use SMS text messages in Amazon Cognito, you must register a phone number with Amazon Pinpoint. Amazon Cognito uses the registered number automatically. Otherwise, Amazon Cognito users who must receive SMS messages might not be able to sign up, activate their accounts, or sign in. If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Services service, Amazon Simple Notification Service might place your account in the SMS sandbox. In sandbox mode , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see SMS message settings for Amazon Cognito user pools in the Amazon Cognito Developer Guide.

Service Reference:

Examples:

Calling the setUserPoolMfaConfig operation

var params = {
  UserPoolId: 'STRING_VALUE', /* required */
  MfaConfiguration: OFF | ON | OPTIONAL,
  SmsMfaConfiguration: {
    SmsAuthenticationMessage: 'STRING_VALUE',
    SmsConfiguration: {
      SnsCallerArn: 'STRING_VALUE', /* required */
      ExternalId: 'STRING_VALUE',
      SnsRegion: 'STRING_VALUE'
    }
  },
  SoftwareTokenMfaConfiguration: {
    Enabled: true || false
  }
};
cognitoidentityserviceprovider.setUserPoolMfaConfig(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

      The user pool ID.

    • SmsMfaConfiguration — (map)

      The SMS text message MFA configuration.

      • SmsAuthenticationMessage — (String)

        The SMS authentication message that will be sent to users with the code they must sign in. The message must contain the ‘{####}’ placeholder, which is replaced with the code. If the message isn't included, and default message will be used.

      • SmsConfiguration — (map)

        The SMS configuration with the settings that your Amazon Cognito user pool must use to send an SMS message from your Amazon Web Services account through Amazon Simple Notification Service. To request Amazon SNS in the Amazon Web Services Region that you want, the Amazon Cognito user pool uses an Identity and Access Management (IAM) role that you provide for your Amazon Web Services account.

        • SnsCallerArnrequired — (String)

          The Amazon Resource Name (ARN) of the Amazon SNS caller. This is the ARN of the IAM role in your Amazon Web Services account that Amazon Cognito will use to send SMS messages. SMS messages are subject to a spending limit.

        • ExternalId — (String)

          The external ID provides additional security for your IAM role. You can use an ExternalId with the IAM role that you use with Amazon SNS to send SMS messages for your user pool. If you provide an ExternalId, your Amazon Cognito user pool includes it in the request to assume your IAM role. You can configure the role trust policy to require that Amazon Cognito, and any principal, provide the ExternalID. If you use the Amazon Cognito Management Console to create a role for SMS multi-factor authentication (MFA), Amazon Cognito creates a role with the required permissions and a trust policy that demonstrates use of the ExternalId.

          For more information about the ExternalId of a role, see How to use an external ID when granting access to your Amazon Web Services resources to a third party

        • SnsRegion — (String)

          The Amazon Web Services Region to use with Amazon SNS integration. You can choose the same Region as your user pool, or a supported Legacy Amazon SNS alternate Region.

          Amazon Cognito resources in the Asia Pacific (Seoul) Amazon Web Services Region must use your Amazon SNS configuration in the Asia Pacific (Tokyo) Region. For more information, see SMS message settings for Amazon Cognito user pools.

    • SoftwareTokenMfaConfiguration — (map)

      The software token MFA configuration.

      • Enabled — (Boolean)

        Specifies whether software token MFA is activated.

    • MfaConfiguration — (String)

      The MFA configuration. If you set the MfaConfiguration value to ‘ON’, only users who have set up an MFA factor can sign in. To learn more, see Adding Multi-Factor Authentication (MFA) to a user pool. Valid values include:

      • OFF MFA won't be used for any users.

      • ON MFA is required for all users to sign in.

      • OPTIONAL MFA will be required only for individual users who have an MFA factor activated.

      Possible values include:
      • "OFF"
      • "ON"
      • "OPTIONAL"

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • SmsMfaConfiguration — (map)

        The SMS text message MFA configuration.

        • SmsAuthenticationMessage — (String)

          The SMS authentication message that will be sent to users with the code they must sign in. The message must contain the ‘{####}’ placeholder, which is replaced with the code. If the message isn't included, and default message will be used.

        • SmsConfiguration — (map)

          The SMS configuration with the settings that your Amazon Cognito user pool must use to send an SMS message from your Amazon Web Services account through Amazon Simple Notification Service. To request Amazon SNS in the Amazon Web Services Region that you want, the Amazon Cognito user pool uses an Identity and Access Management (IAM) role that you provide for your Amazon Web Services account.

          • SnsCallerArnrequired — (String)

            The Amazon Resource Name (ARN) of the Amazon SNS caller. This is the ARN of the IAM role in your Amazon Web Services account that Amazon Cognito will use to send SMS messages. SMS messages are subject to a spending limit.

          • ExternalId — (String)

            The external ID provides additional security for your IAM role. You can use an ExternalId with the IAM role that you use with Amazon SNS to send SMS messages for your user pool. If you provide an ExternalId, your Amazon Cognito user pool includes it in the request to assume your IAM role. You can configure the role trust policy to require that Amazon Cognito, and any principal, provide the ExternalID. If you use the Amazon Cognito Management Console to create a role for SMS multi-factor authentication (MFA), Amazon Cognito creates a role with the required permissions and a trust policy that demonstrates use of the ExternalId.

            For more information about the ExternalId of a role, see How to use an external ID when granting access to your Amazon Web Services resources to a third party

          • SnsRegion — (String)

            The Amazon Web Services Region to use with Amazon SNS integration. You can choose the same Region as your user pool, or a supported Legacy Amazon SNS alternate Region.

            Amazon Cognito resources in the Asia Pacific (Seoul) Amazon Web Services Region must use your Amazon SNS configuration in the Asia Pacific (Tokyo) Region. For more information, see SMS message settings for Amazon Cognito user pools.

      • SoftwareTokenMfaConfiguration — (map)

        The software token MFA configuration.

        • Enabled — (Boolean)

          Specifies whether software token MFA is activated.

      • MfaConfiguration — (String)

        The MFA configuration. Valid values include:

        • OFF MFA won't be used for any users.

        • ON MFA is required for all users to sign in.

        • OPTIONAL MFA will be required only for individual users who have an MFA factor enabled.

        Possible values include:
        • "OFF"
        • "ON"
        • "OPTIONAL"

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

setUserSettings(params = {}, callback) ⇒ AWS.Request

This action is no longer supported. You can use it to configure only SMS MFA. You can't use it to configure time-based one-time password (TOTP) software token MFA. To configure either type of MFA, use SetUserMFAPreference instead.

Authorize this action with a signed-in user's access token. It must include the scope aws.cognito.signin.user.admin.

Note: Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.

Service Reference:

Examples:

Calling the setUserSettings operation

var params = {
  AccessToken: 'STRING_VALUE', /* required */
  MFAOptions: [ /* required */
    {
      AttributeName: 'STRING_VALUE',
      DeliveryMedium: SMS | EMAIL
    },
    /* more items */
  ]
};
cognitoidentityserviceprovider.setUserSettings(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • AccessToken — (String)

      A valid access token that Amazon Cognito issued to the user whose user settings you want to configure.

    • MFAOptions — (Array<map>)

      You can use this parameter only to set an SMS configuration that uses SMS for delivery.

      • DeliveryMedium — (String)

        The delivery medium to send the MFA code. You can use this parameter to set only the SMS delivery medium value.

        Possible values include:
        • "SMS"
        • "EMAIL"
      • AttributeName — (String)

        The attribute name of the MFA option type. The only valid value is phone_number.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

signUp(params = {}, callback) ⇒ AWS.Request

Registers the user in the specified user pool and creates a user name, password, and user attributes.

Note: Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.
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 Services service, Amazon Simple Notification Service might place your account in the SMS sandbox. In sandbox mode , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see SMS message settings for Amazon Cognito user pools in the Amazon Cognito Developer Guide.

Service Reference:

Examples:

Calling the signUp operation

var params = {
  ClientId: 'STRING_VALUE', /* required */
  Password: 'STRING_VALUE', /* required */
  Username: 'STRING_VALUE', /* required */
  AnalyticsMetadata: {
    AnalyticsEndpointId: 'STRING_VALUE'
  },
  ClientMetadata: {
    '<StringType>': 'STRING_VALUE',
    /* '<StringType>': ... */
  },
  SecretHash: 'STRING_VALUE',
  UserAttributes: [
    {
      Name: 'STRING_VALUE', /* required */
      Value: 'STRING_VALUE'
    },
    /* more items */
  ],
  UserContextData: {
    EncodedData: 'STRING_VALUE',
    IpAddress: 'STRING_VALUE'
  },
  ValidationData: [
    {
      Name: 'STRING_VALUE', /* required */
      Value: 'STRING_VALUE'
    },
    /* more items */
  ]
};
cognitoidentityserviceprovider.signUp(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • ClientId — (String)

      The ID of the client associated with the user pool.

    • SecretHash — (String)

      A keyed-hash message authentication code (HMAC) calculated using the secret key of a user pool client and username plus the client ID in the message.

    • Username — (String)

      The username of the user that you want to sign up. The value of this parameter is typically a username, but can be any alias attribute in your user pool.

    • Password — (String)

      The password of the user you want to register.

    • UserAttributes — (Array<map>)

      An array of name-value pairs representing user attributes.

      For custom attributes, you must prepend the custom: prefix to the attribute name.

      • Namerequired — (String)

        The name of the attribute.

      • Value — (String)

        The value of the attribute.

    • ValidationData — (Array<map>)

      Temporary user attributes that contribute to the outcomes of your pre sign-up Lambda trigger. This set of key-value pairs are for custom validation of information that you collect from your users but don't need to retain.

      Your Lambda function can analyze this additional data and act on it. Your function might perform external API operations like logging user attributes and validation data to Amazon CloudWatch Logs. Validation data might also affect the response that your function returns to Amazon Cognito, like automatically confirming the user if they sign up from within your network.

      For more information about the pre sign-up Lambda trigger, see Pre sign-up Lambda trigger.

      • Namerequired — (String)

        The name of the attribute.

      • Value — (String)

        The value of the attribute.

    • AnalyticsMetadata — (map)

      The Amazon Pinpoint analytics metadata that contributes to your metrics for SignUp calls.

      • AnalyticsEndpointId — (String)

        The endpoint ID.

    • UserContextData — (map)

      Contextual data about your user session, such as the device fingerprint, IP address, or location. Amazon Cognito advanced security evaluates the risk of an authentication event based on the context that your app generates and passes to Amazon Cognito when it makes API requests.

      • IpAddress — (String)

        The source IP address of your user's device.

      • EncodedData — (String)

        Encoded device-fingerprint details that your app collected with the Amazon Cognito context data collection library. For more information, see Adding user device and session data to API requests.

    • ClientMetadata — (map<String>)

      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.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • UserConfirmed — (Boolean)

        A response from the server indicating that a user registration has been confirmed.

      • CodeDeliveryDetails — (map)

        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.

          Possible values include:
          • "SMS"
          • "EMAIL"
        • AttributeName — (String)

          The name of the attribute that Amazon Cognito verifies with the code.

      • UserSub — (String)

        The 128-bit ID of the authenticated user. This isn't the same as username.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

startUserImportJob(params = {}, callback) ⇒ AWS.Request

Starts the user import.

Service Reference:

Examples:

Calling the startUserImportJob operation

var params = {
  JobId: 'STRING_VALUE', /* required */
  UserPoolId: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.startUserImportJob(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

      The user pool ID for the user pool that the users are being imported into.

    • JobId — (String)

      The job ID for the user import job.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • UserImportJob — (map)

        The job object that represents the user import job.

        • JobName — (String)

          The job name for the user import job.

        • JobId — (String)

          The job ID for the user import job.

        • UserPoolId — (String)

          The user pool ID for the user pool that the users are being imported into.

        • PreSignedUrl — (String)

          The pre-signed URL to be used to upload the .csv file.

        • CreationDate — (Date)

          The date and time when the item was created. Amazon Cognito returns this timestamp in UNIX epoch time format. Your SDK might render the output in a human-readable format like ISO 8601 or a Java Date object.

        • StartDate — (Date)

          The date when the user import job was started.

        • CompletionDate — (Date)

          The date when the user import job was completed.

        • Status — (String)

          The status of the user import job. One of the following:

          • Created - The job was created but not started.

          • Pending - A transition state. You have started the job, but it has not begun importing users yet.

          • InProgress - The job has started, and users are being imported.

          • Stopping - You have stopped the job, but the job has not stopped importing users yet.

          • Stopped - You have stopped the job, and the job has stopped importing users.

          • Succeeded - The job has completed successfully.

          • Failed - The job has stopped due to an error.

          • Expired - You created a job, but did not start the job within 24-48 hours. All data associated with the job was deleted, and the job can't be started.

          Possible values include:
          • "Created"
          • "Pending"
          • "InProgress"
          • "Stopping"
          • "Expired"
          • "Stopped"
          • "Failed"
          • "Succeeded"
        • CloudWatchLogsRoleArn — (String)

          The role Amazon Resource Name (ARN) for the Amazon CloudWatch Logging role for the user import job. For more information, see "Creating the CloudWatch Logs IAM Role" in the Amazon Cognito Developer Guide.

        • ImportedUsers — (Integer)

          The number of users that were successfully imported.

        • SkippedUsers — (Integer)

          The number of users that were skipped.

        • FailedUsers — (Integer)

          The number of users that couldn't be imported.

        • CompletionMessage — (String)

          The message returned when the user import job is completed.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

stopUserImportJob(params = {}, callback) ⇒ AWS.Request

Stops the user import job.

Service Reference:

Examples:

Calling the stopUserImportJob operation

var params = {
  JobId: 'STRING_VALUE', /* required */
  UserPoolId: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.stopUserImportJob(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

      The user pool ID for the user pool that the users are being imported into.

    • JobId — (String)

      The job ID for the user import job.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • UserImportJob — (map)

        The job object that represents the user import job.

        • JobName — (String)

          The job name for the user import job.

        • JobId — (String)

          The job ID for the user import job.

        • UserPoolId — (String)

          The user pool ID for the user pool that the users are being imported into.

        • PreSignedUrl — (String)

          The pre-signed URL to be used to upload the .csv file.

        • CreationDate — (Date)

          The date and time when the item was created. Amazon Cognito returns this timestamp in UNIX epoch time format. Your SDK might render the output in a human-readable format like ISO 8601 or a Java Date object.

        • StartDate — (Date)

          The date when the user import job was started.

        • CompletionDate — (Date)

          The date when the user import job was completed.

        • Status — (String)

          The status of the user import job. One of the following:

          • Created - The job was created but not started.

          • Pending - A transition state. You have started the job, but it has not begun importing users yet.

          • InProgress - The job has started, and users are being imported.

          • Stopping - You have stopped the job, but the job has not stopped importing users yet.

          • Stopped - You have stopped the job, and the job has stopped importing users.

          • Succeeded - The job has completed successfully.

          • Failed - The job has stopped due to an error.

          • Expired - You created a job, but did not start the job within 24-48 hours. All data associated with the job was deleted, and the job can't be started.

          Possible values include:
          • "Created"
          • "Pending"
          • "InProgress"
          • "Stopping"
          • "Expired"
          • "Stopped"
          • "Failed"
          • "Succeeded"
        • CloudWatchLogsRoleArn — (String)

          The role Amazon Resource Name (ARN) for the Amazon CloudWatch Logging role for the user import job. For more information, see "Creating the CloudWatch Logs IAM Role" in the Amazon Cognito Developer Guide.

        • ImportedUsers — (Integer)

          The number of users that were successfully imported.

        • SkippedUsers — (Integer)

          The number of users that were skipped.

        • FailedUsers — (Integer)

          The number of users that couldn't be imported.

        • CompletionMessage — (String)

          The message returned when the user import job is completed.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

tagResource(params = {}, callback) ⇒ AWS.Request

Assigns a set of tags to an Amazon Cognito user pool. A tag is a label that you can use to categorize and manage user pools in different ways, such as by purpose, owner, environment, or other criteria.

Each tag consists of a key and value, both of which you define. A key is a general category for more specific values. For example, if you have two versions of a user pool, one for testing and another for production, you might assign an Environment tag key to both user pools. The value of this key might be Test for one user pool, and Production for the other.

Tags are useful for cost tracking and access control. You can activate your tags so that they appear on the Billing and Cost Management console, where you can track the costs associated with your user pools. In an Identity and Access Management policy, you can constrain permissions for user pools based on specific tags or tag values.

You can use this action up to 5 times per second, per account. A user pool can have as many as 50 tags.

Service Reference:

Examples:

Calling the tagResource operation

var params = {
  ResourceArn: 'STRING_VALUE', /* required */
  Tags: { /* required */
    '<TagKeysType>': 'STRING_VALUE',
    /* '<TagKeysType>': ... */
  }
};
cognitoidentityserviceprovider.tagResource(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • ResourceArn — (String)

      The Amazon Resource Name (ARN) of the user pool to assign the tags to.

    • Tags — (map<String>)

      The tags to assign to the user pool.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

untagResource(params = {}, callback) ⇒ AWS.Request

Removes the specified tags from an Amazon Cognito user pool. You can use this action up to 5 times per second, per account.

Service Reference:

Examples:

Calling the untagResource operation

var params = {
  ResourceArn: 'STRING_VALUE', /* required */
  TagKeys: [ /* required */
    'STRING_VALUE',
    /* more items */
  ]
};
cognitoidentityserviceprovider.untagResource(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • ResourceArn — (String)

      The Amazon Resource Name (ARN) of the user pool that the tags are assigned to.

    • TagKeys — (Array<String>)

      The keys of the tags to remove from the user pool.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

updateAuthEventFeedback(params = {}, callback) ⇒ AWS.Request

Provides the feedback for an authentication event, whether it was from a valid user or not. This feedback is used for improving the risk evaluation decision for the user pool as part of Amazon Cognito advanced security.

Note: Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.

Service Reference:

Examples:

Calling the updateAuthEventFeedback operation

var params = {
  EventId: 'STRING_VALUE', /* required */
  FeedbackToken: 'STRING_VALUE', /* required */
  FeedbackValue: Valid | Invalid, /* required */
  UserPoolId: 'STRING_VALUE', /* required */
  Username: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.updateAuthEventFeedback(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

      The user pool ID.

    • Username — (String)

      The username of the user that you want to query or modify. The value of this parameter is typically your user's username, but it can be any of their alias attributes. If username isn't an alias attribute in your user pool, this value must be the sub of a local user or the username of a user from a third-party IdP.

    • EventId — (String)

      The event ID.

    • FeedbackToken — (String)

      The feedback token.

    • FeedbackValue — (String)

      The authentication event feedback value. When you provide a FeedbackValue value of valid, you tell Amazon Cognito that you trust a user session where Amazon Cognito has evaluated some level of risk. When you provide a FeedbackValue value of invalid, you tell Amazon Cognito that you don't trust a user session, or you don't believe that Amazon Cognito evaluated a high-enough risk level.

      Possible values include:
      • "Valid"
      • "Invalid"

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

updateDeviceStatus(params = {}, callback) ⇒ AWS.Request

Updates the device status. For more information about device authentication, see Working with user devices in your user pool.

Authorize this action with a signed-in user's access token. It must include the scope aws.cognito.signin.user.admin.

Note: Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.

Service Reference:

Examples:

Calling the updateDeviceStatus operation

var params = {
  AccessToken: 'STRING_VALUE', /* required */
  DeviceKey: 'STRING_VALUE', /* required */
  DeviceRememberedStatus: remembered | not_remembered
};
cognitoidentityserviceprovider.updateDeviceStatus(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • AccessToken — (String)

      A valid access token that Amazon Cognito issued to the user whose device status you want to update.

    • DeviceKey — (String)

      The device key.

    • DeviceRememberedStatus — (String)

      The status of whether a device is remembered.

      Possible values include:
      • "remembered"
      • "not_remembered"

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

updateGroup(params = {}, callback) ⇒ AWS.Request

Updates the specified group with the specified attributes.

Note: Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding IAM permission in a policy.

Learn more

Service Reference:

Examples:

Calling the updateGroup operation

var params = {
  GroupName: 'STRING_VALUE', /* required */
  UserPoolId: 'STRING_VALUE', /* required */
  Description: 'STRING_VALUE',
  Precedence: 'NUMBER_VALUE',
  RoleArn: 'STRING_VALUE'
};
cognitoidentityserviceprovider.updateGroup(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • GroupName — (String)

      The name of the group.

    • UserPoolId — (String)

      The user pool ID for the user pool.

    • Description — (String)

      A string containing the new description of the group.

    • RoleArn — (String)

      The new role Amazon Resource Name (ARN) for the group. This is used for setting the cognito:roles and cognito:preferred_role claims in the token.

    • Precedence — (Integer)

      The new precedence value for the group. For more information about this parameter, see CreateGroup.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Group — (map)

        The group object for the group.

        • GroupName — (String)

          The name of the group.

        • UserPoolId — (String)

          The user pool ID for the user pool.

        • Description — (String)

          A string containing the description of the group.

        • RoleArn — (String)

          The role Amazon Resource Name (ARN) for the group.

        • Precedence — (Integer)

          A non-negative integer value that specifies the precedence of this group relative to the other groups that a user can belong to in the user pool. Zero is the highest precedence value. Groups with lower Precedence values take precedence over groups with higher ornull Precedence values. If a user belongs to two or more groups, it is the group with the lowest precedence value whose role ARN is given in the user's tokens for the cognito:roles and cognito:preferred_role claims.

          Two groups can have the same Precedence value. If this happens, neither group takes precedence over the other. If two groups with the same Precedence have the same role ARN, that role is used in the cognito:preferred_role claim in tokens for users in each group. If the two groups have different role ARNs, the cognito:preferred_role claim isn't set in users' tokens.

          The default Precedence value is null.

        • LastModifiedDate — (Date)

          The date and time when the item was modified. Amazon Cognito returns this timestamp in UNIX epoch time format. Your SDK might render the output in a human-readable format like ISO 8601 or a Java Date object.

        • CreationDate — (Date)

          The date and time when the item was created. Amazon Cognito returns this timestamp in UNIX epoch time format. Your SDK might render the output in a human-readable format like ISO 8601 or a Java Date object.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

updateIdentityProvider(params = {}, callback) ⇒ AWS.Request

Updates IdP information for a user pool.

Note: Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding IAM permission in a policy.

Learn more

Service Reference:

Examples:

Calling the updateIdentityProvider operation

var params = {
  ProviderName: 'STRING_VALUE', /* required */
  UserPoolId: 'STRING_VALUE', /* required */
  AttributeMapping: {
    '<AttributeMappingKeyType>': 'STRING_VALUE',
    /* '<AttributeMappingKeyType>': ... */
  },
  IdpIdentifiers: [
    'STRING_VALUE',
    /* more items */
  ],
  ProviderDetails: {
    '<StringType>': 'STRING_VALUE',
    /* '<StringType>': ... */
  }
};
cognitoidentityserviceprovider.updateIdentityProvider(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

      The user pool ID.

    • ProviderName — (String)

      The IdP name.

    • ProviderDetails — (map<String>)

      The scopes, URLs, and identifiers for your external identity provider. The following examples describe the provider detail keys for each IdP type. These values and their schema are subject to change. Social IdP authorize_scopes values must match the values listed here.

      OpenID Connect (OIDC)

      Amazon Cognito accepts the following elements when it can't discover endpoint URLs from oidc_issuer: attributes_url, authorize_url, jwks_uri, token_url.

      Create or update request: "ProviderDetails": { "attributes_request_method": "GET", "attributes_url": "https://auth.example.com/userInfo", "authorize_scopes": "openid profile email", "authorize_url": "https://auth.example.com/authorize", "client_id": "1example23456789", "client_secret": "provider-app-client-secret", "jwks_uri": "https://auth.example.com/.well-known/jwks.json", "oidc_issuer": "https://auth.example.com", "token_url": "https://example.com/token" }

      Describe response: "ProviderDetails": { "attributes_request_method": "GET", "attributes_url": "https://auth.example.com/userInfo", "attributes_url_add_attributes": "false", "authorize_scopes": "openid profile email", "authorize_url": "https://auth.example.com/authorize", "client_id": "1example23456789", "client_secret": "provider-app-client-secret", "jwks_uri": "https://auth.example.com/.well-known/jwks.json", "oidc_issuer": "https://auth.example.com", "token_url": "https://example.com/token" }

      SAML

      Create or update request with Metadata URL: "ProviderDetails": { "IDPInit": "true", "IDPSignout": "true", "EncryptedResponses" : "true", "MetadataURL": "https://auth.example.com/sso/saml/metadata", "RequestSigningAlgorithm": "rsa-sha256" }

      Create or update request with Metadata file: "ProviderDetails": { "IDPInit": "true", "IDPSignout": "true", "EncryptedResponses" : "true", "MetadataFile": "[metadata XML]", "RequestSigningAlgorithm": "rsa-sha256" }

      The value of MetadataFile must be the plaintext metadata document with all quote (") characters escaped by backslashes.

      Describe response: "ProviderDetails": { "IDPInit": "true", "IDPSignout": "true", "EncryptedResponses" : "true", "ActiveEncryptionCertificate": "[certificate]", "MetadataURL": "https://auth.example.com/sso/saml/metadata", "RequestSigningAlgorithm": "rsa-sha256", "SLORedirectBindingURI": "https://auth.example.com/slo/saml", "SSORedirectBindingURI": "https://auth.example.com/sso/saml" }

      LoginWithAmazon

      Create or update request: "ProviderDetails": { "authorize_scopes": "profile postal_code", "client_id": "amzn1.application-oa2-client.1example23456789", "client_secret": "provider-app-client-secret"

      Describe response: "ProviderDetails": { "attributes_url": "https://api.amazon.com/user/profile", "attributes_url_add_attributes": "false", "authorize_scopes": "profile postal_code", "authorize_url": "https://www.amazon.com/ap/oa", "client_id": "amzn1.application-oa2-client.1example23456789", "client_secret": "provider-app-client-secret", "token_request_method": "POST", "token_url": "https://api.amazon.com/auth/o2/token" }

      Google

      Create or update request: "ProviderDetails": { "authorize_scopes": "email profile openid", "client_id": "1example23456789.apps.googleusercontent.com", "client_secret": "provider-app-client-secret" }

      Describe response: "ProviderDetails": { "attributes_url": "https://people.googleapis.com/v1/people/me?personFields=", "attributes_url_add_attributes": "true", "authorize_scopes": "email profile openid", "authorize_url": "https://accounts.google.com/o/oauth2/v2/auth", "client_id": "1example23456789.apps.googleusercontent.com", "client_secret": "provider-app-client-secret", "oidc_issuer": "https://accounts.google.com", "token_request_method": "POST", "token_url": "https://www.googleapis.com/oauth2/v4/token" }

      SignInWithApple

      Create or update request: "ProviderDetails": { "authorize_scopes": "email name", "client_id": "com.example.cognito", "private_key": "1EXAMPLE", "key_id": "2EXAMPLE", "team_id": "3EXAMPLE" }

      Describe response: "ProviderDetails": { "attributes_url_add_attributes": "false", "authorize_scopes": "email name", "authorize_url": "https://appleid.apple.com/auth/authorize", "client_id": "com.example.cognito", "key_id": "1EXAMPLE", "oidc_issuer": "https://appleid.apple.com", "team_id": "2EXAMPLE", "token_request_method": "POST", "token_url": "https://appleid.apple.com/auth/token" }

      Facebook

      Create or update request: "ProviderDetails": { "api_version": "v17.0", "authorize_scopes": "public_profile, email", "client_id": "1example23456789", "client_secret": "provider-app-client-secret" }

      Describe response: "ProviderDetails": { "api_version": "v17.0", "attributes_url": "https://graph.facebook.com/v17.0/me?fields=", "attributes_url_add_attributes": "true", "authorize_scopes": "public_profile, email", "authorize_url": "https://www.facebook.com/v17.0/dialog/oauth", "client_id": "1example23456789", "client_secret": "provider-app-client-secret", "token_request_method": "GET", "token_url": "https://graph.facebook.com/v17.0/oauth/access&#95;token" }

    • AttributeMapping — (map<String>)

      The IdP attribute mapping to be changed.

    • IdpIdentifiers — (Array<String>)

      A list of IdP identifiers.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • IdentityProvider — (map)

        The identity provider details.

        • UserPoolId — (String)

          The user pool ID.

        • ProviderName — (String)

          The IdP name.

        • ProviderType — (String)

          The IdP type.

          Possible values include:
          • "SAML"
          • "Facebook"
          • "Google"
          • "LoginWithAmazon"
          • "SignInWithApple"
          • "OIDC"
        • ProviderDetails — (map<String>)

          The scopes, URLs, and identifiers for your external identity provider. The following examples describe the provider detail keys for each IdP type. These values and their schema are subject to change. Social IdP authorize_scopes values must match the values listed here.

          OpenID Connect (OIDC)

          Amazon Cognito accepts the following elements when it can't discover endpoint URLs from oidc_issuer: attributes_url, authorize_url, jwks_uri, token_url.

          Create or update request: "ProviderDetails": { "attributes_request_method": "GET", "attributes_url": "https://auth.example.com/userInfo", "authorize_scopes": "openid profile email", "authorize_url": "https://auth.example.com/authorize", "client_id": "1example23456789", "client_secret": "provider-app-client-secret", "jwks_uri": "https://auth.example.com/.well-known/jwks.json", "oidc_issuer": "https://auth.example.com", "token_url": "https://example.com/token" }

          Describe response: "ProviderDetails": { "attributes_request_method": "GET", "attributes_url": "https://auth.example.com/userInfo", "attributes_url_add_attributes": "false", "authorize_scopes": "openid profile email", "authorize_url": "https://auth.example.com/authorize", "client_id": "1example23456789", "client_secret": "provider-app-client-secret", "jwks_uri": "https://auth.example.com/.well-known/jwks.json", "oidc_issuer": "https://auth.example.com", "token_url": "https://example.com/token" }

          SAML

          Create or update request with Metadata URL: "ProviderDetails": { "IDPInit": "true", "IDPSignout": "true", "EncryptedResponses" : "true", "MetadataURL": "https://auth.example.com/sso/saml/metadata", "RequestSigningAlgorithm": "rsa-sha256" }

          Create or update request with Metadata file: "ProviderDetails": { "IDPInit": "true", "IDPSignout": "true", "EncryptedResponses" : "true", "MetadataFile": "[metadata XML]", "RequestSigningAlgorithm": "rsa-sha256" }

          The value of MetadataFile must be the plaintext metadata document with all quote (") characters escaped by backslashes.

          Describe response: "ProviderDetails": { "IDPInit": "true", "IDPSignout": "true", "EncryptedResponses" : "true", "ActiveEncryptionCertificate": "[certificate]", "MetadataURL": "https://auth.example.com/sso/saml/metadata", "RequestSigningAlgorithm": "rsa-sha256", "SLORedirectBindingURI": "https://auth.example.com/slo/saml", "SSORedirectBindingURI": "https://auth.example.com/sso/saml" }

          LoginWithAmazon

          Create or update request: "ProviderDetails": { "authorize_scopes": "profile postal_code", "client_id": "amzn1.application-oa2-client.1example23456789", "client_secret": "provider-app-client-secret"

          Describe response: "ProviderDetails": { "attributes_url": "https://api.amazon.com/user/profile", "attributes_url_add_attributes": "false", "authorize_scopes": "profile postal_code", "authorize_url": "https://www.amazon.com/ap/oa", "client_id": "amzn1.application-oa2-client.1example23456789", "client_secret": "provider-app-client-secret", "token_request_method": "POST", "token_url": "https://api.amazon.com/auth/o2/token" }

          Google

          Create or update request: "ProviderDetails": { "authorize_scopes": "email profile openid", "client_id": "1example23456789.apps.googleusercontent.com", "client_secret": "provider-app-client-secret" }

          Describe response: "ProviderDetails": { "attributes_url": "https://people.googleapis.com/v1/people/me?personFields=", "attributes_url_add_attributes": "true", "authorize_scopes": "email profile openid", "authorize_url": "https://accounts.google.com/o/oauth2/v2/auth", "client_id": "1example23456789.apps.googleusercontent.com", "client_secret": "provider-app-client-secret", "oidc_issuer": "https://accounts.google.com", "token_request_method": "POST", "token_url": "https://www.googleapis.com/oauth2/v4/token" }

          SignInWithApple

          Create or update request: "ProviderDetails": { "authorize_scopes": "email name", "client_id": "com.example.cognito", "private_key": "1EXAMPLE", "key_id": "2EXAMPLE", "team_id": "3EXAMPLE" }

          Describe response: "ProviderDetails": { "attributes_url_add_attributes": "false", "authorize_scopes": "email name", "authorize_url": "https://appleid.apple.com/auth/authorize", "client_id": "com.example.cognito", "key_id": "1EXAMPLE", "oidc_issuer": "https://appleid.apple.com", "team_id": "2EXAMPLE", "token_request_method": "POST", "token_url": "https://appleid.apple.com/auth/token" }

          Facebook

          Create or update request: "ProviderDetails": { "api_version": "v17.0", "authorize_scopes": "public_profile, email", "client_id": "1example23456789", "client_secret": "provider-app-client-secret" }

          Describe response: "ProviderDetails": { "api_version": "v17.0", "attributes_url": "https://graph.facebook.com/v17.0/me?fields=", "attributes_url_add_attributes": "true", "authorize_scopes": "public_profile, email", "authorize_url": "https://www.facebook.com/v17.0/dialog/oauth", "client_id": "1example23456789", "client_secret": "provider-app-client-secret", "token_request_method": "GET", "token_url": "https://graph.facebook.com/v17.0/oauth/access&#95;token" }

        • AttributeMapping — (map<String>)

          A mapping of IdP attributes to standard and custom user pool attributes.

        • IdpIdentifiers — (Array<String>)

          A list of IdP identifiers.

        • LastModifiedDate — (Date)

          The date and time when the item was modified. Amazon Cognito returns this timestamp in UNIX epoch time format. Your SDK might render the output in a human-readable format like ISO 8601 or a Java Date object.

        • CreationDate — (Date)

          The date and time when the item was created. Amazon Cognito returns this timestamp in UNIX epoch time format. Your SDK might render the output in a human-readable format like ISO 8601 or a Java Date object.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

updateResourceServer(params = {}, callback) ⇒ AWS.Request

Updates the name and scopes of resource server. All other fields are read-only.

If you don't provide a value for an attribute, it is set to the default value.

Note: Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding IAM permission in a policy.

Learn more

Service Reference:

Examples:

Calling the updateResourceServer operation

var params = {
  Identifier: 'STRING_VALUE', /* required */
  Name: 'STRING_VALUE', /* required */
  UserPoolId: 'STRING_VALUE', /* required */
  Scopes: [
    {
      ScopeDescription: 'STRING_VALUE', /* required */
      ScopeName: 'STRING_VALUE' /* required */
    },
    /* more items */
  ]
};
cognitoidentityserviceprovider.updateResourceServer(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

      The user pool ID for the user pool.

    • Identifier — (String)

      A unique resource server identifier for the resource server. The identifier can be an API friendly name like solar-system-data. You can also set an API URL like https://solar-system-data-api.example.com as your identifier.

      Amazon Cognito represents scopes in the access token in the format $resource-server-identifier/$scope. Longer scope-identifier strings increase the size of your access tokens.

    • Name — (String)

      The name of the resource server.

    • Scopes — (Array<map>)

      The scope values to be set for the resource server.

      • ScopeNamerequired — (String)

        The name of the scope.

      • ScopeDescriptionrequired — (String)

        A description of the scope.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • ResourceServer — (map)

        The resource server.

        • UserPoolId — (String)

          The user pool ID for the user pool that hosts the resource server.

        • Identifier — (String)

          A unique resource server identifier for the resource server. The identifier can be an API friendly name like solar-system-data. You can also set an API URL like https://solar-system-data-api.example.com as your identifier.

          Amazon Cognito represents scopes in the access token in the format $resource-server-identifier/$scope. Longer scope-identifier strings increase the size of your access tokens.

        • Name — (String)

          The name of the resource server.

        • Scopes — (Array<map>)

          A list of scopes that are defined for the resource server.

          • ScopeNamerequired — (String)

            The name of the scope.

          • ScopeDescriptionrequired — (String)

            A description of the scope.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

updateUserAttributes(params = {}, callback) ⇒ AWS.Request

With this operation, your users can update one or more of their attributes with their own credentials. You authorize this API request with the user's access token. To delete an attribute from your user, submit the attribute in your API request with a blank value. Custom attribute values in this request must include the custom: prefix.

Authorize this action with a signed-in user's access token. It must include the scope aws.cognito.signin.user.admin.

Note: Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.
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 Services service, Amazon Simple Notification Service might place your account in the SMS sandbox. In sandbox mode , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see SMS message settings for Amazon Cognito user pools in the Amazon Cognito Developer Guide.

Service Reference:

Examples:

Calling the updateUserAttributes operation

var params = {
  AccessToken: 'STRING_VALUE', /* required */
  UserAttributes: [ /* required */
    {
      Name: 'STRING_VALUE', /* required */
      Value: 'STRING_VALUE'
    },
    /* more items */
  ],
  ClientMetadata: {
    '<StringType>': 'STRING_VALUE',
    /* '<StringType>': ... */
  }
};
cognitoidentityserviceprovider.updateUserAttributes(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserAttributes — (Array<map>)

      An array of name-value pairs representing user attributes.

      For custom attributes, you must prepend the custom: prefix to the attribute name.

      If you have set an attribute to require verification before Amazon Cognito updates its value, this request doesn’t immediately update the value of that attribute. After your user receives and responds to a verification message to verify the new value, Amazon Cognito updates the attribute value. Your user can sign in and receive messages with the original attribute value until they verify the new value.

      • Namerequired — (String)

        The name of the attribute.

      • Value — (String)

        The value of the attribute.

    • AccessToken — (String)

      A valid access token that Amazon Cognito issued to the user whose user attributes you want to update.

    • ClientMetadata — (map<String>)

      A map of custom key-value pairs that you can provide as input for any custom workflows that this action initiates.

      You create custom workflows by assigning Lambda functions to user pool triggers. When you use the UpdateUserAttributes API action, Amazon Cognito invokes the function that is assigned to the custom message trigger. When Amazon Cognito invokes this function, it passes a JSON payload, which the function receives as input. This payload contains a clientMetadata attribute, which provides the data that you assigned to the ClientMetadata parameter in your UpdateUserAttributes request. In your function code in Lambda, you can process the clientMetadata value to enhance your workflow for your specific needs.

      For more information, see Customizing user pool Workflows with Lambda Triggers in the Amazon Cognito Developer Guide.

      Note: When you use the ClientMetadata parameter, remember that Amazon Cognito won't do the following:
      • Store the ClientMetadata value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration doesn't include triggers, the ClientMetadata parameter serves no purpose.
      • Validate the ClientMetadata value.
      • Encrypt the ClientMetadata value. Don't use Amazon Cognito to provide sensitive information.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • CodeDeliveryDetailsList — (Array<map>)

        The code delivery details list from the server for the request to update user attributes.

        • 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.

          Possible values include:
          • "SMS"
          • "EMAIL"
        • AttributeName — (String)

          The name of the attribute that Amazon Cognito verifies with the code.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

updateUserPool(params = {}, callback) ⇒ AWS.Request

Note: This action might generate an SMS text message. Starting June 1, 2021, US telecom carriers require you to register an origination phone number before you can send SMS messages to US phone numbers. If you use SMS text messages in Amazon Cognito, you must register a phone number with Amazon Pinpoint. Amazon Cognito uses the registered number automatically. Otherwise, Amazon Cognito users who must receive SMS messages might not be able to sign up, activate their accounts, or sign in. If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Services service, Amazon Simple Notification Service might place your account in the SMS sandbox. In sandbox mode , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see SMS message settings for Amazon Cognito user pools in the Amazon Cognito Developer Guide.

Updates the specified user pool with the specified attributes. You can get a list of the current user pool settings using DescribeUserPool.

If you don't provide a value for an attribute, Amazon Cognito sets it to its default value.

Note: Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding IAM permission in a policy.

Learn more

Service Reference:

Examples:

Calling the updateUserPool operation

var params = {
  UserPoolId: 'STRING_VALUE', /* required */
  AccountRecoverySetting: {
    RecoveryMechanisms: [
      {
        Name: verified_email | verified_phone_number | admin_only, /* required */
        Priority: 'NUMBER_VALUE' /* required */
      },
      /* more items */
    ]
  },
  AdminCreateUserConfig: {
    AllowAdminCreateUserOnly: true || false,
    InviteMessageTemplate: {
      EmailMessage: 'STRING_VALUE',
      EmailSubject: 'STRING_VALUE',
      SMSMessage: 'STRING_VALUE'
    },
    UnusedAccountValidityDays: 'NUMBER_VALUE'
  },
  AutoVerifiedAttributes: [
    phone_number | email,
    /* more items */
  ],
  DeletionProtection: ACTIVE | INACTIVE,
  DeviceConfiguration: {
    ChallengeRequiredOnNewDevice: true || false,
    DeviceOnlyRememberedOnUserPrompt: true || false
  },
  EmailConfiguration: {
    ConfigurationSet: 'STRING_VALUE',
    EmailSendingAccount: COGNITO_DEFAULT | DEVELOPER,
    From: 'STRING_VALUE',
    ReplyToEmailAddress: 'STRING_VALUE',
    SourceArn: 'STRING_VALUE'
  },
  EmailVerificationMessage: 'STRING_VALUE',
  EmailVerificationSubject: 'STRING_VALUE',
  LambdaConfig: {
    CreateAuthChallenge: 'STRING_VALUE',
    CustomEmailSender: {
      LambdaArn: 'STRING_VALUE', /* required */
      LambdaVersion: V1_0 /* required */
    },
    CustomMessage: 'STRING_VALUE',
    CustomSMSSender: {
      LambdaArn: 'STRING_VALUE', /* required */
      LambdaVersion: V1_0 /* required */
    },
    DefineAuthChallenge: 'STRING_VALUE',
    KMSKeyID: 'STRING_VALUE',
    PostAuthentication: 'STRING_VALUE',
    PostConfirmation: 'STRING_VALUE',
    PreAuthentication: 'STRING_VALUE',
    PreSignUp: 'STRING_VALUE',
    PreTokenGeneration: 'STRING_VALUE',
    PreTokenGenerationConfig: {
      LambdaArn: 'STRING_VALUE', /* required */
      LambdaVersion: V1_0 | V2_0 /* required */
    },
    UserMigration: 'STRING_VALUE',
    VerifyAuthChallengeResponse: 'STRING_VALUE'
  },
  MfaConfiguration: OFF | ON | OPTIONAL,
  Policies: {
    PasswordPolicy: {
      MinimumLength: 'NUMBER_VALUE',
      PasswordHistorySize: 'NUMBER_VALUE',
      RequireLowercase: true || false,
      RequireNumbers: true || false,
      RequireSymbols: true || false,
      RequireUppercase: true || false,
      TemporaryPasswordValidityDays: 'NUMBER_VALUE'
    }
  },
  SmsAuthenticationMessage: 'STRING_VALUE',
  SmsConfiguration: {
    SnsCallerArn: 'STRING_VALUE', /* required */
    ExternalId: 'STRING_VALUE',
    SnsRegion: 'STRING_VALUE'
  },
  SmsVerificationMessage: 'STRING_VALUE',
  UserAttributeUpdateSettings: {
    AttributesRequireVerificationBeforeUpdate: [
      phone_number | email,
      /* more items */
    ]
  },
  UserPoolAddOns: {
    AdvancedSecurityMode: OFF | AUDIT | ENFORCED, /* required */
    AdvancedSecurityAdditionalFlows: {
      CustomAuthMode: AUDIT | ENFORCED
    }
  },
  UserPoolTags: {
    '<TagKeysType>': 'STRING_VALUE',
    /* '<TagKeysType>': ... */
  },
  VerificationMessageTemplate: {
    DefaultEmailOption: CONFIRM_WITH_LINK | CONFIRM_WITH_CODE,
    EmailMessage: 'STRING_VALUE',
    EmailMessageByLink: 'STRING_VALUE',
    EmailSubject: 'STRING_VALUE',
    EmailSubjectByLink: 'STRING_VALUE',
    SmsMessage: 'STRING_VALUE'
  }
};
cognitoidentityserviceprovider.updateUserPool(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

      The user pool ID for the user pool you want to update.

    • Policies — (map)

      A container with the policies you want to update in a user pool.

      • PasswordPolicy — (map)

        The password policy.

        • MinimumLength — (Integer)

          The minimum length of the password in the policy that you have set. This value can't be less than 6.

        • RequireUppercase — (Boolean)

          In the password policy that you have set, refers to whether you have required users to use at least one uppercase letter in their password.

        • RequireLowercase — (Boolean)

          In the password policy that you have set, refers to whether you have required users to use at least one lowercase letter in their password.

        • RequireNumbers — (Boolean)

          In the password policy that you have set, refers to whether you have required users to use at least one number in their password.

        • RequireSymbols — (Boolean)

          In the password policy that you have set, refers to whether you have required users to use at least one symbol in their password.

        • PasswordHistorySize — (Integer)

          The number of previous passwords that you want Amazon Cognito to restrict each user from reusing. Users can't set a password that matches any of n previous passwords, where n is the value of PasswordHistorySize.

          Password history isn't enforced and isn't displayed in DescribeUserPool responses when you set this value to 0 or don't provide it. To activate this setting, advanced security features must be active in your user pool.

        • TemporaryPasswordValidityDays — (Integer)

          The number of days a temporary password is valid in the password policy. If the user doesn't sign in during this time, an administrator must reset their password. Defaults to 7. If you submit a value of 0, Amazon Cognito treats it as a null value and sets TemporaryPasswordValidityDays to its default value.

          Note: When you set TemporaryPasswordValidityDays for a user pool, you can no longer set a value for the legacy UnusedAccountValidityDays parameter in that user pool.
    • DeletionProtection — (String)

      When active, DeletionProtection prevents accidental deletion of your user pool. Before you can delete a user pool that you have protected against deletion, you must deactivate this feature.

      When you try to delete a protected user pool in a DeleteUserPool API request, Amazon Cognito returns an InvalidParameterException error. To delete a protected user pool, send a new DeleteUserPool request after you deactivate deletion protection in an UpdateUserPool API request.

      Possible values include:
      • "ACTIVE"
      • "INACTIVE"
    • LambdaConfig — (map)

      The Lambda configuration information from the request to update the user pool.

      • PreSignUp — (String)

        A pre-registration Lambda trigger.

      • CustomMessage — (String)

        A custom Message Lambda trigger.

      • PostConfirmation — (String)

        A post-confirmation Lambda trigger.

      • PreAuthentication — (String)

        A pre-authentication Lambda trigger.

      • PostAuthentication — (String)

        A post-authentication Lambda trigger.

      • DefineAuthChallenge — (String)

        Defines the authentication challenge.

      • CreateAuthChallenge — (String)

        Creates an authentication challenge.

      • VerifyAuthChallengeResponse — (String)

        Verifies the authentication challenge response.

      • PreTokenGeneration — (String)

        The Amazon Resource Name (ARN) of the function that you want to assign to your Lambda trigger.

        Set this parameter for legacy purposes. If you also set an ARN in PreTokenGenerationConfig, its value must be identical to PreTokenGeneration. For new instances of pre token generation triggers, set the LambdaArn of PreTokenGenerationConfig.

        You can set

      • UserMigration — (String)

        The user migration Lambda config type.

      • PreTokenGenerationConfig — (map)

        The detailed configuration of a pre token generation trigger. If you also set an ARN in PreTokenGeneration, its value must be identical to PreTokenGenerationConfig.

        • LambdaVersionrequired — (String)

          The user pool trigger version of the request that Amazon Cognito sends to your Lambda function. Higher-numbered versions add fields that support new features.

          Possible values include:
          • "V1_0"
          • "V2_0"
        • LambdaArnrequired — (String)

          The Amazon Resource Name (ARN) of the function that you want to assign to your Lambda trigger.

          This parameter and the PreTokenGeneration property of LambdaConfig have the same value. For new instances of pre token generation triggers, set LambdaArn.

      • CustomSMSSender — (map)

        A custom SMS sender Lambda trigger.

        • LambdaVersionrequired — (String)

          The user pool trigger version of the request that Amazon Cognito sends to your Lambda function. Higher-numbered versions add fields that support new features.

          You must use a LambdaVersion of V1_0 with a custom sender function.

          Possible values include:
          • "V1_0"
        • LambdaArnrequired — (String)

          The Amazon Resource Name (ARN) of the function that you want to assign to your Lambda trigger.

      • CustomEmailSender — (map)

        A custom email sender Lambda trigger.

        • LambdaVersionrequired — (String)

          The user pool trigger version of the request that Amazon Cognito sends to your Lambda function. Higher-numbered versions add fields that support new features.

          You must use a LambdaVersion of V1_0 with a custom sender function.

          Possible values include:
          • "V1_0"
        • LambdaArnrequired — (String)

          The Amazon Resource Name (ARN) of the function that you want to assign to your Lambda trigger.

      • KMSKeyID — (String)

        The Amazon Resource Name (ARN) of an KMS key. Amazon Cognito uses the key to encrypt codes and temporary passwords sent to CustomEmailSender and CustomSMSSender.

    • AutoVerifiedAttributes — (Array<String>)

      The attributes that are automatically verified when Amazon Cognito requests to update user pools.

    • SmsVerificationMessage — (String)

      This parameter is no longer used. See VerificationMessageTemplateType.

    • EmailVerificationMessage — (String)

      This parameter is no longer used. See VerificationMessageTemplateType.

    • EmailVerificationSubject — (String)

      This parameter is no longer used. See VerificationMessageTemplateType.

    • VerificationMessageTemplate — (map)

      The template for verification messages.

      • SmsMessage — (String)

        The template for SMS messages that Amazon Cognito sends to your users.

      • EmailMessage — (String)

        The template for email messages that Amazon Cognito sends to your users. You can set an EmailMessage template only if the value of EmailSendingAccount is DEVELOPER. When your EmailSendingAccount is DEVELOPER, your user pool sends email messages with your own Amazon SES configuration.

      • EmailSubject — (String)

        The subject line for the email message template. You can set an EmailSubject template only if the value of EmailSendingAccount is DEVELOPER. When your EmailSendingAccount is DEVELOPER, your user pool sends email messages with your own Amazon SES configuration.

      • EmailMessageByLink — (String)

        The email message template for sending a confirmation link to the user. You can set an EmailMessageByLink template only if the value of EmailSendingAccount is DEVELOPER. When your EmailSendingAccount is DEVELOPER, your user pool sends email messages with your own Amazon SES configuration.

      • EmailSubjectByLink — (String)

        The subject line for the email message template for sending a confirmation link to the user. You can set an EmailSubjectByLink template only if the value of EmailSendingAccount is DEVELOPER. When your EmailSendingAccount is DEVELOPER, your user pool sends email messages with your own Amazon SES configuration.

      • DefaultEmailOption — (String)

        The default email option.

        Possible values include:
        • "CONFIRM_WITH_LINK"
        • "CONFIRM_WITH_CODE"
    • SmsAuthenticationMessage — (String)

      The contents of the SMS authentication message.

    • UserAttributeUpdateSettings — (map)

      The settings for updates to user attributes. These settings include the property AttributesRequireVerificationBeforeUpdate, a user-pool setting that tells Amazon Cognito how to handle changes to the value of your users' email address and phone number attributes. For more information, see Verifying updates to email addresses and phone numbers.

      • AttributesRequireVerificationBeforeUpdate — (Array<String>)

        Requires that your user verifies their email address, phone number, or both before Amazon Cognito updates the value of that attribute. When you update a user attribute that has this option activated, Amazon Cognito sends a verification message to the new phone number or email address. Amazon Cognito doesn’t change the value of the attribute until your user responds to the verification message and confirms the new value.

        You can verify an updated email address or phone number with a VerifyUserAttribute API request. You can also call the AdminUpdateUserAttributes API and set email_verified or phone_number_verified to true.

        When AttributesRequireVerificationBeforeUpdate is false, your user pool doesn't require that your users verify attribute changes before Amazon Cognito updates them. In a user pool where AttributesRequireVerificationBeforeUpdate is false, API operations that change attribute values can immediately update a user’s email or phone_number attribute.

    • MfaConfiguration — (String)

      Possible values include:

      • OFF - MFA tokens aren't required and can't be specified during user registration.

      • ON - MFA tokens are required for all user registrations. You can only specify ON when you're initially creating a user pool. You can use the SetUserPoolMfaConfig API operation to turn MFA "ON" for existing user pools.

      • OPTIONAL - Users have the option when registering to create an MFA token.

      Possible values include:
      • "OFF"
      • "ON"
      • "OPTIONAL"
    • DeviceConfiguration — (map)

      The device-remembering configuration for a user pool. A null value indicates that you have deactivated device remembering in your user pool.

      Note: When you provide a value for any DeviceConfiguration field, you activate the Amazon Cognito device-remembering feature.
      • ChallengeRequiredOnNewDevice — (Boolean)

        When true, a remembered device can sign in with device authentication instead of SMS and time-based one-time password (TOTP) factors for multi-factor authentication (MFA).

        Note: Whether or not ChallengeRequiredOnNewDevice is true, users who sign in with devices that have not been confirmed or remembered must still provide a second factor in a user pool that requires MFA.
      • DeviceOnlyRememberedOnUserPrompt — (Boolean)

        When true, Amazon Cognito doesn't automatically remember a user's device when your app sends a ConfirmDevice API request. In your app, create a prompt for your user to choose whether they want to remember their device. Return the user's choice in an UpdateDeviceStatus API request.

        When DeviceOnlyRememberedOnUserPrompt is false, Amazon Cognito immediately remembers devices that you register in a ConfirmDevice API request.

    • EmailConfiguration — (map)

      The email configuration of your user pool. The email configuration type sets your preferred sending method, Amazon Web Services Region, and sender for email invitation and verification messages from your user pool.

      • SourceArn — (String)

        The ARN of a verified email address or an address from a verified domain in Amazon SES. You can set a SourceArn email from a verified domain only with an API request. You can set a verified email address, but not an address in a verified domain, in the Amazon Cognito console. Amazon Cognito uses the email address that you provide in one of the following ways, depending on the value that you specify for the EmailSendingAccount parameter:

        • If you specify COGNITO_DEFAULT, Amazon Cognito uses this address as the custom FROM address when it emails your users using its built-in email account.

        • If you specify DEVELOPER, Amazon Cognito emails your users with this address by calling Amazon SES on your behalf.

        The Region value of the SourceArn parameter must indicate a supported Amazon Web Services Region of your user pool. Typically, the Region in the SourceArn and the user pool Region are the same. For more information, see Amazon SES email configuration regions in the Amazon Cognito Developer Guide.

      • ReplyToEmailAddress — (String)

        The destination to which the receiver of the email should reply.

      • EmailSendingAccount — (String)

        Specifies whether Amazon Cognito uses its built-in functionality to send your users email messages, or uses your Amazon Simple Email Service email configuration. Specify one of the following values:

        COGNITO_DEFAULT

        When Amazon Cognito emails your users, it uses its built-in email functionality. When you use the default option, Amazon Cognito allows only a limited number of emails each day for your user pool. For typical production environments, the default email limit is less than the required delivery volume. To achieve a higher delivery volume, specify DEVELOPER to use your Amazon SES email configuration.

        To look up the email delivery limit for the default option, see Limits in the Amazon Cognito Developer Guide.

        The default FROM address is no-reply@verificationemail.com. To customize the FROM address, provide the Amazon Resource Name (ARN) of an Amazon SES verified email address for the SourceArn parameter.

        DEVELOPER

        When Amazon Cognito emails your users, it uses your Amazon SES configuration. Amazon Cognito calls Amazon SES on your behalf to send email from your verified email address. When you use this option, the email delivery limits are the same limits that apply to your Amazon SES verified email address in your Amazon Web Services account.

        If you use this option, provide the ARN of an Amazon SES verified email address for the SourceArn parameter.

        Before Amazon Cognito can email your users, it requires additional permissions to call Amazon SES on your behalf. When you update your user pool with this option, Amazon Cognito creates a service-linked role, which is a type of role in your Amazon Web Services account. This role contains the permissions that allow you to access Amazon SES and send email messages from your email address. For more information about the service-linked role that Amazon Cognito creates, see Using Service-Linked Roles for Amazon Cognito in the Amazon Cognito Developer Guide.

        Possible values include:
        • "COGNITO_DEFAULT"
        • "DEVELOPER"
      • From — (String)

        Either the sender’s email address or the sender’s name with their email address. For example, testuser@example.com or Test User <testuser@example.com>. This address appears before the body of the email.

      • ConfigurationSet — (String)

        The set of configuration rules that can be applied to emails sent using Amazon Simple Email Service. A configuration set is applied to an email by including a reference to the configuration set in the headers of the email. Once applied, all of the rules in that configuration set are applied to the email. Configuration sets can be used to apply the following types of rules to emails:

        Event publishing

        Amazon Simple Email Service can track the number of send, delivery, open, click, bounce, and complaint events for each email sent. Use event publishing to send information about these events to other Amazon Web Services services such as and Amazon CloudWatch

        IP pool management

        When leasing dedicated IP addresses with Amazon Simple Email Service, you can create groups of IP addresses, called dedicated IP pools. You can then associate the dedicated IP pools with configuration sets.

    • SmsConfiguration — (map)

      The SMS configuration with the settings that your Amazon Cognito user pool must use to send an SMS message from your Amazon Web Services account through Amazon Simple Notification Service. To send SMS messages with Amazon SNS in the Amazon Web Services Region that you want, the Amazon Cognito user pool uses an Identity and Access Management (IAM) role in your Amazon Web Services account.

      • SnsCallerArnrequired — (String)

        The Amazon Resource Name (ARN) of the Amazon SNS caller. This is the ARN of the IAM role in your Amazon Web Services account that Amazon Cognito will use to send SMS messages. SMS messages are subject to a spending limit.

      • ExternalId — (String)

        The external ID provides additional security for your IAM role. You can use an ExternalId with the IAM role that you use with Amazon SNS to send SMS messages for your user pool. If you provide an ExternalId, your Amazon Cognito user pool includes it in the request to assume your IAM role. You can configure the role trust policy to require that Amazon Cognito, and any principal, provide the ExternalID. If you use the Amazon Cognito Management Console to create a role for SMS multi-factor authentication (MFA), Amazon Cognito creates a role with the required permissions and a trust policy that demonstrates use of the ExternalId.

        For more information about the ExternalId of a role, see How to use an external ID when granting access to your Amazon Web Services resources to a third party

      • SnsRegion — (String)

        The Amazon Web Services Region to use with Amazon SNS integration. You can choose the same Region as your user pool, or a supported Legacy Amazon SNS alternate Region.

        Amazon Cognito resources in the Asia Pacific (Seoul) Amazon Web Services Region must use your Amazon SNS configuration in the Asia Pacific (Tokyo) Region. For more information, see SMS message settings for Amazon Cognito user pools.

    • UserPoolTags — (map<String>)

      The tag keys and values to assign to the user pool. A tag is a label that you can use to categorize and manage user pools in different ways, such as by purpose, owner, environment, or other criteria.

    • AdminCreateUserConfig — (map)

      The configuration for AdminCreateUser requests.

      • AllowAdminCreateUserOnly — (Boolean)

        Set to True if only the administrator is allowed to create user profiles. Set to False if users can sign themselves up via an app.

      • UnusedAccountValidityDays — (Integer)

        The user account expiration limit, in days, after which a new account that hasn't signed in is no longer usable. To reset the account after that time limit, you must call AdminCreateUser again, specifying "RESEND" for the MessageAction parameter. The default value for this parameter is 7.

        Note: If you set a value for TemporaryPasswordValidityDays in PasswordPolicy, that value will be used, and UnusedAccountValidityDays will be no longer be an available parameter for that user pool.
      • InviteMessageTemplate — (map)

        The message template to be used for the welcome message to new users.

        See also Customizing User Invitation Messages.

        • SMSMessage — (String)

          The message template for SMS messages.

        • EmailMessage — (String)

          The message template for email messages. EmailMessage is allowed only if EmailSendingAccount is DEVELOPER.

        • EmailSubject — (String)

          The subject line for email messages. EmailSubject is allowed only if EmailSendingAccount is DEVELOPER.

    • UserPoolAddOns — (map)

      User pool add-ons. Contains settings for activation of advanced security features. To log user security information but take no action, set to AUDIT. To configure automatic security responses to risky traffic to your user pool, set to ENFORCED.

      For more information, see Adding advanced security to a user pool.

      • AdvancedSecurityModerequired — (String)

        The operating mode of advanced security features for standard authentication types in your user pool, including username-password and secure remote password (SRP) authentication.

        Possible values include:
        • "OFF"
        • "AUDIT"
        • "ENFORCED"
      • AdvancedSecurityAdditionalFlows — (map)

        Advanced security configuration options for additional authentication types in your user pool, including custom authentication.

    • AccountRecoverySetting — (map)

      The available verified method a user can use to recover their password when they call ForgotPassword. You can use this setting to define a preferred method when a user has more than one method available. With this setting, SMS doesn't qualify for a valid password recovery mechanism if the user also has SMS multi-factor authentication (MFA) activated. In the absence of this setting, Amazon Cognito uses the legacy behavior to determine the recovery method where SMS is preferred through email.

      • RecoveryMechanisms — (Array<map>)

        The list of RecoveryOptionTypes.

        • Priorityrequired — (Integer)

          A positive integer specifying priority of a method with 1 being the highest priority.

        • Namerequired — (String)

          The recovery method for a user.

          Possible values include:
          • "verified_email"
          • "verified_phone_number"
          • "admin_only"

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

updateUserPoolClient(params = {}, callback) ⇒ AWS.Request

Updates the specified user pool app client with the specified attributes. You can get a list of the current user pool app client settings using DescribeUserPoolClient.

If you don't provide a value for an attribute, Amazon Cognito sets it to its default value.

You can also use this operation to enable token revocation for user pool clients. For more information about revoking tokens, see RevokeToken.

Note: Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding IAM permission in a policy.

Learn more

Service Reference:

Examples:

Calling the updateUserPoolClient operation

var params = {
  ClientId: 'STRING_VALUE', /* required */
  UserPoolId: 'STRING_VALUE', /* required */
  AccessTokenValidity: 'NUMBER_VALUE',
  AllowedOAuthFlows: [
    code | implicit | client_credentials,
    /* more items */
  ],
  AllowedOAuthFlowsUserPoolClient: true || false,
  AllowedOAuthScopes: [
    'STRING_VALUE',
    /* more items */
  ],
  AnalyticsConfiguration: {
    ApplicationArn: 'STRING_VALUE',
    ApplicationId: 'STRING_VALUE',
    ExternalId: 'STRING_VALUE',
    RoleArn: 'STRING_VALUE',
    UserDataShared: true || false
  },
  AuthSessionValidity: 'NUMBER_VALUE',
  CallbackURLs: [
    'STRING_VALUE',
    /* more items */
  ],
  ClientName: 'STRING_VALUE',
  DefaultRedirectURI: 'STRING_VALUE',
  EnablePropagateAdditionalUserContextData: true || false,
  EnableTokenRevocation: true || false,
  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,
    /* more items */
  ],
  IdTokenValidity: 'NUMBER_VALUE',
  LogoutURLs: [
    'STRING_VALUE',
    /* more items */
  ],
  PreventUserExistenceErrors: LEGACY | ENABLED,
  ReadAttributes: [
    'STRING_VALUE',
    /* more items */
  ],
  RefreshTokenValidity: 'NUMBER_VALUE',
  SupportedIdentityProviders: [
    'STRING_VALUE',
    /* more items */
  ],
  TokenValidityUnits: {
    AccessToken: seconds | minutes | hours | days,
    IdToken: seconds | minutes | hours | days,
    RefreshToken: seconds | minutes | hours | days
  },
  WriteAttributes: [
    'STRING_VALUE',
    /* more items */
  ]
};
cognitoidentityserviceprovider.updateUserPoolClient(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UserPoolId — (String)

      The user pool ID for the user pool where you want to update the user pool client.

    • ClientId — (String)

      The ID of the client associated with the user pool.

    • ClientName — (String)

      The client name from the update user pool client request.

    • RefreshTokenValidity — (Integer)

      The refresh token time limit. After this limit expires, your user can't use their refresh token. To specify the time unit for RefreshTokenValidity as seconds, minutes, hours, or days, set a TokenValidityUnits value in your API request.

      For example, when you set RefreshTokenValidity as 10 and TokenValidityUnits as days, your user can refresh their session and retrieve new access and ID tokens for 10 days.

      The default time unit for RefreshTokenValidity in an API request is days. You can't set RefreshTokenValidity to 0. If you do, Amazon Cognito overrides the value with the default value of 30 days. Valid range is displayed below in seconds.

      If you don't specify otherwise in the configuration of your app client, your refresh tokens are valid for 30 days.

    • 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.

      If you don't specify otherwise in the configuration of your app client, your access tokens are valid for one hour.

    • 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 IdTokenValidity in an API request is hours. Valid range is displayed below in seconds.

      If you don't specify otherwise in the configuration of your app client, your ID tokens are valid for one hour.

    • TokenValidityUnits — (map)

      The time units you use when you set the duration of ID, access, and refresh tokens. The default unit for RefreshToken is days, and the default for ID and access tokens is hours.

      • 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. AccessTokenValidity duration can range from five minutes to one day.

        Possible values include:
        • "seconds"
        • "minutes"
        • "hours"
        • "days"
      • 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. IdTokenValidity duration can range from five minutes to one day.

        Possible values include:
        • "seconds"
        • "minutes"
        • "hours"
        • "days"
      • 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. RefreshTokenValidity duration can range from 60 minutes to 10 years.

        Possible values include:
        • "seconds"
        • "minutes"
        • "hours"
        • "days"
    • ReadAttributes — (Array<String>)

      The list of user attributes that you want your app client to have read-only access to. After your user authenticates in your app, their access token authorizes them to read their own attribute value for any attribute in this list. An example of this kind of activity is when your user selects a link to view their profile information. Your app makes a GetUser API request to retrieve and display your user's profile data.

      When you don't specify the ReadAttributes for your app client, your app can read the values of email_verified, phone_number_verified, and the Standard attributes of your user pool. When your user pool has read access to these default attributes, ReadAttributes doesn't return any information. Amazon Cognito only populates ReadAttributes in the API response if you have specified your own custom set of read attributes.

    • WriteAttributes — (Array<String>)

      The list of user attributes that you want your app client to have write access to. After your user authenticates in your app, their access token authorizes them to set or modify their own attribute value for any attribute in this list. An example of this kind of activity is when you present your user with a form to update their profile information and they change their last name. Your app then makes an UpdateUserAttributes API request and sets family_name to the new value.

      When you don't specify the WriteAttributes for your app client, your app can write the values of the Standard attributes of your user pool. When your user pool has write access to these default attributes, WriteAttributes doesn't return any information. Amazon Cognito only populates WriteAttributes in the API response if you have specified your own custom set of write attributes.

      If your app client allows users to sign in through an IdP, this array must include all attributes that you have mapped to IdP attributes. Amazon Cognito updates mapped attributes when users sign in to your application through an IdP. If your app client does not have write access to a mapped attribute, Amazon Cognito throws an error when it tries to update the attribute. For more information, see Specifying IdP Attribute Mappings for Your user pool.

    • ExplicitAuthFlows — (Array<String>)

      The authentication flows that you want your user pool client to support. For each app client in your user pool, you can sign in your users with any combination of one or more flows, including with a user name and Secure Remote Password (SRP), a user name and password, or a custom authentication process that you define with Lambda functions.

      Note: If you don't specify a value for ExplicitAuthFlows, your user client supports ALLOW_REFRESH_TOKEN_AUTH, ALLOW_USER_SRP_AUTH, and ALLOW_CUSTOM_AUTH.

      Valid values include:

      • ALLOW_ADMIN_USER_PASSWORD_AUTH: Enable admin based user password authentication flow ADMIN_USER_PASSWORD_AUTH. This setting replaces the ADMIN_NO_SRP_AUTH setting. With this authentication flow, your app passes a user name and password to Amazon Cognito in the request, instead of using the Secure Remote Password (SRP) protocol to securely transmit the password.

      • ALLOW_CUSTOM_AUTH: Enable Lambda trigger based authentication.

      • ALLOW_USER_PASSWORD_AUTH: Enable user password-based authentication. In this flow, Amazon Cognito receives the password in the request instead of using the SRP protocol to verify passwords.

      • ALLOW_USER_SRP_AUTH: Enable SRP-based authentication.

      • ALLOW_REFRESH_TOKEN_AUTH: Enable authflow to refresh tokens.

      In some environments, you will see the values ADMIN_NO_SRP_AUTH, CUSTOM_AUTH_FLOW_ONLY, or USER_PASSWORD_AUTH. You can't assign these legacy ExplicitAuthFlows values to user pool clients at the same time as values that begin with ALLOW_, like ALLOW_USER_SRP_AUTH.

    • SupportedIdentityProviders — (Array<String>)

      A list of provider names for the IdPs that this client supports. The following are supported: COGNITO, Facebook, Google, SignInWithApple, LoginWithAmazon, and the names of your own SAML and OIDC providers.

    • CallbackURLs — (Array<String>)

      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.

    • LogoutURLs — (Array<String>)

      A list of allowed logout URLs for the IdPs.

    • 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 — (Array<String>)

      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.

    • AllowedOAuthScopes — (Array<String>)

      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.

    • AllowedOAuthFlowsUserPoolClient — (Boolean)

      Set to true to use OAuth 2.0 features in your user pool app client.

      AllowedOAuthFlowsUserPoolClient must be true before you can configure the following features in your app client.

      • CallBackURLs: Callback URLs.

      • LogoutURLs: Sign-out redirect URLs.

      • AllowedOAuthScopes: OAuth 2.0 scopes.

      • AllowedOAuthFlows: Support for authorization code, implicit, and client credentials OAuth 2.0 grants.

      To use OAuth 2.0 features, configure one of these features in the Amazon Cognito console or set AllowedOAuthFlowsUserPoolClient to true in a CreateUserPoolClient or UpdateUserPoolClient API request. If you don't set a value for AllowedOAuthFlowsUserPoolClient in a request with the CLI or SDKs, it defaults to false.

    • AnalyticsConfiguration — (map)

      The Amazon Pinpoint analytics configuration necessary to collect metrics for this user pool.

      Note: In Amazon Web Services Regions where Amazon Pinpoint isn't available, user pools only support sending events to Amazon Pinpoint projects in us-east-1. In Regions where Amazon Pinpoint is available, user pools support sending events to Amazon Pinpoint projects within that same Region.
      • ApplicationId — (String)

        The application ID for an Amazon Pinpoint application.

      • ApplicationArn — (String)

        The Amazon Resource Name (ARN) of an Amazon Pinpoint project. You can use the Amazon Pinpoint project to integrate with the chosen user pool Client. Amazon Cognito publishes events to the Amazon Pinpoint project that the app ARN declares.

      • RoleArn — (String)

        The ARN of an Identity and Access Management role that authorizes Amazon Cognito to publish events to Amazon Pinpoint analytics.

      • ExternalId — (String)

        The external ID.

      • UserDataShared — (Boolean)

        If UserDataShared is true, Amazon Cognito includes user data in the events that it publishes to Amazon Pinpoint analytics.

    • PreventUserExistenceErrors — (String)

      Errors and responses that you want Amazon Cognito APIs to return during authentication, account confirmation, and password recovery when the user doesn't exist in the user pool. When set to ENABLED and the user doesn't exist, authentication returns an error indicating either the username or password was incorrect. Account confirmation and password recovery return a response indicating a code was sent to a simulated destination. When set to LEGACY, those APIs return a UserNotFoundException exception if the user doesn't exist in the user pool.

      Valid values include:

      • ENABLED - This prevents user existence-related errors.

      • LEGACY - This represents the early behavior of Amazon Cognito where user existence related errors aren't prevented.

      Defaults to LEGACY when you don't provide a value.

      Possible values include:
      • "LEGACY"
      • "ENABLED"
    • EnableTokenRevocation — (Boolean)

      Activates or deactivates token revocation. For more information about revoking tokens, see RevokeToken.

    • EnablePropagateAdditionalUserContextData — (Boolean)

      Activates the propagation of additional user context data. For more information about propagation of user context data, see Adding advanced security to a user pool. If you don’t include this parameter, you can't send device fingerprint information, including source IP address, to Amazon Cognito advanced security. You can only activate EnablePropagateAdditionalUserContextData in an app client that has a client secret.

    • AuthSessionValidity — (Integer)

      Amazon Cognito creates a session token for each API request in an authentication flow. AuthSessionValidity is the duration, in minutes, of that session token. Your user pool native user must respond to each authentication challenge before the session expires.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • UserPoolClient — (map)

        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 — (Date)

          The date and time when the item was modified. Amazon Cognito returns this timestamp in UNIX epoch time format. Your SDK might render the output in a human-readable format like ISO 8601 or a Java Date object.

        • CreationDate — (Date)

          The date and time when the item was created. Amazon Cognito returns this timestamp in UNIX epoch time format. Your SDK might render the output in a human-readable format like ISO 8601 or a Java Date object.

        • 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.

          If you don't specify otherwise in the configuration of your app client, your refresh tokens are valid for 30 days.

        • 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.

          If you don't specify otherwise in the configuration of your app client, your access tokens are valid for one hour.

        • 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 IdTokenValidity in an API request is hours. Valid range is displayed below in seconds.

          If you don't specify otherwise in the configuration of your app client, your ID tokens are valid for one hour.

        • TokenValidityUnits — (map)

          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. AccessTokenValidity duration can range from five minutes to one day.

            Possible values include:
            • "seconds"
            • "minutes"
            • "hours"
            • "days"
          • 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. IdTokenValidity duration can range from five minutes to one day.

            Possible values include:
            • "seconds"
            • "minutes"
            • "hours"
            • "days"
          • 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. RefreshTokenValidity duration can range from 60 minutes to 10 years.

            Possible values include:
            • "seconds"
            • "minutes"
            • "hours"
            • "days"
        • ReadAttributes — (Array<String>)

          The list of user attributes that you want your app client to have read-only access to. After your user authenticates in your app, their access token authorizes them to read their own attribute value for any attribute in this list. An example of this kind of activity is when your user selects a link to view their profile information. Your app makes a GetUser API request to retrieve and display your user's profile data.

          When you don't specify the ReadAttributes for your app client, your app can read the values of email_verified, phone_number_verified, and the Standard attributes of your user pool. When your user pool has read access to these default attributes, ReadAttributes doesn't return any information. Amazon Cognito only populates ReadAttributes in the API response if you have specified your own custom set of read attributes.

        • WriteAttributes — (Array<String>)

          The list of user attributes that you want your app client to have write access to. After your user authenticates in your app, their access token authorizes them to set or modify their own attribute value for any attribute in this list. An example of this kind of activity is when you present your user with a form to update their profile information and they change their last name. Your app then makes an UpdateUserAttributes API request and sets family_name to the new value.

          When you don't specify the WriteAttributes for your app client, your app can write the values of the Standard attributes of your user pool. When your user pool has write access to these default attributes, WriteAttributes doesn't return any information. Amazon Cognito only populates WriteAttributes in the API response if you have specified your own custom set of write attributes.

          If your app client allows users to sign in through an IdP, this array must include all attributes that you have mapped to IdP attributes. Amazon Cognito updates mapped attributes when users sign in to your application through an IdP. If your app client does not have write access to a mapped attribute, Amazon Cognito throws an error when it tries to update the attribute. For more information, see Specifying IdP Attribute Mappings for Your user pool.

        • ExplicitAuthFlows — (Array<String>)

          The authentication flows that you want your user pool client to support. For each app client in your user pool, you can sign in your users with any combination of one or more flows, including with a user name and Secure Remote Password (SRP), a user name and password, or a custom authentication process that you define with Lambda functions.

          Note: If you don't specify a value for ExplicitAuthFlows, your user client supports ALLOW_REFRESH_TOKEN_AUTH, ALLOW_USER_SRP_AUTH, and ALLOW_CUSTOM_AUTH.

          Valid values include:

          • ALLOW_ADMIN_USER_PASSWORD_AUTH: Enable admin based user password authentication flow ADMIN_USER_PASSWORD_AUTH. This setting replaces the ADMIN_NO_SRP_AUTH setting. With this authentication flow, your app passes a user name and password to Amazon Cognito in the request, instead of using the Secure Remote Password (SRP) protocol to securely transmit the password.

          • ALLOW_CUSTOM_AUTH: Enable Lambda trigger based authentication.

          • ALLOW_USER_PASSWORD_AUTH: Enable user password-based authentication. In this flow, Amazon Cognito receives the password in the request instead of using the SRP protocol to verify passwords.

          • ALLOW_USER_SRP_AUTH: Enable SRP-based authentication.

          • ALLOW_REFRESH_TOKEN_AUTH: Enable authflow to refresh tokens.

          In some environments, you will see the values ADMIN_NO_SRP_AUTH, CUSTOM_AUTH_FLOW_ONLY, or USER_PASSWORD_AUTH. You can't assign these legacy ExplicitAuthFlows values to user pool clients at the same time as values that begin with ALLOW_, like ALLOW_USER_SRP_AUTH.

        • SupportedIdentityProviders — (Array<String>)

          A list of provider names for the IdPs that this client supports. The following are supported: COGNITO, Facebook, Google, SignInWithApple, LoginWithAmazon, and the names of your own SAML and OIDC providers.

        • CallbackURLs — (Array<String>)

          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.

        • LogoutURLs — (Array<String>)

          A list of allowed logout URLs for the IdPs.

        • 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 — (Array<String>)

          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.

        • AllowedOAuthScopes — (Array<String>)

          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.

        • AllowedOAuthFlowsUserPoolClient — (Boolean)

          Set to true to use OAuth 2.0 features in your user pool app client.

          AllowedOAuthFlowsUserPoolClient must be true before you can configure the following features in your app client.

          • CallBackURLs: Callback URLs.

          • LogoutURLs: Sign-out redirect URLs.

          • AllowedOAuthScopes: OAuth 2.0 scopes.

          • AllowedOAuthFlows: Support for authorization code, implicit, and client credentials OAuth 2.0 grants.

          To use OAuth 2.0 features, configure one of these features in the Amazon Cognito console or set AllowedOAuthFlowsUserPoolClient to true in a CreateUserPoolClient or UpdateUserPoolClient API request. If you don't set a value for AllowedOAuthFlowsUserPoolClient in a request with the CLI or SDKs, it defaults to false.

        • AnalyticsConfiguration — (map)

          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 early behavior of Amazon Cognito where user existence related errors aren't prevented.

          Defaults to LEGACY when you don't provide a value.

          Possible values include:
          • "LEGACY"
          • "ENABLED"
        • EnableTokenRevocation — (Boolean)

          Indicates whether token revocation is activated for the user pool client. When you create a new user pool client, token revocation is activated by default. For more information about revoking tokens, see RevokeToken.

        • EnablePropagateAdditionalUserContextData — (Boolean)

          When EnablePropagateAdditionalUserContextData is true, Amazon Cognito accepts an IpAddress value that you send in the UserContextData parameter. The UserContextData parameter sends information to Amazon Cognito advanced security for risk analysis. You can send UserContextData when you sign in Amazon Cognito native users with the InitiateAuth and RespondToAuthChallenge API operations.

          When EnablePropagateAdditionalUserContextData is false, you can't send your user's source IP address to Amazon Cognito advanced security with unauthenticated API operations. EnablePropagateAdditionalUserContextData doesn't affect whether you can send a source IP address in a ContextData parameter with the authenticated API operations AdminInitiateAuth and AdminRespondToAuthChallenge.

          You can only activate EnablePropagateAdditionalUserContextData in an app client that has a client secret. For more information about propagation of user context data, see Adding user device and session data to API requests.

        • AuthSessionValidity — (Integer)

          Amazon Cognito creates a session token for each API request in an authentication flow. AuthSessionValidity is the duration, in minutes, of that session token. Your user pool native user must respond to each authentication challenge before the session expires.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

updateUserPoolDomain(params = {}, callback) ⇒ AWS.Request

Updates the Secure Sockets Layer (SSL) certificate for the custom domain for your user pool.

You can use this operation to provide the Amazon Resource Name (ARN) of a new certificate to Amazon Cognito. You can't use it to change the domain for a user pool.

A custom domain is used to host the Amazon Cognito hosted UI, which provides sign-up and sign-in pages for your application. When you set up a custom domain, you provide a certificate that you manage with Certificate Manager (ACM). When necessary, you can use this operation to change the certificate that you applied to your custom domain.

Usually, this is unnecessary following routine certificate renewal with ACM. When you renew your existing certificate in ACM, the ARN for your certificate remains the same, and your custom domain uses the new certificate automatically.

However, if you replace your existing certificate with a new one, ACM gives the new certificate a new ARN. To apply the new certificate to your custom domain, you must provide this ARN to Amazon Cognito.

When you add your new certificate in ACM, you must choose US East (N. Virginia) as the Amazon Web Services Region.

After you submit your request, Amazon Cognito requires up to 1 hour to distribute your new certificate to your custom domain.

For more information about adding a custom domain to your user pool, see Using Your Own Domain for the Hosted UI.

Note: Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding IAM permission in a policy.

Learn more

Service Reference:

Examples:

Calling the updateUserPoolDomain operation

var params = {
  CustomDomainConfig: { /* required */
    CertificateArn: 'STRING_VALUE' /* required */
  },
  Domain: 'STRING_VALUE', /* required */
  UserPoolId: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.updateUserPoolDomain(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • Domain — (String)

      The domain name for the custom domain that hosts the sign-up and sign-in pages for your application. One example might be auth.example.com.

      This string can include only lowercase letters, numbers, and hyphens. Don't use a hyphen for the first or last character. Use periods to separate subdomain names.

    • UserPoolId — (String)

      The ID of the user pool that is associated with the custom domain whose certificate you're updating.

    • CustomDomainConfig — (map)

      The configuration for a custom domain that hosts the sign-up and sign-in pages for your application. Use this object to specify an SSL certificate that is managed by ACM.

      • CertificateArnrequired — (String)

        The Amazon Resource Name (ARN) of an Certificate Manager SSL certificate. You use this certificate for the subdomain of your custom domain.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • CloudFrontDomain — (String)

        The Amazon CloudFront endpoint that Amazon Cognito set up when you added the custom domain to your user pool.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

verifySoftwareToken(params = {}, callback) ⇒ AWS.Request

Use this API to register a user's entered time-based one-time password (TOTP) code and mark the user's software token MFA status as "verified" if successful. The request takes an access token or a session string, but not both.

Note: Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.

Service Reference:

Examples:

Calling the verifySoftwareToken operation

var params = {
  UserCode: 'STRING_VALUE', /* required */
  AccessToken: 'STRING_VALUE',
  FriendlyDeviceName: 'STRING_VALUE',
  Session: 'STRING_VALUE'
};
cognitoidentityserviceprovider.verifySoftwareToken(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • AccessToken — (String)

      A valid access token that Amazon Cognito issued to the user whose software token you want to verify.

    • Session — (String)

      The session that should be passed both ways in challenge-response calls to the service.

    • UserCode — (String)

      The one- time password computed using the secret code returned by AssociateSoftwareToken.

    • FriendlyDeviceName — (String)

      The friendly device name.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Status — (String)

        The status of the verify software token.

        Possible values include:
        • "SUCCESS"
        • "ERROR"
      • Session — (String)

        The session that should be passed both ways in challenge-response calls to the service.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

verifyUserAttribute(params = {}, callback) ⇒ AWS.Request

Verifies the specified user attributes in the user pool.

If your user pool requires verification before Amazon Cognito updates the attribute value, VerifyUserAttribute updates the affected attribute to its pending value. For more information, see UserAttributeUpdateSettingsType.

Authorize this action with a signed-in user's access token. It must include the scope aws.cognito.signin.user.admin.

Note: Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.

Service Reference:

Examples:

Calling the verifyUserAttribute operation

var params = {
  AccessToken: 'STRING_VALUE', /* required */
  AttributeName: 'STRING_VALUE', /* required */
  Code: 'STRING_VALUE' /* required */
};
cognitoidentityserviceprovider.verifyUserAttribute(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • AccessToken — (String)

      A valid access token that Amazon Cognito issued to the user whose user attributes you want to verify.

    • AttributeName — (String)

      The attribute name in the request to verify user attributes.

    • Code — (String)

      The verification code in the request to verify user attributes.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.