Class: Aws::CognitoIdentityProvider::Client

Inherits:
Seahorse::Client::Base show all
Includes:
Aws::ClientStubs
Defined in:
gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb

Overview

An API client for CognitoIdentityProvider. To construct a client, you need to configure a :region and :credentials.

client = Aws::CognitoIdentityProvider::Client.new(
  region: region_name,
  credentials: credentials,
  # ...
)

For details on configuring region and credentials see the developer guide.

See #initialize for a full list of supported configuration options.

Instance Attribute Summary

Attributes inherited from Seahorse::Client::Base

#config, #handlers

API Operations collapse

Instance Method Summary collapse

Methods included from Aws::ClientStubs

#api_requests, #stub_data, #stub_responses

Methods inherited from Seahorse::Client::Base

add_plugin, api, clear_plugins, define, new, #operation_names, plugins, remove_plugin, set_api, set_plugins

Methods included from Seahorse::Client::HandlerBuilder

#handle, #handle_request, #handle_response

Constructor Details

#initialize(options) ⇒ Client

Returns a new instance of Client.

Parameters:

  • options (Hash)

Options Hash (options):

  • :credentials (required, Aws::CredentialProvider)

    Your AWS credentials. This can be an instance of any one of the following classes:

    • Aws::Credentials - Used for configuring static, non-refreshing credentials.

    • Aws::SharedCredentials - Used for loading static credentials from a shared file, such as ~/.aws/config.

    • Aws::AssumeRoleCredentials - Used when you need to assume a role.

    • Aws::AssumeRoleWebIdentityCredentials - Used when you need to assume a role after providing credentials via the web.

    • Aws::SSOCredentials - Used for loading credentials from AWS SSO using an access token generated from aws login.

    • Aws::ProcessCredentials - Used for loading credentials from a process that outputs to stdout.

    • Aws::InstanceProfileCredentials - Used for loading credentials from an EC2 IMDS on an EC2 instance.

    • Aws::ECSCredentials - Used for loading credentials from instances running in ECS.

    • Aws::CognitoIdentityCredentials - Used for loading credentials from the Cognito Identity service.

    When :credentials are not configured directly, the following locations will be searched for credentials:

    • Aws.config[:credentials]
    • The :access_key_id, :secret_access_key, and :session_token options.
    • ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY']
    • ~/.aws/credentials
    • ~/.aws/config
    • EC2/ECS IMDS instance profile - When used by default, the timeouts are very aggressive. Construct and pass an instance of Aws::InstanceProfileCredentails or Aws::ECSCredentials to enable retries and extended timeouts. Instance profile credential fetching can be disabled by setting ENV['AWS_EC2_METADATA_DISABLED'] to true.
  • :region (required, String)

    The AWS region to connect to. The configured :region is used to determine the service :endpoint. When not passed, a default :region is searched for in the following locations:

    • Aws.config[:region]
    • ENV['AWS_REGION']
    • ENV['AMAZON_REGION']
    • ENV['AWS_DEFAULT_REGION']
    • ~/.aws/credentials
    • ~/.aws/config
  • :access_key_id (String)
  • :active_endpoint_cache (Boolean) — default: false

    When set to true, a thread polling for endpoints will be running in the background every 60 secs (default). Defaults to false.

  • :adaptive_retry_wait_to_fill (Boolean) — default: true

    Used only in adaptive retry mode. When true, the request will sleep until there is sufficent client side capacity to retry the request. When false, the request will raise a RetryCapacityNotAvailableError and will not retry instead of sleeping.

  • :client_side_monitoring (Boolean) — default: false

    When true, client-side metrics will be collected for all API requests from this client.

  • :client_side_monitoring_client_id (String) — default: ""

    Allows you to provide an identifier for this client which will be attached to all generated client side metrics. Defaults to an empty string.

  • :client_side_monitoring_host (String) — default: "127.0.0.1"

    Allows you to specify the DNS hostname or IPv4 or IPv6 address that the client side monitoring agent is running on, where client metrics will be published via UDP.

  • :client_side_monitoring_port (Integer) — default: 31000

    Required for publishing client metrics. The port that the client side monitoring agent is running on, where client metrics will be published via UDP.

  • :client_side_monitoring_publisher (Aws::ClientSideMonitoring::Publisher) — default: Aws::ClientSideMonitoring::Publisher

    Allows you to provide a custom client-side monitoring publisher class. By default, will use the Client Side Monitoring Agent Publisher.

  • :convert_params (Boolean) — default: true

    When true, an attempt is made to coerce request parameters into the required types.

  • :correct_clock_skew (Boolean) — default: true

    Used only in standard and adaptive retry modes. Specifies whether to apply a clock skew correction and retry requests with skewed client clocks.

  • :defaults_mode (String) — default: "legacy"

    See DefaultsModeConfiguration for a list of the accepted modes and the configuration defaults that are included.

  • :disable_host_prefix_injection (Boolean) — default: false

    Set to true to disable SDK automatically adding host prefix to default service endpoint when available.

  • :disable_request_compression (Boolean) — default: false

    When set to 'true' the request body will not be compressed for supported operations.

  • :endpoint (String)

    The client endpoint is normally constructed from the :region option. You should only configure an :endpoint when connecting to test or custom endpoints. This should be a valid HTTP(S) URI.

  • :endpoint_cache_max_entries (Integer) — default: 1000

    Used for the maximum size limit of the LRU cache storing endpoints data for endpoint discovery enabled operations. Defaults to 1000.

  • :endpoint_cache_max_threads (Integer) — default: 10

    Used for the maximum threads in use for polling endpoints to be cached, defaults to 10.

  • :endpoint_cache_poll_interval (Integer) — default: 60

    When :endpoint_discovery and :active_endpoint_cache is enabled, Use this option to config the time interval in seconds for making requests fetching endpoints information. Defaults to 60 sec.

  • :endpoint_discovery (Boolean) — default: false

    When set to true, endpoint discovery will be enabled for operations when available.

  • :ignore_configured_endpoint_urls (Boolean)

    Setting to true disables use of endpoint URLs provided via environment variables and the shared configuration file.

  • :log_formatter (Aws::Log::Formatter) — default: Aws::Log::Formatter.default

    The log formatter.

  • :log_level (Symbol) — default: :info

    The log level to send messages to the :logger at.

  • :logger (Logger)

    The Logger instance to send log messages to. If this option is not set, logging will be disabled.

  • :max_attempts (Integer) — default: 3

    An integer representing the maximum number attempts that will be made for a single request, including the initial attempt. For example, setting this value to 5 will result in a request being retried up to 4 times. Used in standard and adaptive retry modes.

  • :profile (String) — default: "default"

    Used when loading credentials from the shared credentials file at HOME/.aws/credentials. When not specified, 'default' is used.

  • :request_min_compression_size_bytes (Integer) — default: 10240

    The minimum size in bytes that triggers compression for request bodies. The value must be non-negative integer value between 0 and 10485780 bytes inclusive.

  • :retry_backoff (Proc)

    A proc or lambda used for backoff. Defaults to 2**retries * retry_base_delay. This option is only used in the legacy retry mode.

  • :retry_base_delay (Float) — default: 0.3

    The base delay in seconds used by the default backoff function. This option is only used in the legacy retry mode.

  • :retry_jitter (Symbol) — default: :none

    A delay randomiser function used by the default backoff function. Some predefined functions can be referenced by name - :none, :equal, :full, otherwise a Proc that takes and returns a number. This option is only used in the legacy retry mode.

    @see https://www.awsarchitectureblog.com/2015/03/backoff.html

  • :retry_limit (Integer) — default: 3

    The maximum number of times to retry failed requests. Only ~ 500 level server errors and certain ~ 400 level client errors are retried. Generally, these are throttling errors, data checksum errors, networking errors, timeout errors, auth errors, endpoint discovery, and errors from expired credentials. This option is only used in the legacy retry mode.

  • :retry_max_delay (Integer) — default: 0

    The maximum number of seconds to delay between retries (0 for no limit) used by the default backoff function. This option is only used in the legacy retry mode.

  • :retry_mode (String) — default: "legacy"

    Specifies which retry algorithm to use. Values are:

    • legacy - The pre-existing retry behavior. This is default value if no retry mode is provided.

    • standard - A standardized set of retry rules across the AWS SDKs. This includes support for retry quotas, which limit the number of unsuccessful retries a client can make.

    • adaptive - An experimental retry mode that includes all the functionality of standard mode along with automatic client side throttling. This is a provisional mode that may change behavior in the future.

  • :sdk_ua_app_id (String)

    A unique and opaque application ID that is appended to the User-Agent header as app/. It should have a maximum length of 50.

  • :secret_access_key (String)
  • :session_token (String)
  • :simple_json (Boolean) — default: false

    Disables request parameter conversion, validation, and formatting. Also disable response data type conversions. This option is useful when you want to ensure the highest level of performance by avoiding overhead of walking request parameters and response data structures.

    When :simple_json is enabled, the request parameters hash must be formatted exactly as the DynamoDB API expects.

  • :stub_responses (Boolean) — default: false

    Causes the client to return stubbed responses. By default fake responses are generated and returned. You can specify the response data to return or errors to raise by calling Aws::ClientStubs#stub_responses. See Aws::ClientStubs for more information.

    Please note When response stubbing is enabled, no HTTP requests are made, and retries are disabled.

  • :token_provider (Aws::TokenProvider)

    A Bearer Token Provider. This can be an instance of any one of the following classes:

    • Aws::StaticTokenProvider - Used for configuring static, non-refreshing tokens.

    • Aws::SSOTokenProvider - Used for loading tokens from AWS SSO using an access token generated from aws login.

    When :token_provider is not configured directly, the Aws::TokenProviderChain will be used to search for tokens configured for your profile in shared configuration files.

  • :use_dualstack_endpoint (Boolean)

    When set to true, dualstack enabled endpoints (with .aws TLD) will be used if available.

  • :use_fips_endpoint (Boolean)

    When set to true, fips compatible endpoints will be used if available. When a fips region is used, the region is normalized and this config is set to true.

  • :validate_params (Boolean) — default: true

    When true, request parameters are validated before sending the request.

  • :endpoint_provider (Aws::CognitoIdentityProvider::EndpointProvider)

    The endpoint provider used to resolve endpoints. Any object that responds to #resolve_endpoint(parameters) where parameters is a Struct similar to Aws::CognitoIdentityProvider::EndpointParameters

  • :http_proxy (URI::HTTP, String)

    A proxy to send requests through. Formatted like 'http://proxy.com:123'.

  • :http_open_timeout (Float) — default: 15

    The number of seconds to wait when opening a HTTP session before raising a Timeout::Error.

  • :http_read_timeout (Float) — default: 60

    The default number of seconds to wait for response data. This value can safely be set per-request on the session.

  • :http_idle_timeout (Float) — default: 5

    The number of seconds a connection is allowed to sit idle before it is considered stale. Stale connections are closed and removed from the pool before making a request.

  • :http_continue_timeout (Float) — default: 1

    The number of seconds to wait for a 100-continue response before sending the request body. This option has no effect unless the request has "Expect" header set to "100-continue". Defaults to nil which disables this behaviour. This value can safely be set per request on the session.

  • :ssl_timeout (Float) — default: nil

    Sets the SSL timeout in seconds.

  • :http_wire_trace (Boolean) — default: false

    When true, HTTP debug output will be sent to the :logger.

  • :ssl_verify_peer (Boolean) — default: true

    When true, SSL peer certificates are verified when establishing a connection.

  • :ssl_ca_bundle (String)

    Full path to the SSL certificate authority bundle file that should be used when verifying peer certificates. If you do not pass :ssl_ca_bundle or :ssl_ca_directory the the system default will be used if available.

  • :ssl_ca_directory (String)

    Full path of the directory that contains the unbundled SSL certificate authority files for verifying peer certificates. If you do not pass :ssl_ca_bundle or :ssl_ca_directory the the system default will be used if available.



395
396
397
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 395

def initialize(*args)
  super
end

Instance Method Details

#add_custom_attributes(params = {}) ⇒ Struct

Adds additional user attributes to the user pool schema.

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

Examples:

Request syntax with placeholder values


resp = client.add_custom_attributes({
  user_pool_id: "UserPoolIdType", # required
  custom_attributes: [ # required
    {
      name: "CustomAttributeNameType",
      attribute_data_type: "String", # accepts String, Number, DateTime, Boolean
      developer_only_attribute: false,
      mutable: false,
      required: false,
      number_attribute_constraints: {
        min_value: "StringType",
        max_value: "StringType",
      },
      string_attribute_constraints: {
        min_length: "StringType",
        max_length: "StringType",
      },
    },
  ],
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

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

  • :custom_attributes (required, Array<Types::SchemaAttributeType>)

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

Returns:

  • (Struct)

    Returns an empty response.

See Also:



457
458
459
460
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 457

def add_custom_attributes(params = {}, options = {})
  req = build_request(:add_custom_attributes, params)
  req.send_request(options)
end

#admin_add_user_to_group(params = {}) ⇒ Struct

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

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

Learn more

Examples:

Request syntax with placeholder values


resp = client.admin_add_user_to_group({
  user_pool_id: "UserPoolIdType", # required
  username: "UsernameType", # required
  group_name: "GroupNameType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

    The user pool ID for the user pool.

  • :username (required, 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.

  • :group_name (required, String)

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

Returns:

  • (Struct)

    Returns an empty response.

See Also:



511
512
513
514
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 511

def admin_add_user_to_group(params = {}, options = {})
  req = build_request(:admin_add_user_to_group, params)
  req.send_request(options)
end

#admin_confirm_sign_up(params = {}) ⇒ Struct

This IAM-authenticated API operation provides a code that Amazon Cognito sent to your user when they signed up in your user pool. 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 confirm their accounts when they respond to their invitation email message and choose a password.

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

Examples:

Request syntax with placeholder values


resp = client.({
  user_pool_id: "UserPoolIdType", # required
  username: "UsernameType", # required
  client_metadata: {
    "StringType" => "StringType",
  },
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

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

  • :username (required, 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.

  • :client_metadata (Hash<String,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.

    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.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



609
610
611
612
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 609

def (params = {}, options = {})
  req = build_request(:admin_confirm_sign_up, params)
  req.send_request(options)
end

#admin_create_user(params = {}) ⇒ Types::AdminCreateUserResponse

Creates a new user in the specified user pool.

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

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

If you have never used SMS text messages with Amazon Cognito or any other Amazon Web 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.

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

Examples:

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


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

resp = client.admin_create_user({
  desired_delivery_mediums: [
    "SMS", 
  ], 
  message_action: "SUPPRESS", 
  temporary_password: "This-is-my-test-99!", 
  user_attributes: [
    {
      name: "name", 
      value: "John", 
    }, 
    {
      name: "phone_number", 
      value: "+12065551212", 
    }, 
    {
      name: "email", 
      value: "testuser@example.com", 
    }, 
  ], 
  user_pool_id: "us-east-1_EXAMPLE", 
  username: "testuser", 
})

resp.to_h outputs the following:
{
  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, 
    user_create_date: Time.parse(1689980857.949), 
    user_last_modified_date: Time.parse(1689980857.949), 
    user_status: "FORCE_CHANGE_PASSWORD", 
    username: "testuser", 
  }, 
}

Request syntax with placeholder values


resp = client.admin_create_user({
  user_pool_id: "UserPoolIdType", # required
  username: "UsernameType", # required
  user_attributes: [
    {
      name: "AttributeNameType", # required
      value: "AttributeValueType",
    },
  ],
  validation_data: [
    {
      name: "AttributeNameType", # required
      value: "AttributeValueType",
    },
  ],
  temporary_password: "PasswordType",
  force_alias_creation: false,
  message_action: "RESEND", # accepts RESEND, SUPPRESS
  desired_delivery_mediums: ["SMS"], # accepts SMS, EMAIL
  client_metadata: {
    "StringType" => "StringType",
  },
})

Response structure


resp.user.username #=> String
resp.user.attributes #=> Array
resp.user.attributes[0].name #=> String
resp.user.attributes[0].value #=> String
resp.user.user_create_date #=> Time
resp.user.user_last_modified_date #=> Time
resp.user.enabled #=> Boolean
resp.user.user_status #=> String, one of "UNCONFIRMED", "CONFIRMED", "ARCHIVED", "COMPROMISED", "UNKNOWN", "RESET_REQUIRED", "FORCE_CHANGE_PASSWORD"
resp.user.mfa_options #=> Array
resp.user.mfa_options[0].delivery_medium #=> String, one of "SMS", "EMAIL"
resp.user.mfa_options[0].attribute_name #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

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

  • :username (required, 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.

  • :user_attributes (Array<Types::AttributeType>)

    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.

  • :validation_data (Array<Types::AttributeType>)

    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.

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

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

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

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

  • :client_metadata (Hash<String,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.

    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.

Returns:

See Also:



933
934
935
936
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 933

def admin_create_user(params = {}, options = {})
  req = build_request(:admin_create_user, params)
  req.send_request(options)
end

#admin_delete_user(params = {}) ⇒ Struct

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

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

Examples:

Request syntax with placeholder values


resp = client.admin_delete_user({
  user_pool_id: "UserPoolIdType", # required
  username: "UsernameType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

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

  • :username (required, 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.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



981
982
983
984
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 981

def admin_delete_user(params = {}, options = {})
  req = build_request(:admin_delete_user, params)
  req.send_request(options)
end

#admin_delete_user_attributes(params = {}) ⇒ Struct

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

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

Examples:

Request syntax with placeholder values


resp = client.admin_delete_user_attributes({
  user_pool_id: "UserPoolIdType", # required
  username: "UsernameType", # required
  user_attribute_names: ["AttributeNameType"], # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

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

  • :username (required, 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.

  • :user_attribute_names (required, 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.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



1039
1040
1041
1042
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 1039

def admin_delete_user_attributes(params = {}, options = {})
  req = build_request(:admin_delete_user_attributes, params)
  req.send_request(options)
end

#admin_disable_provider_for_user(params = {}) ⇒ Struct

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

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

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

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

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

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

Learn more

Examples:

Request syntax with placeholder values


resp = client.admin_disable_provider_for_user({
  user_pool_id: "StringType", # required
  user: { # required
    provider_name: "ProviderNameType",
    provider_attribute_name: "StringType",
    provider_attribute_value: "StringType",
  },
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

Returns:

  • (Struct)

    Returns an empty response.

See Also:



1119
1120
1121
1122
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 1119

def admin_disable_provider_for_user(params = {}, options = {})
  req = build_request(:admin_disable_provider_for_user, params)
  req.send_request(options)
end

#admin_disable_user(params = {}) ⇒ Struct

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.

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

Examples:

Request syntax with placeholder values


resp = client.admin_disable_user({
  user_pool_id: "UserPoolIdType", # required
  username: "UsernameType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

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

  • :username (required, 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.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



1169
1170
1171
1172
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 1169

def admin_disable_user(params = {}, options = {})
  req = build_request(:admin_disable_user, params)
  req.send_request(options)
end

#admin_enable_user(params = {}) ⇒ Struct

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

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

Examples:

Request syntax with placeholder values


resp = client.admin_enable_user({
  user_pool_id: "UserPoolIdType", # required
  username: "UsernameType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

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

  • :username (required, 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.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



1217
1218
1219
1220
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 1217

def admin_enable_user(params = {}, options = {})
  req = build_request(:admin_enable_user, params)
  req.send_request(options)
end

#admin_forget_device(params = {}) ⇒ Struct

Forgets the device, as an administrator.

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

Examples:

Request syntax with placeholder values


resp = client.admin_forget_device({
  user_pool_id: "UserPoolIdType", # required
  username: "UsernameType", # required
  device_key: "DeviceKeyType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

    The user pool ID.

  • :username (required, 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.

  • :device_key (required, String)

    The device key.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



1269
1270
1271
1272
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 1269

def admin_forget_device(params = {}, options = {})
  req = build_request(:admin_forget_device, params)
  req.send_request(options)
end

#admin_get_device(params = {}) ⇒ Types::AdminGetDeviceResponse

Gets the device, as an administrator.

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

Examples:

Request syntax with placeholder values


resp = client.admin_get_device({
  device_key: "DeviceKeyType", # required
  user_pool_id: "UserPoolIdType", # required
  username: "UsernameType", # required
})

Response structure


resp.device.device_key #=> String
resp.device.device_attributes #=> Array
resp.device.device_attributes[0].name #=> String
resp.device.device_attributes[0].value #=> String
resp.device.device_create_date #=> Time
resp.device.device_last_modified_date #=> Time
resp.device.device_last_authenticated_date #=> Time

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :device_key (required, String)

    The device key.

  • :user_pool_id (required, String)

    The user pool ID.

  • :username (required, 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.

Returns:

See Also:



1333
1334
1335
1336
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 1333

def admin_get_device(params = {}, options = {})
  req = build_request(:admin_get_device, params)
  req.send_request(options)
end

#admin_get_user(params = {}) ⇒ Types::AdminGetUserResponse

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

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

Examples:

Request syntax with placeholder values


resp = client.admin_get_user({
  user_pool_id: "UserPoolIdType", # required
  username: "UsernameType", # required
})

Response structure


resp.username #=> String
resp.user_attributes #=> Array
resp.user_attributes[0].name #=> String
resp.user_attributes[0].value #=> String
resp.user_create_date #=> Time
resp.user_last_modified_date #=> Time
resp.enabled #=> Boolean
resp.user_status #=> String, one of "UNCONFIRMED", "CONFIRMED", "ARCHIVED", "COMPROMISED", "UNKNOWN", "RESET_REQUIRED", "FORCE_CHANGE_PASSWORD"
resp.mfa_options #=> Array
resp.mfa_options[0].delivery_medium #=> String, one of "SMS", "EMAIL"
resp.mfa_options[0].attribute_name #=> String
resp.preferred_mfa_setting #=> String
resp.user_mfa_setting_list #=> Array
resp.user_mfa_setting_list[0] #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

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

  • :username (required, 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.

Returns:

See Also:



1410
1411
1412
1413
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 1410

def admin_get_user(params = {}, options = {})
  req = build_request(:admin_get_user, params)
  req.send_request(options)
end

#admin_initiate_auth(params = {}) ⇒ Types::AdminInitiateAuthResponse

Initiates the authentication flow, as an administrator.

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

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

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

Learn more

Examples:

Request syntax with placeholder values


resp = client.admin_initiate_auth({
  user_pool_id: "UserPoolIdType", # required
  client_id: "ClientIdType", # required
  auth_flow: "USER_SRP_AUTH", # required, accepts USER_SRP_AUTH, REFRESH_TOKEN_AUTH, REFRESH_TOKEN, CUSTOM_AUTH, ADMIN_NO_SRP_AUTH, USER_PASSWORD_AUTH, ADMIN_USER_PASSWORD_AUTH
  auth_parameters: {
    "StringType" => "StringType",
  },
  client_metadata: {
    "StringType" => "StringType",
  },
  analytics_metadata: {
    analytics_endpoint_id: "StringType",
  },
  context_data: {
    ip_address: "StringType", # required
    server_name: "StringType", # required
    server_path: "StringType", # required
    http_headers: [ # required
      {
        header_name: "StringType",
        header_value: "StringType",
      },
    ],
    encoded_data: "StringType",
  },
})

Response structure


resp.challenge_name #=> String, one of "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"
resp.session #=> String
resp.challenge_parameters #=> Hash
resp.challenge_parameters["StringType"] #=> String
resp.authentication_result.access_token #=> String
resp.authentication_result.expires_in #=> Integer
resp.authentication_result.token_type #=> String
resp.authentication_result.refresh_token #=> String
resp.authentication_result.id_token #=> String
resp.authentication_result..device_key #=> String
resp.authentication_result..device_group_key #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

    The ID of the Amazon Cognito user pool.

  • :client_id (required, String)

    The app client ID.

  • :auth_flow (required, 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.

  • :auth_parameters (Hash<String,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.

  • :client_metadata (Hash<String,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.

    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.

  • :analytics_metadata (Types::AnalyticsMetadataType)

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

  • :context_data (Types::ContextDataType)

    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.

Returns:

See Also:



1654
1655
1656
1657
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 1654

def admin_initiate_auth(params = {}, options = {})
  req = build_request(:admin_initiate_auth, params)
  req.send_request(options)
end

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

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

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

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

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

Learn more

Examples:

Request syntax with placeholder values


resp = client.admin_link_provider_for_user({
  user_pool_id: "StringType", # required
  destination_user: { # required
    provider_name: "ProviderNameType",
    provider_attribute_name: "StringType",
    provider_attribute_value: "StringType",
  },
  source_user: { # required
    provider_name: "ProviderNameType",
    provider_attribute_name: "StringType",
    provider_attribute_value: "StringType",
  },
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

    The user pool ID for the user pool.

  • :destination_user (required, Types::ProviderUserIdentifierType)

    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.

  • :source_user (required, Types::ProviderUserIdentifierType)

    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.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



1776
1777
1778
1779
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 1776

def admin_link_provider_for_user(params = {}, options = {})
  req = build_request(:admin_link_provider_for_user, params)
  req.send_request(options)
end

#admin_list_devices(params = {}) ⇒ Types::AdminListDevicesResponse

Lists devices, as an administrator.

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

Examples:

Request syntax with placeholder values


resp = client.admin_list_devices({
  user_pool_id: "UserPoolIdType", # required
  username: "UsernameType", # required
  limit: 1,
  pagination_token: "SearchPaginationTokenType",
})

Response structure


resp.devices #=> Array
resp.devices[0].device_key #=> String
resp.devices[0].device_attributes #=> Array
resp.devices[0].device_attributes[0].name #=> String
resp.devices[0].device_attributes[0].value #=> String
resp.devices[0].device_create_date #=> Time
resp.devices[0].device_last_modified_date #=> Time
resp.devices[0].device_last_authenticated_date #=> Time
resp.pagination_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

    The user pool ID.

  • :username (required, 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.

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

Returns:

See Also:



1852
1853
1854
1855
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 1852

def admin_list_devices(params = {}, options = {})
  req = build_request(:admin_list_devices, params)
  req.send_request(options)
end

#admin_list_groups_for_user(params = {}) ⇒ Types::AdminListGroupsForUserResponse

Lists the groups that a user belongs to.

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

The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.

Examples:

Request syntax with placeholder values


resp = client.admin_list_groups_for_user({
  username: "UsernameType", # required
  user_pool_id: "UserPoolIdType", # required
  limit: 1,
  next_token: "PaginationKey",
})

Response structure


resp.groups #=> Array
resp.groups[0].group_name #=> String
resp.groups[0].user_pool_id #=> String
resp.groups[0].description #=> String
resp.groups[0].role_arn #=> String
resp.groups[0].precedence #=> Integer
resp.groups[0].last_modified_date #=> Time
resp.groups[0].creation_date #=> Time
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :username (required, 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.

  • :user_pool_id (required, String)

    The user pool ID for the user pool.

  • :limit (Integer)

    The limit of the request to list groups.

  • :next_token (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:

See Also:



1927
1928
1929
1930
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 1927

def admin_list_groups_for_user(params = {}, options = {})
  req = build_request(:admin_list_groups_for_user, params)
  req.send_request(options)
end

#admin_list_user_auth_events(params = {}) ⇒ Types::AdminListUserAuthEventsResponse

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

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

The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.

Examples:

Request syntax with placeholder values


resp = client.admin_list_user_auth_events({
  user_pool_id: "UserPoolIdType", # required
  username: "UsernameType", # required
  max_results: 1,
  next_token: "PaginationKey",
})

Response structure


resp.auth_events #=> Array
resp.auth_events[0].event_id #=> String
resp.auth_events[0].event_type #=> String, one of "SignIn", "SignUp", "ForgotPassword", "PasswordChange", "ResendCode"
resp.auth_events[0].creation_date #=> Time
resp.auth_events[0].event_response #=> String, one of "Pass", "Fail", "InProgress"
resp.auth_events[0].event_risk.risk_decision #=> String, one of "NoRisk", "AccountTakeover", "Block"
resp.auth_events[0].event_risk.risk_level #=> String, one of "Low", "Medium", "High"
resp.auth_events[0].event_risk.compromised_credentials_detected #=> Boolean
resp.auth_events[0].challenge_responses #=> Array
resp.auth_events[0].challenge_responses[0].challenge_name #=> String, one of "Password", "Mfa"
resp.auth_events[0].challenge_responses[0].challenge_response #=> String, one of "Success", "Failure"
resp.auth_events[0].event_context_data.ip_address #=> String
resp.auth_events[0].event_context_data.device_name #=> String
resp.auth_events[0].event_context_data.timezone #=> String
resp.auth_events[0].event_context_data.city #=> String
resp.auth_events[0].event_context_data.country #=> String
resp.auth_events[0].event_feedback.feedback_value #=> String, one of "Valid", "Invalid"
resp.auth_events[0].event_feedback.provider #=> String
resp.auth_events[0].event_feedback.feedback_date #=> Time
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

    The user pool ID.

  • :username (required, 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.

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

  • :next_token (String)

    A pagination token.

Returns:

See Also:



2014
2015
2016
2017
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 2014

def admin_list_user_auth_events(params = {}, options = {})
  req = build_request(:admin_list_user_auth_events, params)
  req.send_request(options)
end

#admin_remove_user_from_group(params = {}) ⇒ Struct

Removes the specified user from the specified group.

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

Learn more

Examples:

Request syntax with placeholder values


resp = client.admin_remove_user_from_group({
  user_pool_id: "UserPoolIdType", # required
  username: "UsernameType", # required
  group_name: "GroupNameType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

    The user pool ID for the user pool.

  • :username (required, 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.

  • :group_name (required, String)

    The group name.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



2066
2067
2068
2069
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 2066

def admin_remove_user_from_group(params = {}, options = {})
  req = build_request(:admin_remove_user_from_group, params)
  req.send_request(options)
end

#admin_reset_user_password(params = {}) ⇒ Struct

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.

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

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

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.

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

Examples:

Request syntax with placeholder values


resp = client.admin_reset_user_password({
  user_pool_id: "UserPoolIdType", # required
  username: "UsernameType", # required
  client_metadata: {
    "StringType" => "StringType",
  },
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

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

  • :username (required, 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.

  • :client_metadata (Hash<String,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.

    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.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



2194
2195
2196
2197
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 2194

def admin_reset_user_password(params = {}, options = {})
  req = build_request(:admin_reset_user_password, params)
  req.send_request(options)
end

#admin_respond_to_auth_challenge(params = {}) ⇒ Types::AdminRespondToAuthChallengeResponse

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

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

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

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

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

Learn more

Examples:

Request syntax with placeholder values


resp = client.admin_respond_to_auth_challenge({
  user_pool_id: "UserPoolIdType", # required
  client_id: "ClientIdType", # required
  challenge_name: "SMS_MFA", # required, accepts 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
  challenge_responses: {
    "StringType" => "StringType",
  },
  session: "SessionType",
  analytics_metadata: {
    analytics_endpoint_id: "StringType",
  },
  context_data: {
    ip_address: "StringType", # required
    server_name: "StringType", # required
    server_path: "StringType", # required
    http_headers: [ # required
      {
        header_name: "StringType",
        header_value: "StringType",
      },
    ],
    encoded_data: "StringType",
  },
  client_metadata: {
    "StringType" => "StringType",
  },
})

Response structure


resp.challenge_name #=> String, one of "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"
resp.session #=> String
resp.challenge_parameters #=> Hash
resp.challenge_parameters["StringType"] #=> String
resp.authentication_result.access_token #=> String
resp.authentication_result.expires_in #=> Integer
resp.authentication_result.token_type #=> String
resp.authentication_result.refresh_token #=> String
resp.authentication_result.id_token #=> String
resp.authentication_result..device_key #=> String
resp.authentication_result..device_group_key #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

    The ID of the Amazon Cognito user pool.

  • :client_id (required, String)

    The app client ID.

  • :challenge_name (required, String)

    The challenge name. For more information, see AdminInitiateAuth.

  • :challenge_responses (Hash<String,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.

    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.

  • :analytics_metadata (Types::AnalyticsMetadataType)

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

  • :context_data (Types::ContextDataType)

    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.

  • :client_metadata (Hash<String,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.

    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.

Returns:

See Also:



2482
2483
2484
2485
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 2482

def admin_respond_to_auth_challenge(params = {}, options = {})
  req = build_request(:admin_respond_to_auth_challenge, params)
  req.send_request(options)
end

#admin_set_user_mfa_preference(params = {}) ⇒ Struct

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.

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

Examples:

Request syntax with placeholder values


resp = client.admin_set_user_mfa_preference({
  sms_mfa_settings: {
    enabled: false,
    preferred_mfa: false,
  },
  software_token_mfa_settings: {
    enabled: false,
    preferred_mfa: false,
  },
  username: "UsernameType", # required
  user_pool_id: "UserPoolIdType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :sms_mfa_settings (Types::SMSMfaSettingsType)

    The SMS text message MFA settings.

  • :software_token_mfa_settings (Types::SoftwareTokenMfaSettingsType)

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

  • :username (required, 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.

  • :user_pool_id (required, String)

    The user pool ID.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



2549
2550
2551
2552
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 2549

def admin_set_user_mfa_preference(params = {}, options = {})
  req = build_request(:admin_set_user_mfa_preference, params)
  req.send_request(options)
end

#admin_set_user_password(params = {}) ⇒ Struct

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.

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

Examples:

Request syntax with placeholder values


resp = client.admin_set_user_password({
  user_pool_id: "UserPoolIdType", # required
  username: "UsernameType", # required
  password: "PasswordType", # required
  permanent: false,
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

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

  • :username (required, 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 (required, String)

    The password for the user.

  • :permanent (Boolean)

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

Returns:

  • (Struct)

    Returns an empty response.

See Also:



2631
2632
2633
2634
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 2631

def admin_set_user_password(params = {}, options = {})
  req = build_request(:admin_set_user_password, params)
  req.send_request(options)
end

#admin_set_user_settings(params = {}) ⇒ Struct

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

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

Learn more

Examples:

Request syntax with placeholder values


resp = client.({
  user_pool_id: "UserPoolIdType", # required
  username: "UsernameType", # required
  mfa_options: [ # required
    {
      delivery_medium: "SMS", # accepts SMS, EMAIL
      attribute_name: "AttributeNameType",
    },
  ],
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

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

  • :username (required, 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.

  • :mfa_options (required, Array<Types::MFAOptionType>)

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

Returns:

  • (Struct)

    Returns an empty response.

See Also:



2694
2695
2696
2697
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 2694

def (params = {}, options = {})
  req = build_request(:admin_set_user_settings, params)
  req.send_request(options)
end

#admin_update_auth_event_feedback(params = {}) ⇒ Struct

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.

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

Examples:

Request syntax with placeholder values


resp = client.admin_update_auth_event_feedback({
  user_pool_id: "UserPoolIdType", # required
  username: "UsernameType", # required
  event_id: "EventIdType", # required
  feedback_value: "Valid", # required, accepts Valid, Invalid
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

    The user pool ID.

  • :username (required, 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.

  • :event_id (required, String)

    The authentication event ID.

  • :feedback_value (required, 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.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



2758
2759
2760
2761
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 2758

def admin_update_auth_event_feedback(params = {}, options = {})
  req = build_request(:admin_update_auth_event_feedback, params)
  req.send_request(options)
end

#admin_update_device_status(params = {}) ⇒ Struct

Updates the device status as an administrator.

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

Examples:

Request syntax with placeholder values


resp = client.admin_update_device_status({
  user_pool_id: "UserPoolIdType", # required
  username: "UsernameType", # required
  device_key: "DeviceKeyType", # required
  device_remembered_status: "remembered", # accepts remembered, not_remembered
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

    The user pool ID.

  • :username (required, 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.

  • :device_key (required, String)

    The device key.

  • :device_remembered_status (String)

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

Returns:

  • (Struct)

    Returns an empty response.

See Also:



2814
2815
2816
2817
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 2814

def admin_update_device_status(params = {}, options = {})
  req = build_request(:admin_update_device_status, params)
  req.send_request(options)
end

#admin_update_user_attributes(params = {}) ⇒ Struct

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

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

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.

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

Examples:

Request syntax with placeholder values


resp = client.admin_update_user_attributes({
  user_pool_id: "UserPoolIdType", # required
  username: "UsernameType", # required
  user_attributes: [ # required
    {
      name: "AttributeNameType", # required
      value: "AttributeValueType",
    },
  ],
  client_metadata: {
    "StringType" => "StringType",
  },
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

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

  • :username (required, 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.

  • :user_attributes (required, Array<Types::AttributeType>)

    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.

  • :client_metadata (Hash<String,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.

    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.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



2962
2963
2964
2965
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 2962

def admin_update_user_attributes(params = {}, options = {})
  req = build_request(:admin_update_user_attributes, params)
  req.send_request(options)
end

#admin_user_global_sign_out(params = {}) ⇒ Struct

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.

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

Examples:

Request syntax with placeholder values


resp = client.admin_user_global_sign_out({
  user_pool_id: "UserPoolIdType", # required
  username: "UsernameType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

    The user pool ID.

  • :username (required, 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.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



3035
3036
3037
3038
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 3035

def admin_user_global_sign_out(params = {}, options = {})
  req = build_request(:admin_user_global_sign_out, params)
  req.send_request(options)
end

#associate_software_token(params = {}) ⇒ Types::AssociateSoftwareTokenResponse

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

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

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

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

Examples:

Request syntax with placeholder values


resp = client.associate_software_token({
  access_token: "TokenModelType",
  session: "SessionType",
})

Response structure


resp.secret_code #=> String
resp.session #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

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

Returns:

See Also:



3106
3107
3108
3109
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 3106

def associate_software_token(params = {}, options = {})
  req = build_request(:associate_software_token, params)
  req.send_request(options)
end

#change_password(params = {}) ⇒ Struct

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

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

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

Examples:

Request syntax with placeholder values


resp = client.change_password({
  previous_password: "PasswordType", # required
  proposed_password: "PasswordType", # required
  access_token: "TokenModelType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :previous_password (required, String)

    The old password.

  • :proposed_password (required, String)

    The new password.

  • :access_token (required, String)

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

Returns:

  • (Struct)

    Returns an empty response.

See Also:



3153
3154
3155
3156
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 3153

def change_password(params = {}, options = {})
  req = build_request(:change_password, params)
  req.send_request(options)
end

#confirm_device(params = {}) ⇒ Types::ConfirmDeviceResponse

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.

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.

Examples:

Request syntax with placeholder values


resp = client.confirm_device({
  access_token: "TokenModelType", # required
  device_key: "DeviceKeyType", # required
  device_secret_verifier_config: {
    password_verifier: "StringType",
    salt: "StringType",
  },
  device_name: "DeviceNameType",
})

Response structure


resp.user_confirmation_necessary #=> Boolean

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :access_token (required, String)

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

  • :device_key (required, String)

    The device key.

  • :device_secret_verifier_config (Types::DeviceSecretVerifierConfigType)

    The configuration of the device secret verifier.

  • :device_name (String)

    The device name.

Returns:

See Also:



3216
3217
3218
3219
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 3216

def confirm_device(params = {}, options = {})
  req = build_request(:confirm_device, params)
  req.send_request(options)
end

#confirm_forgot_password(params = {}) ⇒ Struct

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

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

Examples:

Request syntax with placeholder values


resp = client.confirm_forgot_password({
  client_id: "ClientIdType", # required
  secret_hash: "SecretHashType",
  username: "UsernameType", # required
  confirmation_code: "ConfirmationCodeType", # required
  password: "PasswordType", # required
  analytics_metadata: {
    analytics_endpoint_id: "StringType",
  },
  user_context_data: {
    ip_address: "StringType",
    encoded_data: "StringType",
  },
  client_metadata: {
    "StringType" => "StringType",
  },
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :client_id (required, String)

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

  • :secret_hash (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 (required, 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.

  • :confirmation_code (required, String)

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

  • :password (required, String)

    The new password that your user wants to set.

  • :analytics_metadata (Types::AnalyticsMetadataType)

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

  • :user_context_data (Types::UserContextDataType)

    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.

  • :client_metadata (Hash<String,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.

    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.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



3342
3343
3344
3345
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 3342

def confirm_forgot_password(params = {}, options = {})
  req = build_request(:confirm_forgot_password, params)
  req.send_request(options)
end

#confirm_sign_up(params = {}) ⇒ Struct

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.

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.

Examples:

Request syntax with placeholder values


resp = client.({
  client_id: "ClientIdType", # required
  secret_hash: "SecretHashType",
  username: "UsernameType", # required
  confirmation_code: "ConfirmationCodeType", # required
  force_alias_creation: false,
  analytics_metadata: {
    analytics_endpoint_id: "StringType",
  },
  user_context_data: {
    ip_address: "StringType",
    encoded_data: "StringType",
  },
  client_metadata: {
    "StringType" => "StringType",
  },
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :client_id (required, String)

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

  • :secret_hash (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 (required, 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.

  • :confirmation_code (required, String)

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

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

  • :analytics_metadata (Types::AnalyticsMetadataType)

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

  • :user_context_data (Types::UserContextDataType)

    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.

  • :client_metadata (Hash<String,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.

    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.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



3480
3481
3482
3483
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 3480

def (params = {}, options = {})
  req = build_request(:confirm_sign_up, params)
  req.send_request(options)
end

#create_group(params = {}) ⇒ Types::CreateGroupResponse

Creates a new group in the specified user pool.

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

Learn more

Examples:

Request syntax with placeholder values


resp = client.create_group({
  group_name: "GroupNameType", # required
  user_pool_id: "UserPoolIdType", # required
  description: "DescriptionType",
  role_arn: "ArnType",
  precedence: 1,
})

Response structure


resp.group.group_name #=> String
resp.group.user_pool_id #=> String
resp.group.description #=> String
resp.group.role_arn #=> String
resp.group.precedence #=> Integer
resp.group.last_modified_date #=> Time
resp.group.creation_date #=> Time

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :group_name (required, String)

    The name of the group. Must be unique.

  • :user_pool_id (required, String)

    The user pool ID for the user pool.

  • :description (String)

    A string containing the description of the group.

  • :role_arn (String)

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

  • :precedence (Integer)

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

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

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

Returns:

See Also:



3565
3566
3567
3568
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 3565

def create_group(params = {}, options = {})
  req = build_request(:create_group, params)
  req.send_request(options)
end

#create_identity_provider(params = {}) ⇒ Types::CreateIdentityProviderResponse

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

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

Learn more

Examples:

Request syntax with placeholder values


resp = client.create_identity_provider({
  user_pool_id: "UserPoolIdType", # required
  provider_name: "ProviderNameTypeV2", # required
  provider_type: "SAML", # required, accepts SAML, Facebook, Google, LoginWithAmazon, SignInWithApple, OIDC
  provider_details: { # required
    "StringType" => "StringType",
  },
  attribute_mapping: {
    "AttributeMappingKeyType" => "StringType",
  },
  idp_identifiers: ["IdpIdentifierType"],
})

Response structure


resp.identity_provider.user_pool_id #=> String
resp.identity_provider.provider_name #=> String
resp.identity_provider.provider_type #=> String, one of "SAML", "Facebook", "Google", "LoginWithAmazon", "SignInWithApple", "OIDC"
resp.identity_provider.provider_details #=> Hash
resp.identity_provider.provider_details["StringType"] #=> String
resp.identity_provider.attribute_mapping #=> Hash
resp.identity_provider.attribute_mapping["AttributeMappingKeyType"] #=> String
resp.identity_provider.idp_identifiers #=> Array
resp.identity_provider.idp_identifiers[0] #=> String
resp.identity_provider.last_modified_date #=> Time
resp.identity_provider.creation_date #=> Time

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

    The user pool ID.

  • :provider_name (required, String)

    The IdP name.

  • :provider_type (required, String)

    The IdP type.

  • :provider_details (required, Hash<String,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_token" \}

  • :attribute_mapping (Hash<String,String>)

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

  • :idp_identifiers (Array<String>)

    A list of IdP identifiers.

Returns:

See Also:



3763
3764
3765
3766
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 3763

def create_identity_provider(params = {}, options = {})
  req = build_request(:create_identity_provider, params)
  req.send_request(options)
end

#create_resource_server(params = {}) ⇒ Types::CreateResourceServerResponse

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

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

Examples:

Request syntax with placeholder values


resp = client.create_resource_server({
  user_pool_id: "UserPoolIdType", # required
  identifier: "ResourceServerIdentifierType", # required
  name: "ResourceServerNameType", # required
  scopes: [
    {
      scope_name: "ResourceServerScopeNameType", # required
      scope_description: "ResourceServerScopeDescriptionType", # required
    },
  ],
})

Response structure


resp.resource_server.user_pool_id #=> String
resp.resource_server.identifier #=> String
resp.resource_server.name #=> String
resp.resource_server.scopes #=> Array
resp.resource_server.scopes[0].scope_name #=> String
resp.resource_server.scopes[0].scope_description #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

    The user pool ID for the user pool.

  • :identifier (required, String)

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

  • :name (required, String)

    A friendly name for the resource server.

  • :scopes (Array<Types::ResourceServerScopeType>)

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

Returns:

See Also:



3835
3836
3837
3838
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 3835

def create_resource_server(params = {}, options = {})
  req = build_request(:create_resource_server, params)
  req.send_request(options)
end

#create_user_import_job(params = {}) ⇒ Types::CreateUserImportJobResponse

Creates a user import job.

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

Examples:

Request syntax with placeholder values


resp = client.create_user_import_job({
  job_name: "UserImportJobNameType", # required
  user_pool_id: "UserPoolIdType", # required
  cloud_watch_logs_role_arn: "ArnType", # required
})

Response structure


resp.user_import_job.job_name #=> String
resp.user_import_job.job_id #=> String
resp.user_import_job.user_pool_id #=> String
resp.user_import_job.pre_signed_url #=> String
resp.user_import_job.creation_date #=> Time
resp.user_import_job.start_date #=> Time
resp.user_import_job.completion_date #=> Time
resp.user_import_job.status #=> String, one of "Created", "Pending", "InProgress", "Stopping", "Expired", "Stopped", "Failed", "Succeeded"
resp.user_import_job.cloud_watch_logs_role_arn #=> String
resp.user_import_job.imported_users #=> Integer
resp.user_import_job.skipped_users #=> Integer
resp.user_import_job.failed_users #=> Integer
resp.user_import_job.completion_message #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :job_name (required, String)

    The job name for the user import job.

  • :user_pool_id (required, String)

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

  • :cloud_watch_logs_role_arn (required, String)

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

Returns:

See Also:



3903
3904
3905
3906
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 3903

def create_user_import_job(params = {}, options = {})
  req = build_request(:create_user_import_job, params)
  req.send_request(options)
end

#create_user_pool(params = {}) ⇒ Types::CreateUserPoolResponse

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

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

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.

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

Examples:

Example: 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.

resp = client.create_user_pool({
  account_recovery_setting: {
    recovery_mechanisms: [
      {
        name: "verified_email", 
        priority: 1, 
      }, 
    ], 
  }, 
  admin_create_user_config: {
    allow_admin_create_user_only: false, 
    invite_message_template: {
      email_message: "Your username is {username} and temporary password is {####}.", 
      email_subject: "Your sign-in information", 
      sms_message: "Your username is {username} and temporary password is {####}.", 
    }, 
  }, 
  alias_attributes: [
    "email", 
  ], 
  auto_verified_attributes: [
    "email", 
  ], 
  deletion_protection: "ACTIVE", 
  device_configuration: {
    challenge_required_on_new_device: true, 
    device_only_remembered_on_user_prompt: true, 
  }, 
  email_configuration: {
    configuration_set: "my-test-ses-configuration-set", 
    email_sending_account: "DEVELOPER", 
    from: "support@example.com", 
    reply_to_email_address: "support@example.com", 
    source_arn: "arn:aws:ses:us-east-1:123456789012:identity/support@example.com", 
  }, 
  email_verification_message: "Your verification code is {####}.", 
  email_verification_subject: "Verify your email address", 
  lambda_config: {
    custom_email_sender: {
      lambda_arn: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", 
      lambda_version: "V1_0", 
    }, 
    custom_message: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", 
    custom_sms_sender: {
      lambda_arn: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", 
      lambda_version: "V1_0", 
    }, 
    define_auth_challenge: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", 
    kms_key_id: "arn:aws:kms:us-east-1:123456789012:key/a6c4f8e2-0c45-47db-925f-87854bc9e357", 
    post_authentication: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", 
    post_confirmation: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", 
    pre_authentication: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", 
    pre_sign_up: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", 
    pre_token_generation: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", 
    user_migration: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", 
    verify_auth_challenge_response: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", 
  }, 
  mfa_configuration: "OPTIONAL", 
  policies: {
    password_policy: {
      minimum_length: 6, 
      require_lowercase: true, 
      require_numbers: true, 
      require_symbols: true, 
      require_uppercase: true, 
      temporary_password_validity_days: 7, 
    }, 
  }, 
  pool_name: "my-test-user-pool", 
  schema: [
    {
      attribute_data_type: "Number", 
      developer_only_attribute: true, 
      mutable: true, 
      name: "mydev", 
      number_attribute_constraints: {
        max_value: "99", 
        min_value: "1", 
      }, 
      required: false, 
      string_attribute_constraints: {
        max_length: "99", 
        min_length: "1", 
      }, 
    }, 
  ], 
  sms_authentication_message: "Your verification code is {####}.", 
  sms_configuration: {
    external_id: "my-role-external-id", 
    sns_caller_arn: "arn:aws:iam::123456789012:role/service-role/test-cognito-SMS-Role", 
  }, 
  sms_verification_message: "Your verification code is {####}.", 
  user_attribute_update_settings: {
    attributes_require_verification_before_update: [
      "email", 
    ], 
  }, 
  user_pool_add_ons: {
    advanced_security_mode: "OFF", 
  }, 
  user_pool_tags: {
    "my-test-tag-key" => "my-test-tag-key", 
  }, 
  username_configuration: {
    case_sensitive: true, 
  }, 
  verification_message_template: {
    default_email_option: "CONFIRM_WITH_CODE", 
    email_message: "Your confirmation code is {####}", 
    email_message_by_link: "Choose this link to {##verify your email##}", 
    email_subject: "Here is your confirmation code", 
    email_subject_by_link: "Here is your confirmation link", 
    sms_message: "Your confirmation code is {####}", 
  }, 
})

resp.to_h outputs the following:
{
  user_pool: {
    account_recovery_setting: {
      recovery_mechanisms: [
        {
          name: "verified_email", 
          priority: 1, 
        }, 
      ], 
    }, 
    admin_create_user_config: {
      allow_admin_create_user_only: false, 
      invite_message_template: {
        email_message: "Your username is {username} and temporary password is {####}.", 
        email_subject: "Your sign-in information", 
        sms_message: "Your username is {username} and temporary password is {####}.", 
      }, 
      unused_account_validity_days: 7, 
    }, 
    alias_attributes: [
      "email", 
    ], 
    arn: "arn:aws:cognito-idp:us-east-1:123456789012:userpool/us-east-1_EXAMPLE", 
    auto_verified_attributes: [
      "email", 
    ], 
    creation_date: Time.parse(1689721665.239), 
    deletion_protection: "ACTIVE", 
    device_configuration: {
      challenge_required_on_new_device: true, 
      device_only_remembered_on_user_prompt: true, 
    }, 
    email_configuration: {
      configuration_set: "my-test-ses-configuration-set", 
      email_sending_account: "DEVELOPER", 
      from: "support@example.com", 
      reply_to_email_address: "support@example.com", 
      source_arn: "arn:aws:ses:us-east-1:123456789012:identity/support@example.com", 
    }, 
    email_verification_message: "Your verification code is {####}.", 
    email_verification_subject: "Verify your email address", 
    estimated_number_of_users: 0, 
    id: "us-east-1_EXAMPLE", 
    lambda_config: {
      custom_email_sender: {
        lambda_arn: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", 
        lambda_version: "V1_0", 
      }, 
      custom_message: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", 
      custom_sms_sender: {
        lambda_arn: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", 
        lambda_version: "V1_0", 
      }, 
      define_auth_challenge: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", 
      kms_key_id: "arn:aws:kms:us-east-1:767671399759:key/4d43904c-8edf-4bb4-9fca-fb1a80e41cbe", 
      post_authentication: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", 
      post_confirmation: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", 
      pre_authentication: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", 
      pre_sign_up: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", 
      pre_token_generation: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", 
      user_migration: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", 
      verify_auth_challenge_response: "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", 
    }, 
    last_modified_date: Time.parse(1689721665.239), 
    mfa_configuration: "OPTIONAL", 
    name: "my-test-user-pool", 
    policies: {
      password_policy: {
        minimum_length: 6, 
        require_lowercase: true, 
        require_numbers: true, 
        require_symbols: true, 
        require_uppercase: true, 
        temporary_password_validity_days: 7, 
      }, 
    }, 
    schema_attributes: [
      {
        attribute_data_type: "String", 
        developer_only_attribute: false, 
        mutable: false, 
        name: "sub", 
        required: true, 
        string_attribute_constraints: {
          max_length: "2048", 
          min_length: "1", 
        }, 
      }, 
      {
        attribute_data_type: "String", 
        developer_only_attribute: false, 
        mutable: true, 
        name: "name", 
        required: false, 
        string_attribute_constraints: {
          max_length: "2048", 
          min_length: "0", 
        }, 
      }, 
      {
        attribute_data_type: "String", 
        developer_only_attribute: false, 
        mutable: true, 
        name: "given_name", 
        required: false, 
        string_attribute_constraints: {
          max_length: "2048", 
          min_length: "0", 
        }, 
      }, 
      {
        attribute_data_type: "String", 
        developer_only_attribute: false, 
        mutable: true, 
        name: "family_name", 
        required: false, 
        string_attribute_constraints: {
          max_length: "2048", 
          min_length: "0", 
        }, 
      }, 
      {
        attribute_data_type: "String", 
        developer_only_attribute: false, 
        mutable: true, 
        name: "middle_name", 
        required: false, 
        string_attribute_constraints: {
          max_length: "2048", 
          min_length: "0", 
        }, 
      }, 
      {
        attribute_data_type: "String", 
        developer_only_attribute: false, 
        mutable: true, 
        name: "nickname", 
        required: false, 
        string_attribute_constraints: {
          max_length: "2048", 
          min_length: "0", 
        }, 
      }, 
      {
        attribute_data_type: "String", 
        developer_only_attribute: false, 
        mutable: true, 
        name: "preferred_username", 
        required: false, 
        string_attribute_constraints: {
          max_length: "2048", 
          min_length: "0", 
        }, 
      }, 
      {
        attribute_data_type: "String", 
        developer_only_attribute: false, 
        mutable: true, 
        name: "profile", 
        required: false, 
        string_attribute_constraints: {
          max_length: "2048", 
          min_length: "0", 
        }, 
      }, 
      {
        attribute_data_type: "String", 
        developer_only_attribute: false, 
        mutable: true, 
        name: "picture", 
        required: false, 
        string_attribute_constraints: {
          max_length: "2048", 
          min_length: "0", 
        }, 
      }, 
      {
        attribute_data_type: "String", 
        developer_only_attribute: false, 
        mutable: true, 
        name: "website", 
        required: false, 
        string_attribute_constraints: {
          max_length: "2048", 
          min_length: "0", 
        }, 
      }, 
      {
        attribute_data_type: "String", 
        developer_only_attribute: false, 
        mutable: true, 
        name: "email", 
        required: false, 
        string_attribute_constraints: {
          max_length: "2048", 
          min_length: "0", 
        }, 
      }, 
      {
        attribute_data_type: "Boolean", 
        developer_only_attribute: false, 
        mutable: true, 
        name: "email_verified", 
        required: false, 
      }, 
      {
        attribute_data_type: "String", 
        developer_only_attribute: false, 
        mutable: true, 
        name: "gender", 
        required: false, 
        string_attribute_constraints: {
          max_length: "2048", 
          min_length: "0", 
        }, 
      }, 
      {
        attribute_data_type: "String", 
        developer_only_attribute: false, 
        mutable: true, 
        name: "birthdate", 
        required: false, 
        string_attribute_constraints: {
          max_length: "10", 
          min_length: "10", 
        }, 
      }, 
      {
        attribute_data_type: "String", 
        developer_only_attribute: false, 
        mutable: true, 
        name: "zoneinfo", 
        required: false, 
        string_attribute_constraints: {
          max_length: "2048", 
          min_length: "0", 
        }, 
      }, 
      {
        attribute_data_type: "String", 
        developer_only_attribute: false, 
        mutable: true, 
        name: "locale", 
        required: false, 
        string_attribute_constraints: {
          max_length: "2048", 
          min_length: "0", 
        }, 
      }, 
      {
        attribute_data_type: "String", 
        developer_only_attribute: false, 
        mutable: true, 
        name: "phone_number", 
        required: false, 
        string_attribute_constraints: {
          max_length: "2048", 
          min_length: "0", 
        }, 
      }, 
      {
        attribute_data_type: "Boolean", 
        developer_only_attribute: false, 
        mutable: true, 
        name: "phone_number_verifie", 
        required: false, 
      }, 
      {
        attribute_data_type: "String", 
        developer_only_attribute: false, 
        mutable: true, 
        name: "address", 
        required: false, 
        string_attribute_constraints: {
          max_length: "2048", 
          min_length: "0", 
        }, 
      }, 
      {
        attribute_data_type: "Number", 
        developer_only_attribute: false, 
        mutable: true, 
        name: "updated_at", 
        number_attribute_constraints: {
          min_value: "0", 
        }, 
        required: false, 
      }, 
      {
        attribute_data_type: "Number", 
        developer_only_attribute: true, 
        mutable: true, 
        name: "dev:custom:mydev", 
        number_attribute_constraints: {
          max_value: "99", 
          min_value: "1", 
        }, 
        required: false, 
      }, 
    ], 
    sms_authentication_message: "Your verification code is {####}.", 
    sms_configuration: {
      external_id: "my-role-external-id", 
      sns_caller_arn: "arn:aws:iam::123456789012:role/service-role/test-cognito-SMS-Role", 
      sns_region: "us-east-1", 
    }, 
    sms_verification_message: "Your verification code is {####}.", 
    user_attribute_update_settings: {
      attributes_require_verification_before_update: [
        "email", 
      ], 
    }, 
    user_pool_add_ons: {
      advanced_security_mode: "OFF", 
    }, 
    user_pool_tags: {
      "my-test-tag-key" => "my-test-tag-value", 
    }, 
    username_configuration: {
      case_sensitive: true, 
    }, 
    verification_message_template: {
      default_email_option: "CONFIRM_WITH_CODE", 
      email_message: "Your confirmation code is {####}", 
      email_message_by_link: "Choose this link to {##verify your email##}", 
      email_subject: "Here is your confirmation code", 
      email_subject_by_link: "Here is your confirmation link", 
      sms_message: "Your confirmation code is {####}", 
    }, 
  }, 
}

Request syntax with placeholder values


resp = client.create_user_pool({
  pool_name: "UserPoolNameType", # required
  policies: {
    password_policy: {
      minimum_length: 1,
      require_uppercase: false,
      require_lowercase: false,
      require_numbers: false,
      require_symbols: false,
      temporary_password_validity_days: 1,
    },
  },
  deletion_protection: "ACTIVE", # accepts ACTIVE, INACTIVE
  lambda_config: {
    pre_sign_up: "ArnType",
    custom_message: "ArnType",
    post_confirmation: "ArnType",
    pre_authentication: "ArnType",
    post_authentication: "ArnType",
    define_auth_challenge: "ArnType",
    create_auth_challenge: "ArnType",
    verify_auth_challenge_response: "ArnType",
    pre_token_generation: "ArnType",
    user_migration: "ArnType",
    pre_token_generation_config: {
      lambda_version: "V1_0", # required, accepts V1_0, V2_0
      lambda_arn: "ArnType", # required
    },
    custom_sms_sender: {
      lambda_version: "V1_0", # required, accepts V1_0
      lambda_arn: "ArnType", # required
    },
    custom_email_sender: {
      lambda_version: "V1_0", # required, accepts V1_0
      lambda_arn: "ArnType", # required
    },
    kms_key_id: "ArnType",
  },
  auto_verified_attributes: ["phone_number"], # accepts phone_number, email
  alias_attributes: ["phone_number"], # accepts phone_number, email, preferred_username
  username_attributes: ["phone_number"], # accepts phone_number, email
  sms_verification_message: "SmsVerificationMessageType",
  email_verification_message: "EmailVerificationMessageType",
  email_verification_subject: "EmailVerificationSubjectType",
  verification_message_template: {
    sms_message: "SmsVerificationMessageType",
    email_message: "EmailVerificationMessageType",
    email_subject: "EmailVerificationSubjectType",
    email_message_by_link: "EmailVerificationMessageByLinkType",
    email_subject_by_link: "EmailVerificationSubjectByLinkType",
    default_email_option: "CONFIRM_WITH_LINK", # accepts CONFIRM_WITH_LINK, CONFIRM_WITH_CODE
  },
  sms_authentication_message: "SmsVerificationMessageType",
  mfa_configuration: "OFF", # accepts OFF, ON, OPTIONAL
  user_attribute_update_settings: {
    attributes_require_verification_before_update: ["phone_number"], # accepts phone_number, email
  },
  device_configuration: {
    challenge_required_on_new_device: false,
    device_only_remembered_on_user_prompt: false,
  },
  email_configuration: {
    source_arn: "ArnType",
    reply_to_email_address: "EmailAddressType",
    email_sending_account: "COGNITO_DEFAULT", # accepts COGNITO_DEFAULT, DEVELOPER
    from: "StringType",
    configuration_set: "SESConfigurationSet",
  },
  sms_configuration: {
    sns_caller_arn: "ArnType", # required
    external_id: "StringType",
    sns_region: "RegionCodeType",
  },
  user_pool_tags: {
    "TagKeysType" => "TagValueType",
  },
  admin_create_user_config: {
    allow_admin_create_user_only: false,
    unused_account_validity_days: 1,
    invite_message_template: {
      sms_message: "SmsVerificationMessageType",
      email_message: "EmailVerificationMessageType",
      email_subject: "EmailVerificationSubjectType",
    },
  },
  schema: [
    {
      name: "CustomAttributeNameType",
      attribute_data_type: "String", # accepts String, Number, DateTime, Boolean
      developer_only_attribute: false,
      mutable: false,
      required: false,
      number_attribute_constraints: {
        min_value: "StringType",
        max_value: "StringType",
      },
      string_attribute_constraints: {
        min_length: "StringType",
        max_length: "StringType",
      },
    },
  ],
  user_pool_add_ons: {
    advanced_security_mode: "OFF", # required, accepts OFF, AUDIT, ENFORCED
  },
  username_configuration: {
    case_sensitive: false, # required
  },
  account_recovery_setting: {
    recovery_mechanisms: [
      {
        priority: 1, # required
        name: "verified_email", # required, accepts verified_email, verified_phone_number, admin_only
      },
    ],
  },
})

Response structure


resp.user_pool.id #=> String
resp.user_pool.name #=> String
resp.user_pool.policies.password_policy.minimum_length #=> Integer
resp.user_pool.policies.password_policy.require_uppercase #=> Boolean
resp.user_pool.policies.password_policy.require_lowercase #=> Boolean
resp.user_pool.policies.password_policy.require_numbers #=> Boolean
resp.user_pool.policies.password_policy.require_symbols #=> Boolean
resp.user_pool.policies.password_policy.temporary_password_validity_days #=> Integer
resp.user_pool.deletion_protection #=> String, one of "ACTIVE", "INACTIVE"
resp.user_pool.lambda_config. #=> String
resp.user_pool.lambda_config.custom_message #=> String
resp.user_pool.lambda_config.post_confirmation #=> String
resp.user_pool.lambda_config.pre_authentication #=> String
resp.user_pool.lambda_config.post_authentication #=> String
resp.user_pool.lambda_config.define_auth_challenge #=> String
resp.user_pool.lambda_config.create_auth_challenge #=> String
resp.user_pool.lambda_config.verify_auth_challenge_response #=> String
resp.user_pool.lambda_config.pre_token_generation #=> String
resp.user_pool.lambda_config.user_migration #=> String
resp.user_pool.lambda_config.pre_token_generation_config.lambda_version #=> String, one of "V1_0", "V2_0"
resp.user_pool.lambda_config.pre_token_generation_config.lambda_arn #=> String
resp.user_pool.lambda_config.custom_sms_sender.lambda_version #=> String, one of "V1_0"
resp.user_pool.lambda_config.custom_sms_sender.lambda_arn #=> String
resp.user_pool.lambda_config.custom_email_sender.lambda_version #=> String, one of "V1_0"
resp.user_pool.lambda_config.custom_email_sender.lambda_arn #=> String
resp.user_pool.lambda_config.kms_key_id #=> String
resp.user_pool.status #=> String, one of "Enabled", "Disabled"
resp.user_pool.last_modified_date #=> Time
resp.user_pool.creation_date #=> Time
resp.user_pool.schema_attributes #=> Array
resp.user_pool.schema_attributes[0].name #=> String
resp.user_pool.schema_attributes[0].attribute_data_type #=> String, one of "String", "Number", "DateTime", "Boolean"
resp.user_pool.schema_attributes[0].developer_only_attribute #=> Boolean
resp.user_pool.schema_attributes[0].mutable #=> Boolean
resp.user_pool.schema_attributes[0].required #=> Boolean
resp.user_pool.schema_attributes[0].number_attribute_constraints.min_value #=> String
resp.user_pool.schema_attributes[0].number_attribute_constraints.max_value #=> String
resp.user_pool.schema_attributes[0].string_attribute_constraints.min_length #=> String
resp.user_pool.schema_attributes[0].string_attribute_constraints.max_length #=> String
resp.user_pool.auto_verified_attributes #=> Array
resp.user_pool.auto_verified_attributes[0] #=> String, one of "phone_number", "email"
resp.user_pool.alias_attributes #=> Array
resp.user_pool.alias_attributes[0] #=> String, one of "phone_number", "email", "preferred_username"
resp.user_pool.username_attributes #=> Array
resp.user_pool.username_attributes[0] #=> String, one of "phone_number", "email"
resp.user_pool.sms_verification_message #=> String
resp.user_pool.email_verification_message #=> String
resp.user_pool.email_verification_subject #=> String
resp.user_pool.verification_message_template.sms_message #=> String
resp.user_pool.verification_message_template.email_message #=> String
resp.user_pool.verification_message_template.email_subject #=> String
resp.user_pool.verification_message_template.email_message_by_link #=> String
resp.user_pool.verification_message_template.email_subject_by_link #=> String
resp.user_pool.verification_message_template.default_email_option #=> String, one of "CONFIRM_WITH_LINK", "CONFIRM_WITH_CODE"
resp.user_pool.sms_authentication_message #=> String
resp.user_pool.user_attribute_update_settings.attributes_require_verification_before_update #=> Array
resp.user_pool.user_attribute_update_settings.attributes_require_verification_before_update[0] #=> String, one of "phone_number", "email"
resp.user_pool.mfa_configuration #=> String, one of "OFF", "ON", "OPTIONAL"
resp.user_pool.device_configuration.challenge_required_on_new_device #=> Boolean
resp.user_pool.device_configuration.device_only_remembered_on_user_prompt #=> Boolean
resp.user_pool.estimated_number_of_users #=> Integer
resp.user_pool.email_configuration.source_arn #=> String
resp.user_pool.email_configuration.reply_to_email_address #=> String
resp.user_pool.email_configuration. #=> String, one of "COGNITO_DEFAULT", "DEVELOPER"
resp.user_pool.email_configuration.from #=> String
resp.user_pool.email_configuration.configuration_set #=> String
resp.user_pool.sms_configuration.sns_caller_arn #=> String
resp.user_pool.sms_configuration.external_id #=> String
resp.user_pool.sms_configuration.sns_region #=> String
resp.user_pool.user_pool_tags #=> Hash
resp.user_pool.user_pool_tags["TagKeysType"] #=> String
resp.user_pool.sms_configuration_failure #=> String
resp.user_pool.email_configuration_failure #=> String
resp.user_pool.domain #=> String
resp.user_pool.custom_domain #=> String
resp.user_pool.admin_create_user_config.allow_admin_create_user_only #=> Boolean
resp.user_pool.admin_create_user_config. #=> Integer
resp.user_pool.admin_create_user_config.invite_message_template.sms_message #=> String
resp.user_pool.admin_create_user_config.invite_message_template.email_message #=> String
resp.user_pool.admin_create_user_config.invite_message_template.email_subject #=> String
resp.user_pool.user_pool_add_ons.advanced_security_mode #=> String, one of "OFF", "AUDIT", "ENFORCED"
resp.user_pool.username_configuration.case_sensitive #=> Boolean
resp.user_pool.arn #=> String
resp.user_pool..recovery_mechanisms #=> Array
resp.user_pool..recovery_mechanisms[0].priority #=> Integer
resp.user_pool..recovery_mechanisms[0].name #=> String, one of "verified_email", "verified_phone_number", "admin_only"

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :pool_name (required, String)

    A string used to name the user pool.

  • :policies (Types::UserPoolPolicyType)

    The policies associated with the new user pool.

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

  • :lambda_config (Types::LambdaConfigType)

    The Lambda trigger configuration information for the new user pool.

    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 .

  • :auto_verified_attributes (Array<String>)

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

  • :alias_attributes (Array<String>)

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

  • :username_attributes (Array<String>)

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

  • :sms_verification_message (String)

    This parameter is no longer used. See VerificationMessageTemplateType.

  • :email_verification_message (String)

    This parameter is no longer used. See VerificationMessageTemplateType.

  • :email_verification_subject (String)

    This parameter is no longer used. See VerificationMessageTemplateType.

  • :verification_message_template (Types::VerificationMessageTemplateType)

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

  • :sms_authentication_message (String)

    A string representing the SMS authentication message.

  • :mfa_configuration (String)

    Specifies MFA configuration details.

  • :user_attribute_update_settings (Types::UserAttributeUpdateSettingsType)

    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.

  • :device_configuration (Types::DeviceConfigurationType)

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

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

  • :email_configuration (Types::EmailConfigurationType)

    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.

  • :sms_configuration (Types::SmsConfigurationType)

    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.

  • :user_pool_tags (Hash<String,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.

  • :admin_create_user_config (Types::AdminCreateUserConfigType)

    The configuration for AdminCreateUser requests.

  • :schema (Array<Types::SchemaAttributeType>)

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

  • :user_pool_add_ons (Types::UserPoolAddOnsType)

    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.

  • :username_configuration (Types::UsernameConfigurationType)

    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.

  • :account_recovery_setting (Types::AccountRecoverySettingType)

    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.

Returns:

See Also:



4802
4803
4804
4805
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 4802

def create_user_pool(params = {}, options = {})
  req = build_request(:create_user_pool, params)
  req.send_request(options)
end

#create_user_pool_client(params = {}) ⇒ Types::CreateUserPoolClientResponse

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.

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

Examples:

Example: 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.

resp = client.create_user_pool_client({
  access_token_validity: 6, 
  allowed_o_auth_flows: [
    "code", 
  ], 
  allowed_o_auth_flows_user_pool_client: true, 
  allowed_o_auth_scopes: [
    "aws.cognito.signin.user.admin", 
    "openid", 
  ], 
  analytics_configuration: {
    application_id: "d70b2ba36a8c4dc5a04a0451a31a1e12", 
    external_id: "my-external-id", 
    role_arn: "arn:aws:iam::123456789012:role/test-cognitouserpool-role", 
    user_data_shared: true, 
  }, 
  callback_urls: [
    "https://example.com", 
    "http://localhost", 
    "myapp://example", 
  ], 
  client_name: "my-test-app-client", 
  default_redirect_uri: "https://example.com", 
  explicit_auth_flows: [
    "ALLOW_ADMIN_USER_PASSWORD_AUTH", 
    "ALLOW_USER_PASSWORD_AUTH", 
    "ALLOW_REFRESH_TOKEN_AUTH", 
  ], 
  generate_secret: true, 
  id_token_validity: 6, 
  logout_urls: [
    "https://example.com/logout", 
  ], 
  prevent_user_existence_errors: "ENABLED", 
  read_attributes: [
    "email", 
    "address", 
    "preferred_username", 
  ], 
  refresh_token_validity: 6, 
  supported_identity_providers: [
    "SignInWithApple", 
    "MySSO", 
  ], 
  token_validity_units: {
    access_token: "hours", 
    id_token: "minutes", 
    refresh_token: "days", 
  }, 
  user_pool_id: "us-east-1_EXAMPLE", 
  write_attributes: [
    "family_name", 
    "email", 
  ], 
})

resp.to_h outputs the following:
{
  user_pool_client: {
    access_token_validity: 6, 
    allowed_o_auth_flows: [
      "code", 
    ], 
    allowed_o_auth_flows_user_pool_client: true, 
    allowed_o_auth_scopes: [
      "aws.cognito.signin.user.admin", 
      "openid", 
    ], 
    analytics_configuration: {
      application_id: "d70b2ba36a8c4dc5a04a0451a31a1e12", 
      external_id: "my-external-id", 
      role_arn: "arn:aws:iam::123456789012:role/test-cognitouserpool-role", 
      user_data_shared: true, 
    }, 
    auth_session_validity: 3, 
    callback_urls: [
      "https://example.com", 
      "http://localhost", 
      "myapp://example", 
    ], 
    client_id: "26cb2c60kq7nbmas7rbme9b6pp", 
    client_name: "my-test-app-client", 
    client_secret: "13ka4h7u28d9oo44tqpq9djqsfvhvu8rk4d2ighvpu0k8fj1c2r9", 
    creation_date: Time.parse(1689885426.107), 
    default_redirect_uri: "https://example.com", 
    enable_propagate_additional_user_context_data: false, 
    enable_token_revocation: true, 
    explicit_auth_flows: [
      "ALLOW_USER_PASSWORD_AUTH", 
      "ALLOW_ADMIN_USER_PASSWORD_AUTH", 
      "ALLOW_REFRESH_TOKEN_AUTH", 
    ], 
    id_token_validity: 6, 
    last_modified_date: Time.parse(1689885426.107), 
    logout_urls: [
      "https://example.com/logout", 
    ], 
    prevent_user_existence_errors: "ENABLED", 
    read_attributes: [
      "address", 
      "preferred_username", 
      "email", 
    ], 
    refresh_token_validity: 6, 
    supported_identity_providers: [
      "SignInWithApple", 
      "MySSO", 
    ], 
    token_validity_units: {
      access_token: "hours", 
      id_token: "minutes", 
      refresh_token: "days", 
    }, 
    user_pool_id: "us-east-1_EXAMPLE", 
    write_attributes: [
      "family_name", 
      "email", 
    ], 
  }, 
}

Request syntax with placeholder values


resp = client.create_user_pool_client({
  user_pool_id: "UserPoolIdType", # required
  client_name: "ClientNameType", # required
  generate_secret: false,
  refresh_token_validity: 1,
  access_token_validity: 1,
  id_token_validity: 1,
  token_validity_units: {
    access_token: "seconds", # accepts seconds, minutes, hours, days
    id_token: "seconds", # accepts seconds, minutes, hours, days
    refresh_token: "seconds", # accepts seconds, minutes, hours, days
  },
  read_attributes: ["ClientPermissionType"],
  write_attributes: ["ClientPermissionType"],
  explicit_auth_flows: ["ADMIN_NO_SRP_AUTH"], # accepts 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
  supported_identity_providers: ["ProviderNameType"],
  callback_urls: ["RedirectUrlType"],
  logout_urls: ["RedirectUrlType"],
  default_redirect_uri: "RedirectUrlType",
  allowed_o_auth_flows: ["code"], # accepts code, implicit, client_credentials
  allowed_o_auth_scopes: ["ScopeType"],
  allowed_o_auth_flows_user_pool_client: false,
  analytics_configuration: {
    application_id: "HexStringType",
    application_arn: "ArnType",
    role_arn: "ArnType",
    external_id: "StringType",
    user_data_shared: false,
  },
  prevent_user_existence_errors: "LEGACY", # accepts LEGACY, ENABLED
  enable_token_revocation: false,
  enable_propagate_additional_user_context_data: false,
  auth_session_validity: 1,
})

Response structure


resp.user_pool_client.user_pool_id #=> String
resp.user_pool_client.client_name #=> String
resp.user_pool_client.client_id #=> String
resp.user_pool_client.client_secret #=> String
resp.user_pool_client.last_modified_date #=> Time
resp.user_pool_client.creation_date #=> Time
resp.user_pool_client.refresh_token_validity #=> Integer
resp.user_pool_client.access_token_validity #=> Integer
resp.user_pool_client.id_token_validity #=> Integer
resp.user_pool_client.token_validity_units.access_token #=> String, one of "seconds", "minutes", "hours", "days"
resp.user_pool_client.token_validity_units.id_token #=> String, one of "seconds", "minutes", "hours", "days"
resp.user_pool_client.token_validity_units.refresh_token #=> String, one of "seconds", "minutes", "hours", "days"
resp.user_pool_client.read_attributes #=> Array
resp.user_pool_client.read_attributes[0] #=> String
resp.user_pool_client.write_attributes #=> Array
resp.user_pool_client.write_attributes[0] #=> String
resp.user_pool_client.explicit_auth_flows #=> Array
resp.user_pool_client.explicit_auth_flows[0] #=> String, one of "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"
resp.user_pool_client.supported_identity_providers #=> Array
resp.user_pool_client.supported_identity_providers[0] #=> String
resp.user_pool_client.callback_urls #=> Array
resp.user_pool_client.callback_urls[0] #=> String
resp.user_pool_client.logout_urls #=> Array
resp.user_pool_client.logout_urls[0] #=> String
resp.user_pool_client.default_redirect_uri #=> String
resp.user_pool_client.allowed_o_auth_flows #=> Array
resp.user_pool_client.allowed_o_auth_flows[0] #=> String, one of "code", "implicit", "client_credentials"
resp.user_pool_client.allowed_o_auth_scopes #=> Array
resp.user_pool_client.allowed_o_auth_scopes[0] #=> String
resp.user_pool_client.allowed_o_auth_flows_user_pool_client #=> Boolean
resp.user_pool_client.analytics_configuration.application_id #=> String
resp.user_pool_client.analytics_configuration.application_arn #=> String
resp.user_pool_client.analytics_configuration.role_arn #=> String
resp.user_pool_client.analytics_configuration.external_id #=> String
resp.user_pool_client.analytics_configuration.user_data_shared #=> Boolean
resp.user_pool_client.prevent_user_existence_errors #=> String, one of "LEGACY", "ENABLED"
resp.user_pool_client.enable_token_revocation #=> Boolean
resp.user_pool_client.enable_propagate_additional_user_context_data #=> Boolean
resp.user_pool_client.auth_session_validity #=> Integer

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

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

  • :client_name (required, String)

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

  • :generate_secret (Boolean)

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

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

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

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

  • :token_validity_units (Types::TokenValidityUnitsType)

    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.

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

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

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

    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.

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

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

  • :logout_urls (Array<String>)

    A list of allowed logout URLs for the IdPs.

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

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

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

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

  • :analytics_configuration (Types::AnalyticsConfigurationType)

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

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

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

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

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

  • :auth_session_validity (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:

See Also:



5370
5371
5372
5373
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 5370

def create_user_pool_client(params = {}, options = {})
  req = build_request(:create_user_pool_client, params)
  req.send_request(options)
end

#create_user_pool_domain(params = {}) ⇒ Types::CreateUserPoolDomainResponse

Creates a new domain for a user pool.

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

Learn more

Examples:

Request syntax with placeholder values


resp = client.create_user_pool_domain({
  domain: "DomainType", # required
  user_pool_id: "UserPoolIdType", # required
  custom_domain_config: {
    certificate_arn: "ArnType", # required
  },
})

Response structure


resp.cloud_front_domain #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :domain (required, 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.

  • :user_pool_id (required, String)

    The user pool ID.

  • :custom_domain_config (Types::CustomDomainConfigType)

    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.

Returns:

See Also:



5440
5441
5442
5443
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 5440

def create_user_pool_domain(params = {}, options = {})
  req = build_request(:create_user_pool_domain, params)
  req.send_request(options)
end

#delete_group(params = {}) ⇒ Struct

Deletes a group.

Calling this action requires developer credentials.

Examples:

Request syntax with placeholder values


resp = client.delete_group({
  group_name: "GroupNameType", # required
  user_pool_id: "UserPoolIdType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :group_name (required, String)

    The name of the group.

  • :user_pool_id (required, String)

    The user pool ID for the user pool.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



5468
5469
5470
5471
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 5468

def delete_group(params = {}, options = {})
  req = build_request(:delete_group, params)
  req.send_request(options)
end

#delete_identity_provider(params = {}) ⇒ Struct

Deletes an IdP for a user pool.

Examples:

Request syntax with placeholder values


resp = client.delete_identity_provider({
  user_pool_id: "UserPoolIdType", # required
  provider_name: "ProviderNameType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

    The user pool ID.

  • :provider_name (required, String)

    The IdP name.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



5494
5495
5496
5497
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 5494

def delete_identity_provider(params = {}, options = {})
  req = build_request(:delete_identity_provider, params)
  req.send_request(options)
end

#delete_resource_server(params = {}) ⇒ Struct

Deletes a resource server.

Examples:

Request syntax with placeholder values


resp = client.delete_resource_server({
  user_pool_id: "UserPoolIdType", # required
  identifier: "ResourceServerIdentifierType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

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

  • :identifier (required, String)

    The identifier for the resource server.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



5520
5521
5522
5523
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 5520

def delete_resource_server(params = {}, options = {})
  req = build_request(:delete_resource_server, params)
  req.send_request(options)
end

#delete_user(params = {}) ⇒ Struct

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.

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.

Examples:

Request syntax with placeholder values


resp = client.delete_user({
  access_token: "TokenModelType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :access_token (required, String)

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

Returns:

  • (Struct)

    Returns an empty response.

See Also:



5559
5560
5561
5562
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 5559

def delete_user(params = {}, options = {})
  req = build_request(:delete_user, params)
  req.send_request(options)
end

#delete_user_attributes(params = {}) ⇒ Struct

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.

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.

Examples:

Request syntax with placeholder values


resp = client.delete_user_attributes({
  user_attribute_names: ["AttributeNameType"], # required
  access_token: "TokenModelType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_attribute_names (required, 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.

  • :access_token (required, String)

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

Returns:

  • (Struct)

    Returns an empty response.

See Also:



5606
5607
5608
5609
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 5606

def delete_user_attributes(params = {}, options = {})
  req = build_request(:delete_user_attributes, params)
  req.send_request(options)
end

#delete_user_pool(params = {}) ⇒ Struct

Deletes the specified Amazon Cognito user pool.

Examples:

Request syntax with placeholder values


resp = client.delete_user_pool({
  user_pool_id: "UserPoolIdType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

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

Returns:

  • (Struct)

    Returns an empty response.

See Also:



5628
5629
5630
5631
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 5628

def delete_user_pool(params = {}, options = {})
  req = build_request(:delete_user_pool, params)
  req.send_request(options)
end

#delete_user_pool_client(params = {}) ⇒ Struct

Allows the developer to delete the user pool client.

Examples:

Request syntax with placeholder values


resp = client.delete_user_pool_client({
  user_pool_id: "UserPoolIdType", # required
  client_id: "ClientIdType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

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

  • :client_id (required, String)

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

Returns:

  • (Struct)

    Returns an empty response.

See Also:



5655
5656
5657
5658
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 5655

def delete_user_pool_client(params = {}, options = {})
  req = build_request(:delete_user_pool_client, params)
  req.send_request(options)
end

#delete_user_pool_domain(params = {}) ⇒ Struct

Deletes a domain for a user pool.

Examples:

Request syntax with placeholder values


resp = client.delete_user_pool_domain({
  domain: "DomainType", # required
  user_pool_id: "UserPoolIdType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :domain (required, 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.

  • :user_pool_id (required, String)

    The user pool ID.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



5683
5684
5685
5686
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 5683

def delete_user_pool_domain(params = {}, options = {})
  req = build_request(:delete_user_pool_domain, params)
  req.send_request(options)
end

#describe_identity_provider(params = {}) ⇒ Types::DescribeIdentityProviderResponse

Gets information about a specific IdP.

Examples:

Request syntax with placeholder values


resp = client.describe_identity_provider({
  user_pool_id: "UserPoolIdType", # required
  provider_name: "ProviderNameType", # required
})

Response structure


resp.identity_provider.user_pool_id #=> String
resp.identity_provider.provider_name #=> String
resp.identity_provider.provider_type #=> String, one of "SAML", "Facebook", "Google", "LoginWithAmazon", "SignInWithApple", "OIDC"
resp.identity_provider.provider_details #=> Hash
resp.identity_provider.provider_details["StringType"] #=> String
resp.identity_provider.attribute_mapping #=> Hash
resp.identity_provider.attribute_mapping["AttributeMappingKeyType"] #=> String
resp.identity_provider.idp_identifiers #=> Array
resp.identity_provider.idp_identifiers[0] #=> String
resp.identity_provider.last_modified_date #=> Time
resp.identity_provider.creation_date #=> Time

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

    The user pool ID.

  • :provider_name (required, String)

    The IdP name.

Returns:

See Also:



5725
5726
5727
5728
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 5725

def describe_identity_provider(params = {}, options = {})
  req = build_request(:describe_identity_provider, params)
  req.send_request(options)
end

#describe_resource_server(params = {}) ⇒ Types::DescribeResourceServerResponse

Describes a resource server.

Examples:

Request syntax with placeholder values


resp = client.describe_resource_server({
  user_pool_id: "UserPoolIdType", # required
  identifier: "ResourceServerIdentifierType", # required
})

Response structure


resp.resource_server.user_pool_id #=> String
resp.resource_server.identifier #=> String
resp.resource_server.name #=> String
resp.resource_server.scopes #=> Array
resp.resource_server.scopes[0].scope_name #=> String
resp.resource_server.scopes[0].scope_description #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

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

  • :identifier (required, String)

    The identifier for the resource server

Returns:

See Also:



5762
5763
5764
5765
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 5762

def describe_resource_server(params = {}, options = {})
  req = build_request(:describe_resource_server, params)
  req.send_request(options)
end

#describe_risk_configuration(params = {}) ⇒ Types::DescribeRiskConfigurationResponse

Describes the risk configuration.

Examples:

Request syntax with placeholder values


resp = client.describe_risk_configuration({
  user_pool_id: "UserPoolIdType", # required
  client_id: "ClientIdType",
})

Response structure


resp.risk_configuration.user_pool_id #=> String
resp.risk_configuration.client_id #=> String
resp.risk_configuration.compromised_credentials_risk_configuration.event_filter #=> Array
resp.risk_configuration.compromised_credentials_risk_configuration.event_filter[0] #=> String, one of "SIGN_IN", "PASSWORD_CHANGE", "SIGN_UP"
resp.risk_configuration.compromised_credentials_risk_configuration.actions.event_action #=> String, one of "BLOCK", "NO_ACTION"
resp.risk_configuration..notify_configuration.from #=> String
resp.risk_configuration..notify_configuration.reply_to #=> String
resp.risk_configuration..notify_configuration.source_arn #=> String
resp.risk_configuration..notify_configuration.block_email.subject #=> String
resp.risk_configuration..notify_configuration.block_email.html_body #=> String
resp.risk_configuration..notify_configuration.block_email.text_body #=> String
resp.risk_configuration..notify_configuration.no_action_email.subject #=> String
resp.risk_configuration..notify_configuration.no_action_email.html_body #=> String
resp.risk_configuration..notify_configuration.no_action_email.text_body #=> String
resp.risk_configuration..notify_configuration.mfa_email.subject #=> String
resp.risk_configuration..notify_configuration.mfa_email.html_body #=> String
resp.risk_configuration..notify_configuration.mfa_email.text_body #=> String
resp.risk_configuration..actions.low_action.notify #=> Boolean
resp.risk_configuration..actions.low_action.event_action #=> String, one of "BLOCK", "MFA_IF_CONFIGURED", "MFA_REQUIRED", "NO_ACTION"
resp.risk_configuration..actions.medium_action.notify #=> Boolean
resp.risk_configuration..actions.medium_action.event_action #=> String, one of "BLOCK", "MFA_IF_CONFIGURED", "MFA_REQUIRED", "NO_ACTION"
resp.risk_configuration..actions.high_action.notify #=> Boolean
resp.risk_configuration..actions.high_action.event_action #=> String, one of "BLOCK", "MFA_IF_CONFIGURED", "MFA_REQUIRED", "NO_ACTION"
resp.risk_configuration.risk_exception_configuration.blocked_ip_range_list #=> Array
resp.risk_configuration.risk_exception_configuration.blocked_ip_range_list[0] #=> String
resp.risk_configuration.risk_exception_configuration.skipped_ip_range_list #=> Array
resp.risk_configuration.risk_exception_configuration.skipped_ip_range_list[0] #=> String
resp.risk_configuration.last_modified_date #=> Time

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

    The user pool ID.

  • :client_id (String)

    The app client ID.

Returns:

See Also:



5821
5822
5823
5824
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 5821

def describe_risk_configuration(params = {}, options = {})
  req = build_request(:describe_risk_configuration, params)
  req.send_request(options)
end

#describe_user_import_job(params = {}) ⇒ Types::DescribeUserImportJobResponse

Describes the user import job.

Examples:

Request syntax with placeholder values


resp = client.describe_user_import_job({
  user_pool_id: "UserPoolIdType", # required
  job_id: "UserImportJobIdType", # required
})

Response structure


resp.user_import_job.job_name #=> String
resp.user_import_job.job_id #=> String
resp.user_import_job.user_pool_id #=> String
resp.user_import_job.pre_signed_url #=> String
resp.user_import_job.creation_date #=> Time
resp.user_import_job.start_date #=> Time
resp.user_import_job.completion_date #=> Time
resp.user_import_job.status #=> String, one of "Created", "Pending", "InProgress", "Stopping", "Expired", "Stopped", "Failed", "Succeeded"
resp.user_import_job.cloud_watch_logs_role_arn #=> String
resp.user_import_job.imported_users #=> Integer
resp.user_import_job.skipped_users #=> Integer
resp.user_import_job.failed_users #=> Integer
resp.user_import_job.completion_message #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

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

  • :job_id (required, String)

    The job ID for the user import job.

Returns:

See Also:



5866
5867
5868
5869
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 5866

def describe_user_import_job(params = {}, options = {})
  req = build_request(:describe_user_import_job, params)
  req.send_request(options)
end

#describe_user_pool(params = {}) ⇒ Types::DescribeUserPoolResponse

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

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

Learn more

Examples:

Request syntax with placeholder values


resp = client.describe_user_pool({
  user_pool_id: "UserPoolIdType", # required
})

Response structure


resp.user_pool.id #=> String
resp.user_pool.name #=> String
resp.user_pool.policies.password_policy.minimum_length #=> Integer
resp.user_pool.policies.password_policy.require_uppercase #=> Boolean
resp.user_pool.policies.password_policy.require_lowercase #=> Boolean
resp.user_pool.policies.password_policy.require_numbers #=> Boolean
resp.user_pool.policies.password_policy.require_symbols #=> Boolean
resp.user_pool.policies.password_policy.temporary_password_validity_days #=> Integer
resp.user_pool.deletion_protection #=> String, one of "ACTIVE", "INACTIVE"
resp.user_pool.lambda_config. #=> String
resp.user_pool.lambda_config.custom_message #=> String
resp.user_pool.lambda_config.post_confirmation #=> String
resp.user_pool.lambda_config.pre_authentication #=> String
resp.user_pool.lambda_config.post_authentication #=> String
resp.user_pool.lambda_config.define_auth_challenge #=> String
resp.user_pool.lambda_config.create_auth_challenge #=> String
resp.user_pool.lambda_config.verify_auth_challenge_response #=> String
resp.user_pool.lambda_config.pre_token_generation #=> String
resp.user_pool.lambda_config.user_migration #=> String
resp.user_pool.lambda_config.pre_token_generation_config.lambda_version #=> String, one of "V1_0", "V2_0"
resp.user_pool.lambda_config.pre_token_generation_config.lambda_arn #=> String
resp.user_pool.lambda_config.custom_sms_sender.lambda_version #=> String, one of "V1_0"
resp.user_pool.lambda_config.custom_sms_sender.lambda_arn #=> String
resp.user_pool.lambda_config.custom_email_sender.lambda_version #=> String, one of "V1_0"
resp.user_pool.lambda_config.custom_email_sender.lambda_arn #=> String
resp.user_pool.lambda_config.kms_key_id #=> String
resp.user_pool.status #=> String, one of "Enabled", "Disabled"
resp.user_pool.last_modified_date #=> Time
resp.user_pool.creation_date #=> Time
resp.user_pool.schema_attributes #=> Array
resp.user_pool.schema_attributes[0].name #=> String
resp.user_pool.schema_attributes[0].attribute_data_type #=> String, one of "String", "Number", "DateTime", "Boolean"
resp.user_pool.schema_attributes[0].developer_only_attribute #=> Boolean
resp.user_pool.schema_attributes[0].mutable #=> Boolean
resp.user_pool.schema_attributes[0].required #=> Boolean
resp.user_pool.schema_attributes[0].number_attribute_constraints.min_value #=> String
resp.user_pool.schema_attributes[0].number_attribute_constraints.max_value #=> String
resp.user_pool.schema_attributes[0].string_attribute_constraints.min_length #=> String
resp.user_pool.schema_attributes[0].string_attribute_constraints.max_length #=> String
resp.user_pool.auto_verified_attributes #=> Array
resp.user_pool.auto_verified_attributes[0] #=> String, one of "phone_number", "email"
resp.user_pool.alias_attributes #=> Array
resp.user_pool.alias_attributes[0] #=> String, one of "phone_number", "email", "preferred_username"
resp.user_pool.username_attributes #=> Array
resp.user_pool.username_attributes[0] #=> String, one of "phone_number", "email"
resp.user_pool.sms_verification_message #=> String
resp.user_pool.email_verification_message #=> String
resp.user_pool.email_verification_subject #=> String
resp.user_pool.verification_message_template.sms_message #=> String
resp.user_pool.verification_message_template.email_message #=> String
resp.user_pool.verification_message_template.email_subject #=> String
resp.user_pool.verification_message_template.email_message_by_link #=> String
resp.user_pool.verification_message_template.email_subject_by_link #=> String
resp.user_pool.verification_message_template.default_email_option #=> String, one of "CONFIRM_WITH_LINK", "CONFIRM_WITH_CODE"
resp.user_pool.sms_authentication_message #=> String
resp.user_pool.user_attribute_update_settings.attributes_require_verification_before_update #=> Array
resp.user_pool.user_attribute_update_settings.attributes_require_verification_before_update[0] #=> String, one of "phone_number", "email"
resp.user_pool.mfa_configuration #=> String, one of "OFF", "ON", "OPTIONAL"
resp.user_pool.device_configuration.challenge_required_on_new_device #=> Boolean
resp.user_pool.device_configuration.device_only_remembered_on_user_prompt #=> Boolean
resp.user_pool.estimated_number_of_users #=> Integer
resp.user_pool.email_configuration.source_arn #=> String
resp.user_pool.email_configuration.reply_to_email_address #=> String
resp.user_pool.email_configuration. #=> String, one of "COGNITO_DEFAULT", "DEVELOPER"
resp.user_pool.email_configuration.from #=> String
resp.user_pool.email_configuration.configuration_set #=> String
resp.user_pool.sms_configuration.sns_caller_arn #=> String
resp.user_pool.sms_configuration.external_id #=> String
resp.user_pool.sms_configuration.sns_region #=> String
resp.user_pool.user_pool_tags #=> Hash
resp.user_pool.user_pool_tags["TagKeysType"] #=> String
resp.user_pool.sms_configuration_failure #=> String
resp.user_pool.email_configuration_failure #=> String
resp.user_pool.domain #=> String
resp.user_pool.custom_domain #=> String
resp.user_pool.admin_create_user_config.allow_admin_create_user_only #=> Boolean
resp.user_pool.admin_create_user_config. #=> Integer
resp.user_pool.admin_create_user_config.invite_message_template.sms_message #=> String
resp.user_pool.admin_create_user_config.invite_message_template.email_message #=> String
resp.user_pool.admin_create_user_config.invite_message_template.email_subject #=> String
resp.user_pool.user_pool_add_ons.advanced_security_mode #=> String, one of "OFF", "AUDIT", "ENFORCED"
resp.user_pool.username_configuration.case_sensitive #=> Boolean
resp.user_pool.arn #=> String
resp.user_pool..recovery_mechanisms #=> Array
resp.user_pool..recovery_mechanisms[0].priority #=> Integer
resp.user_pool..recovery_mechanisms[0].name #=> String, one of "verified_email", "verified_phone_number", "admin_only"

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

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

Returns:

See Also:



5998
5999
6000
6001
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 5998

def describe_user_pool(params = {}, options = {})
  req = build_request(:describe_user_pool, params)
  req.send_request(options)
end

#describe_user_pool_client(params = {}) ⇒ Types::DescribeUserPoolClientResponse

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

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

Examples:

Request syntax with placeholder values


resp = client.describe_user_pool_client({
  user_pool_id: "UserPoolIdType", # required
  client_id: "ClientIdType", # required
})

Response structure


resp.user_pool_client.user_pool_id #=> String
resp.user_pool_client.client_name #=> String
resp.user_pool_client.client_id #=> String
resp.user_pool_client.client_secret #=> String
resp.user_pool_client.last_modified_date #=> Time
resp.user_pool_client.creation_date #=> Time
resp.user_pool_client.refresh_token_validity #=> Integer
resp.user_pool_client.access_token_validity #=> Integer
resp.user_pool_client.id_token_validity #=> Integer
resp.user_pool_client.token_validity_units.access_token #=> String, one of "seconds", "minutes", "hours", "days"
resp.user_pool_client.token_validity_units.id_token #=> String, one of "seconds", "minutes", "hours", "days"
resp.user_pool_client.token_validity_units.refresh_token #=> String, one of "seconds", "minutes", "hours", "days"
resp.user_pool_client.read_attributes #=> Array
resp.user_pool_client.read_attributes[0] #=> String
resp.user_pool_client.write_attributes #=> Array
resp.user_pool_client.write_attributes[0] #=> String
resp.user_pool_client.explicit_auth_flows #=> Array
resp.user_pool_client.explicit_auth_flows[0] #=> String, one of "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"
resp.user_pool_client.supported_identity_providers #=> Array
resp.user_pool_client.supported_identity_providers[0] #=> String
resp.user_pool_client.callback_urls #=> Array
resp.user_pool_client.callback_urls[0] #=> String
resp.user_pool_client.logout_urls #=> Array
resp.user_pool_client.logout_urls[0] #=> String
resp.user_pool_client.default_redirect_uri #=> String
resp.user_pool_client.allowed_o_auth_flows #=> Array
resp.user_pool_client.allowed_o_auth_flows[0] #=> String, one of "code", "implicit", "client_credentials"
resp.user_pool_client.allowed_o_auth_scopes #=> Array
resp.user_pool_client.allowed_o_auth_scopes[0] #=> String
resp.user_pool_client.allowed_o_auth_flows_user_pool_client #=> Boolean
resp.user_pool_client.analytics_configuration.application_id #=> String
resp.user_pool_client.analytics_configuration.application_arn #=> String
resp.user_pool_client.analytics_configuration.role_arn #=> String
resp.user_pool_client.analytics_configuration.external_id #=> String
resp.user_pool_client.analytics_configuration.user_data_shared #=> Boolean
resp.user_pool_client.prevent_user_existence_errors #=> String, one of "LEGACY", "ENABLED"
resp.user_pool_client.enable_token_revocation #=> Boolean
resp.user_pool_client.enable_propagate_additional_user_context_data #=> Boolean
resp.user_pool_client.auth_session_validity #=> Integer

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

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

  • :client_id (required, String)

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

Returns:

See Also:



6087
6088
6089
6090
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 6087

def describe_user_pool_client(params = {}, options = {})
  req = build_request(:describe_user_pool_client, params)
  req.send_request(options)
end

#describe_user_pool_domain(params = {}) ⇒ Types::DescribeUserPoolDomainResponse

Gets information about a domain.

Examples:

Request syntax with placeholder values


resp = client.describe_user_pool_domain({
  domain: "DomainType", # required
})

Response structure


resp.domain_description.user_pool_id #=> String
resp.domain_description. #=> String
resp.domain_description.domain #=> String
resp.domain_description.s3_bucket #=> String
resp.domain_description.cloud_front_distribution #=> String
resp.domain_description.version #=> String
resp.domain_description.status #=> String, one of "CREATING", "DELETING", "UPDATING", "ACTIVE", "FAILED"
resp.domain_description.custom_domain_config.certificate_arn #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :domain (required, 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.

Returns:

See Also:



6124
6125
6126
6127
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 6124

def describe_user_pool_domain(params = {}, options = {})
  req = build_request(:describe_user_pool_domain, params)
  req.send_request(options)
end

#forget_device(params = {}) ⇒ Struct

Forgets the specified device. For more information about device authentication, see Working with user devices in your user pool.

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

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

Examples:

Request syntax with placeholder values


resp = client.forget_device({
  access_token: "TokenModelType",
  device_key: "DeviceKeyType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :access_token (String)

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

  • :device_key (required, String)

    The device key.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



6169
6170
6171
6172
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 6169

def forget_device(params = {}, options = {})
  req = build_request(:forget_device, params)
  req.send_request(options)
end

#forgot_password(params = {}) ⇒ Types::ForgotPasswordResponse

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

If neither a verified phone number nor a verified email exists, this API returns InvalidParameterException. If your app client has a client secret and you don't provide a SECRET_HASH parameter, this API returns NotAuthorizedException.

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

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

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

If you have never used SMS text messages with Amazon Cognito or any other Amazon Web 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:

Request syntax with placeholder values


resp = client.forgot_password({
  client_id: "ClientIdType", # required
  secret_hash: "SecretHashType",
  user_context_data: {
    ip_address: "StringType",
    encoded_data: "StringType",
  },
  username: "UsernameType", # required
  analytics_metadata: {
    analytics_endpoint_id: "StringType",
  },
  client_metadata: {
    "StringType" => "StringType",
  },
})

Response structure


resp.code_delivery_details.destination #=> String
resp.code_delivery_details.delivery_medium #=> String, one of "SMS", "EMAIL"
resp.code_delivery_details.attribute_name #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :client_id (required, String)

    The ID of the client associated with the user pool.

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

  • :user_context_data (Types::UserContextDataType)

    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.

  • :username (required, 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.

  • :analytics_metadata (Types::AnalyticsMetadataType)

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

  • :client_metadata (Hash<String,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.

    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.

Returns:

See Also:



6326
6327
6328
6329
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 6326

def forgot_password(params = {}, options = {})
  req = build_request(:forgot_password, params)
  req.send_request(options)
end

#get_csv_header(params = {}) ⇒ Types::GetCSVHeaderResponse

Gets the header information for the comma-separated value (CSV) file to be used as input for the user import job.

Examples:

Request syntax with placeholder values


resp = client.get_csv_header({
  user_pool_id: "UserPoolIdType", # required
})

Response structure


resp.user_pool_id #=> String
resp.csv_header #=> Array
resp.csv_header[0] #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

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

Returns:

See Also:



6359
6360
6361
6362
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 6359

def get_csv_header(params = {}, options = {})
  req = build_request(:get_csv_header, params)
  req.send_request(options)
end

#get_device(params = {}) ⇒ Types::GetDeviceResponse

Gets the device. For more information about device authentication, see Working with user devices in your user pool.

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

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

Examples:

Request syntax with placeholder values


resp = client.get_device({
  device_key: "DeviceKeyType", # required
  access_token: "TokenModelType",
})

Response structure


resp.device.device_key #=> String
resp.device.device_attributes #=> Array
resp.device.device_attributes[0].name #=> String
resp.device.device_attributes[0].value #=> String
resp.device.device_create_date #=> Time
resp.device.device_last_modified_date #=> Time
resp.device.device_last_authenticated_date #=> Time

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :device_key (required, String)

    The device key.

  • :access_token (String)

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

Returns:

See Also:



6416
6417
6418
6419
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 6416

def get_device(params = {}, options = {})
  req = build_request(:get_device, params)
  req.send_request(options)
end

#get_group(params = {}) ⇒ Types::GetGroupResponse

Gets a group.

Calling this action requires developer credentials.

Examples:

Request syntax with placeholder values


resp = client.get_group({
  group_name: "GroupNameType", # required
  user_pool_id: "UserPoolIdType", # required
})

Response structure


resp.group.group_name #=> String
resp.group.user_pool_id #=> String
resp.group.description #=> String
resp.group.role_arn #=> String
resp.group.precedence #=> Integer
resp.group.last_modified_date #=> Time
resp.group.creation_date #=> Time

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :group_name (required, String)

    The name of the group.

  • :user_pool_id (required, String)

    The user pool ID for the user pool.

Returns:

See Also:



6456
6457
6458
6459
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 6456

def get_group(params = {}, options = {})
  req = build_request(:get_group, params)
  req.send_request(options)
end

#get_identity_provider_by_identifier(params = {}) ⇒ Types::GetIdentityProviderByIdentifierResponse

Gets the specified IdP.

Examples:

Request syntax with placeholder values


resp = client.get_identity_provider_by_identifier({
  user_pool_id: "UserPoolIdType", # required
  idp_identifier: "IdpIdentifierType", # required
})

Response structure


resp.identity_provider.user_pool_id #=> String
resp.identity_provider.provider_name #=> String
resp.identity_provider.provider_type #=> String, one of "SAML", "Facebook", "Google", "LoginWithAmazon", "SignInWithApple", "OIDC"
resp.identity_provider.provider_details #=> Hash
resp.identity_provider.provider_details["StringType"] #=> String
resp.identity_provider.attribute_mapping #=> Hash
resp.identity_provider.attribute_mapping["AttributeMappingKeyType"] #=> String
resp.identity_provider.idp_identifiers #=> Array
resp.identity_provider.idp_identifiers[0] #=> String
resp.identity_provider.last_modified_date #=> Time
resp.identity_provider.creation_date #=> Time

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

    The user pool ID.

  • :idp_identifier (required, String)

    The IdP identifier.

Returns:

See Also:



6498
6499
6500
6501
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 6498

def get_identity_provider_by_identifier(params = {}, options = {})
  req = build_request(:get_identity_provider_by_identifier, params)
  req.send_request(options)
end

#get_log_delivery_configuration(params = {}) ⇒ Types::GetLogDeliveryConfigurationResponse

Gets the detailed activity logging configuration for a user pool.

Examples:

Request syntax with placeholder values


resp = client.get_log_delivery_configuration({
  user_pool_id: "UserPoolIdType", # required
})

Response structure


resp.log_delivery_configuration.user_pool_id #=> String
resp.log_delivery_configuration.log_configurations #=> Array
resp.log_delivery_configuration.log_configurations[0].log_level #=> String, one of "ERROR"
resp.log_delivery_configuration.log_configurations[0].event_source #=> String, one of "userNotification"
resp.log_delivery_configuration.log_configurations[0].cloud_watch_logs_configuration.log_group_arn #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

    The ID of the user pool where you want to view detailed activity logging configuration.

Returns:

See Also:



6531
6532
6533
6534
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 6531

def get_log_delivery_configuration(params = {}, options = {})
  req = build_request(:get_log_delivery_configuration, params)
  req.send_request(options)
end

#get_signing_certificate(params = {}) ⇒ Types::GetSigningCertificateResponse

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.

Examples:

Request syntax with placeholder values


resp = client.get_signing_certificate({
  user_pool_id: "UserPoolIdType", # required
})

Response structure


resp.certificate #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

    The user pool ID.

Returns:

See Also:



6565
6566
6567
6568
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 6565

def get_signing_certificate(params = {}, options = {})
  req = build_request(:get_signing_certificate, params)
  req.send_request(options)
end

#get_ui_customization(params = {}) ⇒ Types::GetUICustomizationResponse

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.

Examples:

Request syntax with placeholder values


resp = client.get_ui_customization({
  user_pool_id: "UserPoolIdType", # required
  client_id: "ClientIdType",
})

Response structure


resp.ui_customization.user_pool_id #=> String
resp.ui_customization.client_id #=> String
resp.ui_customization.image_url #=> String
resp.ui_customization.css #=> String
resp.ui_customization.css_version #=> String
resp.ui_customization.last_modified_date #=> Time
resp.ui_customization.creation_date #=> Time

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

    The user pool ID for the user pool.

  • :client_id (String)

    The client ID for the client app.

Returns:

See Also:



6608
6609
6610
6611
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 6608

def get_ui_customization(params = {}, options = {})
  req = build_request(:get_ui_customization, params)
  req.send_request(options)
end

#get_user(params = {}) ⇒ Types::GetUserResponse

Gets the user attributes and metadata for a user.

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

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

Examples:

Request syntax with placeholder values


resp = client.get_user({
  access_token: "TokenModelType", # required
})

Response structure


resp.username #=> String
resp.user_attributes #=> Array
resp.user_attributes[0].name #=> String
resp.user_attributes[0].value #=> String
resp.mfa_options #=> Array
resp.mfa_options[0].delivery_medium #=> String, one of "SMS", "EMAIL"
resp.mfa_options[0].attribute_name #=> String
resp.preferred_mfa_setting #=> String
resp.user_mfa_setting_list #=> Array
resp.user_mfa_setting_list[0] #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :access_token (required, String)

    A non-expired access token for the user whose information you want to query.

Returns:

See Also:



6666
6667
6668
6669
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 6666

def get_user(params = {}, options = {})
  req = build_request(:get_user, params)
  req.send_request(options)
end

#get_user_attribute_verification_code(params = {}) ⇒ Types::GetUserAttributeVerificationCodeResponse

Generates a user attribute verification code for the specified attribute name. Sends a message to a user with a code that they must return in a VerifyUserAttribute request.

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

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

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

If you have never used SMS text messages with Amazon Cognito or any other Amazon Web 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:

Request syntax with placeholder values


resp = client.get_user_attribute_verification_code({
  access_token: "TokenModelType", # required
  attribute_name: "AttributeNameType", # required
  client_metadata: {
    "StringType" => "StringType",
  },
})

Response structure


resp.code_delivery_details.destination #=> String
resp.code_delivery_details.delivery_medium #=> String, one of "SMS", "EMAIL"
resp.code_delivery_details.attribute_name #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :access_token (required, String)

    A non-expired access token for the user whose attribute verification code you want to generate.

  • :attribute_name (required, String)

    The attribute name returned by the server response to get the user attribute verification code.

  • :client_metadata (Hash<String,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.

    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.

Returns:

See Also:



6783
6784
6785
6786
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 6783

def get_user_attribute_verification_code(params = {}, options = {})
  req = build_request(:get_user_attribute_verification_code, params)
  req.send_request(options)
end

#get_user_pool_mfa_config(params = {}) ⇒ Types::GetUserPoolMfaConfigResponse

Gets the user pool multi-factor authentication (MFA) configuration.

Examples:

Request syntax with placeholder values


resp = client.get_user_pool_mfa_config({
  user_pool_id: "UserPoolIdType", # required
})

Response structure


resp.sms_mfa_configuration.sms_authentication_message #=> String
resp.sms_mfa_configuration.sms_configuration.sns_caller_arn #=> String
resp.sms_mfa_configuration.sms_configuration.external_id #=> String
resp.sms_mfa_configuration.sms_configuration.sns_region #=> String
resp.software_token_mfa_configuration.enabled #=> Boolean
resp.mfa_configuration #=> String, one of "OFF", "ON", "OPTIONAL"

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

    The user pool ID.

Returns:

See Also:



6818
6819
6820
6821
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 6818

def get_user_pool_mfa_config(params = {}, options = {})
  req = build_request(:get_user_pool_mfa_config, params)
  req.send_request(options)
end

#global_sign_out(params = {}) ⇒ Struct

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.

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.

Examples:

Request syntax with placeholder values


resp = client.global_sign_out({
  access_token: "TokenModelType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :access_token (required, String)

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

Returns:

  • (Struct)

    Returns an empty response.

See Also:



6881
6882
6883
6884
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 6881

def global_sign_out(params = {}, options = {})
  req = build_request(:global_sign_out, params)
  req.send_request(options)
end

#initiate_auth(params = {}) ⇒ Types::InitiateAuthResponse

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

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

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

If you have never used SMS text messages with Amazon Cognito or any other Amazon Web 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:

Example: 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.

resp = client.initiate_auth({
  analytics_metadata: {
    analytics_endpoint_id: "d70b2ba36a8c4dc5a04a0451a31a1e12", 
  }, 
  auth_flow: "USER_PASSWORD_AUTH", 
  auth_parameters: {
    "PASSWORD" => "This-is-my-test-99!", 
    "SECRET_HASH" => "oT5ZkS8ctnrhYeeGsGTvOzPhoc/Jd1cO5fueBWFVmp8=", 
    "USERNAME" => "mytestuser", 
  }, 
  client_id: "1example23456789", 
  client_metadata: {
    "MyTestKey" => "MyTestValue", 
  }, 
  user_context_data: {
    encoded_data: "AmazonCognitoAdvancedSecurityData_object", 
    ip_address: "192.0.2.1", 
  }, 
})

resp.to_h outputs the following:
{
  challenge_name: "SOFTWARE_TOKEN_MFA", 
  challenge_parameters: {
    "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", 
}

Request syntax with placeholder values


resp = client.initiate_auth({
  auth_flow: "USER_SRP_AUTH", # required, accepts USER_SRP_AUTH, REFRESH_TOKEN_AUTH, REFRESH_TOKEN, CUSTOM_AUTH, ADMIN_NO_SRP_AUTH, USER_PASSWORD_AUTH, ADMIN_USER_PASSWORD_AUTH
  auth_parameters: {
    "StringType" => "StringType",
  },
  client_metadata: {
    "StringType" => "StringType",
  },
  client_id: "ClientIdType", # required
  analytics_metadata: {
    analytics_endpoint_id: "StringType",
  },
  user_context_data: {
    ip_address: "StringType",
    encoded_data: "StringType",
  },
})

Response structure


resp.challenge_name #=> String, one of "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"
resp.session #=> String
resp.challenge_parameters #=> Hash
resp.challenge_parameters["StringType"] #=> String
resp.authentication_result.access_token #=> String
resp.authentication_result.expires_in #=> Integer
resp.authentication_result.token_type #=> String
resp.authentication_result.refresh_token #=> String
resp.authentication_result.id_token #=> String
resp.authentication_result..device_key #=> String
resp.authentication_result..device_group_key #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :auth_flow (required, 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.

  • :auth_parameters (Hash<String,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.

  • :client_metadata (Hash<String,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.

    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.

  • :client_id (required, String)

    The app client ID.

  • :analytics_metadata (Types::AnalyticsMetadataType)

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

  • :user_context_data (Types::UserContextDataType)

    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.

Returns:

See Also:



7145
7146
7147
7148
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 7145

def initiate_auth(params = {}, options = {})
  req = build_request(:initiate_auth, params)
  req.send_request(options)
end

#list_devices(params = {}) ⇒ Types::ListDevicesResponse

Lists the sign-in devices that Amazon Cognito has registered to the current user. For more information about device authentication, see Working with user devices in your user pool.

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

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

Examples:

Request syntax with placeholder values


resp = client.list_devices({
  access_token: "TokenModelType", # required
  limit: 1,
  pagination_token: "SearchPaginationTokenType",
})

Response structure


resp.devices #=> Array
resp.devices[0].device_key #=> String
resp.devices[0].device_attributes #=> Array
resp.devices[0].device_attributes[0].name #=> String
resp.devices[0].device_attributes[0].value #=> String
resp.devices[0].device_create_date #=> Time
resp.devices[0].device_last_modified_date #=> Time
resp.devices[0].device_last_authenticated_date #=> Time
resp.pagination_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :access_token (required, 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.

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

Returns:

See Also:



7215
7216
7217
7218
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 7215

def list_devices(params = {}, options = {})
  req = build_request(:list_devices, params)
  req.send_request(options)
end

#list_groups(params = {}) ⇒ Types::ListGroupsResponse

Lists the groups associated with a user pool.

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

Learn more

The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.

Examples:

Request syntax with placeholder values


resp = client.list_groups({
  user_pool_id: "UserPoolIdType", # required
  limit: 1,
  next_token: "PaginationKey",
})

Response structure


resp.groups #=> Array
resp.groups[0].group_name #=> String
resp.groups[0].user_pool_id #=> String
resp.groups[0].description #=> String
resp.groups[0].role_arn #=> String
resp.groups[0].precedence #=> Integer
resp.groups[0].last_modified_date #=> Time
resp.groups[0].creation_date #=> Time
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

    The user pool ID for the user pool.

  • :limit (Integer)

    The limit of the request to list groups.

  • :next_token (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:

See Also:



7282
7283
7284
7285
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 7282

def list_groups(params = {}, options = {})
  req = build_request(:list_groups, params)
  req.send_request(options)
end

#list_identity_providers(params = {}) ⇒ Types::ListIdentityProvidersResponse

Lists information about all IdPs for a user pool.

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

Learn more

The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.

Examples:

Request syntax with placeholder values


resp = client.list_identity_providers({
  user_pool_id: "UserPoolIdType", # required
  max_results: 1,
  next_token: "PaginationKeyType",
})

Response structure


resp.providers #=> Array
resp.providers[0].provider_name #=> String
resp.providers[0].provider_type #=> String, one of "SAML", "Facebook", "Google", "LoginWithAmazon", "SignInWithApple", "OIDC"
resp.providers[0].last_modified_date #=> Time
resp.providers[0].creation_date #=> Time
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

    The user pool ID.

  • :max_results (Integer)

    The maximum number of IdPs to return.

  • :next_token (String)

    A pagination token.

Returns:

See Also:



7344
7345
7346
7347
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 7344

def list_identity_providers(params = {}, options = {})
  req = build_request(:list_identity_providers, params)
  req.send_request(options)
end

#list_resource_servers(params = {}) ⇒ Types::ListResourceServersResponse

Lists the resource servers for a user pool.

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

Learn more

The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.

Examples:

Request syntax with placeholder values


resp = client.list_resource_servers({
  user_pool_id: "UserPoolIdType", # required
  max_results: 1,
  next_token: "PaginationKeyType",
})

Response structure


resp.resource_servers #=> Array
resp.resource_servers[0].user_pool_id #=> String
resp.resource_servers[0].identifier #=> String
resp.resource_servers[0].name #=> String
resp.resource_servers[0].scopes #=> Array
resp.resource_servers[0].scopes[0].scope_name #=> String
resp.resource_servers[0].scopes[0].scope_description #=> String
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

    The user pool ID for the user pool.

  • :max_results (Integer)

    The maximum number of resource servers to return.

  • :next_token (String)

    A pagination token.

Returns:

See Also:



7408
7409
7410
7411
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 7408

def list_resource_servers(params = {}, options = {})
  req = build_request(:list_resource_servers, params)
  req.send_request(options)
end

#list_tags_for_resource(params = {}) ⇒ Types::ListTagsForResourceResponse

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.

Examples:

Request syntax with placeholder values


resp = client.list_tags_for_resource({
  resource_arn: "ArnType", # required
})

Response structure


resp.tags #=> Hash
resp.tags["TagKeysType"] #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :resource_arn (required, String)

    The Amazon Resource Name (ARN) of the user pool that the tags are assigned to.

Returns:

See Also:



7444
7445
7446
7447
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 7444

def list_tags_for_resource(params = {}, options = {})
  req = build_request(:list_tags_for_resource, params)
  req.send_request(options)
end

#list_user_import_jobs(params = {}) ⇒ Types::ListUserImportJobsResponse

Lists user import jobs for a user pool.

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

Learn more

Examples:

Request syntax with placeholder values


resp = client.list_user_import_jobs({
  user_pool_id: "UserPoolIdType", # required
  max_results: 1, # required
  pagination_token: "PaginationKeyType",
})

Response structure


resp.user_import_jobs #=> Array
resp.user_import_jobs[0].job_name #=> String
resp.user_import_jobs[0].job_id #=> String
resp.user_import_jobs[0].user_pool_id #=> String
resp.user_import_jobs[0].pre_signed_url #=> String
resp.user_import_jobs[0].creation_date #=> Time
resp.user_import_jobs[0].start_date #=> Time
resp.user_import_jobs[0].completion_date #=> Time
resp.user_import_jobs[0].status #=> String, one of "Created", "Pending", "InProgress", "Stopping", "Expired", "Stopped", "Failed", "Succeeded"
resp.user_import_jobs[0].cloud_watch_logs_role_arn #=> String
resp.user_import_jobs[0].imported_users #=> Integer
resp.user_import_jobs[0].skipped_users #=> Integer
resp.user_import_jobs[0].failed_users #=> Integer
resp.user_import_jobs[0].completion_message #=> String
resp.pagination_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

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

  • :max_results (required, Integer)

    The maximum number of import jobs you want the request to return.

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

Returns:

See Also:



7519
7520
7521
7522
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 7519

def list_user_import_jobs(params = {}, options = {})
  req = build_request(:list_user_import_jobs, params)
  req.send_request(options)
end

#list_user_pool_clients(params = {}) ⇒ Types::ListUserPoolClientsResponse

Lists the clients that have been created for the specified user pool.

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

Learn more

The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.

Examples:

Request syntax with placeholder values


resp = client.list_user_pool_clients({
  user_pool_id: "UserPoolIdType", # required
  max_results: 1,
  next_token: "PaginationKey",
})

Response structure


resp.user_pool_clients #=> Array
resp.user_pool_clients[0].client_id #=> String
resp.user_pool_clients[0].user_pool_id #=> String
resp.user_pool_clients[0].client_name #=> String
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

    The user pool ID for the user pool where you want to list user pool clients.

  • :max_results (Integer)

    The maximum number of results you want the request to return when listing the user pool clients.

  • :next_token (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:

See Also:



7584
7585
7586
7587
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 7584

def list_user_pool_clients(params = {}, options = {})
  req = build_request(:list_user_pool_clients, params)
  req.send_request(options)
end

#list_user_pools(params = {}) ⇒ Types::ListUserPoolsResponse

Lists the user pools associated with an Amazon Web Services account.

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

Learn more

The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.

Examples:

Request syntax with placeholder values


resp = client.list_user_pools({
  next_token: "PaginationKeyType",
  max_results: 1, # required
})

Response structure


resp.user_pools #=> Array
resp.user_pools[0].id #=> String
resp.user_pools[0].name #=> String
resp.user_pools[0].lambda_config. #=> String
resp.user_pools[0].lambda_config.custom_message #=> String
resp.user_pools[0].lambda_config.post_confirmation #=> String
resp.user_pools[0].lambda_config.pre_authentication #=> String
resp.user_pools[0].lambda_config.post_authentication #=> String
resp.user_pools[0].lambda_config.define_auth_challenge #=> String
resp.user_pools[0].lambda_config.create_auth_challenge #=> String
resp.user_pools[0].lambda_config.verify_auth_challenge_response #=> String
resp.user_pools[0].lambda_config.pre_token_generation #=> String
resp.user_pools[0].lambda_config.user_migration #=> String
resp.user_pools[0].lambda_config.pre_token_generation_config.lambda_version #=> String, one of "V1_0", "V2_0"
resp.user_pools[0].lambda_config.pre_token_generation_config.lambda_arn #=> String
resp.user_pools[0].lambda_config.custom_sms_sender.lambda_version #=> String, one of "V1_0"
resp.user_pools[0].lambda_config.custom_sms_sender.lambda_arn #=> String
resp.user_pools[0].lambda_config.custom_email_sender.lambda_version #=> String, one of "V1_0"
resp.user_pools[0].lambda_config.custom_email_sender.lambda_arn #=> String
resp.user_pools[0].lambda_config.kms_key_id #=> String
resp.user_pools[0].status #=> String, one of "Enabled", "Disabled"
resp.user_pools[0].last_modified_date #=> Time
resp.user_pools[0].creation_date #=> Time
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

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

  • :max_results (required, Integer)

    The maximum number of results you want the request to return when listing the user pools.

Returns:

See Also:



7663
7664
7665
7666
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 7663

def list_user_pools(params = {}, options = {})
  req = build_request(:list_user_pools, params)
  req.send_request(options)
end

#list_users(params = {}) ⇒ Types::ListUsersResponse

Lists users and their basic details in a user pool.

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

Learn more

The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.

Examples:

Example: 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.

resp = client.list_users({
  attributes_to_get: [
    "email", 
    "sub", 
  ], 
  filter: "\"email\"^=\"testuser\"", 
  limit: 3, 
  pagination_token: "abcd1234EXAMPLE", 
  user_pool_id: "us-east-1_EXAMPLE", 
})

resp.to_h outputs the following:
{
  pagination_token: "efgh5678EXAMPLE", 
  users: [
    {
      attributes: [
        {
          name: "sub", 
          value: "eaad0219-2117-439f-8d46-4db20e59268f", 
        }, 
        {
          name: "email", 
          value: "testuser@example.com", 
        }, 
      ], 
      enabled: true, 
      user_create_date: Time.parse(1682955829.578), 
      user_last_modified_date: Time.parse(1689030181.63), 
      user_status: "CONFIRMED", 
      username: "testuser", 
    }, 
    {
      attributes: [
        {
          name: "sub", 
          value: "3b994cfd-0b07-4581-be46-3c82f9a70c90", 
        }, 
        {
          name: "email", 
          value: "testuser2@example.com", 
        }, 
      ], 
      enabled: true, 
      user_create_date: Time.parse(1684427979.201), 
      user_last_modified_date: Time.parse(1684427979.201), 
      user_status: "UNCONFIRMED", 
      username: "testuser2", 
    }, 
    {
      attributes: [
        {
          name: "sub", 
          value: "5929e0d1-4c34-42d1-9b79-a5ecacfe66f7", 
        }, 
        {
          name: "email", 
          value: "testuser3@example.com", 
        }, 
      ], 
      enabled: true, 
      user_create_date: Time.parse(1684427823.641), 
      user_last_modified_date: Time.parse(1684427823.641), 
      user_status: "UNCONFIRMED", 
      username: "testuser3@example.com", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.list_users({
  user_pool_id: "UserPoolIdType", # required
  attributes_to_get: ["AttributeNameType"],
  limit: 1,
  pagination_token: "SearchPaginationTokenType",
  filter: "UserFilterType",
})

Response structure


resp.users #=> Array
resp.users[0].username #=> String
resp.users[0].attributes #=> Array
resp.users[0].attributes[0].name #=> String
resp.users[0].attributes[0].value #=> String
resp.users[0].user_create_date #=> Time
resp.users[0].user_last_modified_date #=> Time
resp.users[0].enabled #=> Boolean
resp.users[0].user_status #=> String, one of "UNCONFIRMED", "CONFIRMED", "ARCHIVED", "COMPROMISED", "UNKNOWN", "RESET_REQUIRED", "FORCE_CHANGE_PASSWORD"
resp.users[0].mfa_options #=> Array
resp.users[0].mfa_options[0].delivery_medium #=> String, one of "SMS", "EMAIL"
resp.users[0].mfa_options[0].attribute_name #=> String
resp.pagination_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

    The user pool ID for the user pool on which the search should be performed.

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

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

    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.

Returns:

See Also:



7897
7898
7899
7900
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 7897

def list_users(params = {}, options = {})
  req = build_request(:list_users, params)
  req.send_request(options)
end

#list_users_in_group(params = {}) ⇒ Types::ListUsersInGroupResponse

Lists the users in the specified group.

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

Learn more

The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.

Examples:

Request syntax with placeholder values


resp = client.list_users_in_group({
  user_pool_id: "UserPoolIdType", # required
  group_name: "GroupNameType", # required
  limit: 1,
  next_token: "PaginationKey",
})

Response structure


resp.users #=> Array
resp.users[0].username #=> String
resp.users[0].attributes #=> Array
resp.users[0].attributes[0].name #=> String
resp.users[0].attributes[0].value #=> String
resp.users[0].user_create_date #=> Time
resp.users[0].user_last_modified_date #=> Time
resp.users[0].enabled #=> Boolean
resp.users[0].user_status #=> String, one of "UNCONFIRMED", "CONFIRMED", "ARCHIVED", "COMPROMISED", "UNKNOWN", "RESET_REQUIRED", "FORCE_CHANGE_PASSWORD"
resp.users[0].mfa_options #=> Array
resp.users[0].mfa_options[0].delivery_medium #=> String, one of "SMS", "EMAIL"
resp.users[0].mfa_options[0].attribute_name #=> String
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

    The user pool ID for the user pool.

  • :group_name (required, String)

    The name of the group.

  • :limit (Integer)

    The maximum number of users that you want to retrieve before pagination.

  • :next_token (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:

See Also:



7973
7974
7975
7976
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 7973

def list_users_in_group(params = {}, options = {})
  req = build_request(:list_users_in_group, params)
  req.send_request(options)
end

#resend_confirmation_code(params = {}) ⇒ Types::ResendConfirmationCodeResponse

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

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

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

If you have never used SMS text messages with Amazon Cognito or any other Amazon Web 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:

Request syntax with placeholder values


resp = client.resend_confirmation_code({
  client_id: "ClientIdType", # required
  secret_hash: "SecretHashType",
  user_context_data: {
    ip_address: "StringType",
    encoded_data: "StringType",
  },
  username: "UsernameType", # required
  analytics_metadata: {
    analytics_endpoint_id: "StringType",
  },
  client_metadata: {
    "StringType" => "StringType",
  },
})

Response structure


resp.code_delivery_details.destination #=> String
resp.code_delivery_details.delivery_medium #=> String, one of "SMS", "EMAIL"
resp.code_delivery_details.attribute_name #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :client_id (required, String)

    The ID of the client associated with the user pool.

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

  • :user_context_data (Types::UserContextDataType)

    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.

  • :username (required, 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.

  • :analytics_metadata (Types::AnalyticsMetadataType)

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

  • :client_metadata (Hash<String,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.

    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.

Returns:

See Also:



8112
8113
8114
8115
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 8112

def resend_confirmation_code(params = {}, options = {})
  req = build_request(:resend_confirmation_code, params)
  req.send_request(options)
end

#respond_to_auth_challenge(params = {}) ⇒ Types::RespondToAuthChallengeResponse

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

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

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

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

If you have never used SMS text messages with Amazon Cognito or any other Amazon Web 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:

Request syntax with placeholder values


resp = client.respond_to_auth_challenge({
  client_id: "ClientIdType", # required
  challenge_name: "SMS_MFA", # required, accepts 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: "SessionType",
  challenge_responses: {
    "StringType" => "StringType",
  },
  analytics_metadata: {
    analytics_endpoint_id: "StringType",
  },
  user_context_data: {
    ip_address: "StringType",
    encoded_data: "StringType",
  },
  client_metadata: {
    "StringType" => "StringType",
  },
})

Response structure


resp.challenge_name #=> String, one of "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"
resp.session #=> String
resp.challenge_parameters #=> Hash
resp.challenge_parameters["StringType"] #=> String
resp.authentication_result.access_token #=> String
resp.authentication_result.expires_in #=> Integer
resp.authentication_result.token_type #=> String
resp.authentication_result.refresh_token #=> String
resp.authentication_result.id_token #=> String
resp.authentication_result..device_key #=> String
resp.authentication_result..device_group_key #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :client_id (required, String)

    The app client ID.

  • :challenge_name (required, String)

    The challenge name. For more information, see InitiateAuth.

    ADMIN_NO_SRP_AUTH isn't a valid value.

  • :session (String)

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

  • :challenge_responses (Hash<String,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.

    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.

  • :analytics_metadata (Types::AnalyticsMetadataType)

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

  • :user_context_data (Types::UserContextDataType)

    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.

  • :client_metadata (Hash<String,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.

    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.

Returns:

See Also:



8369
8370
8371
8372
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 8369

def respond_to_auth_challenge(params = {}, options = {})
  req = build_request(:respond_to_auth_challenge, params)
  req.send_request(options)
end

#revoke_token(params = {}) ⇒ Struct

Revokes all of the access tokens generated by, and at the same time as, the specified refresh token. After a token is revoked, you can't use the revoked token to access Amazon Cognito user APIs, or to authorize access to your resource server.

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

Examples:

Request syntax with placeholder values


resp = client.revoke_token({
  token: "TokenModelType", # required
  client_id: "ClientIdType", # required
  client_secret: "ClientSecretType",
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :token (required, String)

    The refresh token that you want to revoke.

  • :client_id (required, String)

    The client ID for the token that you want to revoke.

  • :client_secret (String)

    The secret for the client ID. This is required only if the client ID has a secret.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



8416
8417
8418
8419
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 8416

def revoke_token(params = {}, options = {})
  req = build_request(:revoke_token, params)
  req.send_request(options)
end

#set_log_delivery_configuration(params = {}) ⇒ Types::SetLogDeliveryConfigurationResponse

Sets up or modifies the detailed activity logging configuration of a user pool.

Examples:

Request syntax with placeholder values


resp = client.set_log_delivery_configuration({
  user_pool_id: "UserPoolIdType", # required
  log_configurations: [ # required
    {
      log_level: "ERROR", # required, accepts ERROR
      event_source: "userNotification", # required, accepts userNotification
      cloud_watch_logs_configuration: {
        log_group_arn: "ArnType",
      },
    },
  ],
})

Response structure


resp.log_delivery_configuration.user_pool_id #=> String
resp.log_delivery_configuration.log_configurations #=> Array
resp.log_delivery_configuration.log_configurations[0].log_level #=> String, one of "ERROR"
resp.log_delivery_configuration.log_configurations[0].event_source #=> String, one of "userNotification"
resp.log_delivery_configuration.log_configurations[0].cloud_watch_logs_configuration.log_group_arn #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

    The ID of the user pool where you want to configure detailed activity logging .

  • :log_configurations (required, Array<Types::LogConfigurationType>)

    A collection of all of the detailed activity logging configurations for a user pool.

Returns:

See Also:



8463
8464
8465
8466
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 8463

def set_log_delivery_configuration(params = {}, options = {})
  req = build_request(:set_log_delivery_configuration, params)
  req.send_request(options)
end

#set_risk_configuration(params = {}) ⇒ Types::SetRiskConfigurationResponse

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.

Examples:

Request syntax with placeholder values


resp = client.set_risk_configuration({
  user_pool_id: "UserPoolIdType", # required
  client_id: "ClientIdType",
  compromised_credentials_risk_configuration: {
    event_filter: ["SIGN_IN"], # accepts SIGN_IN, PASSWORD_CHANGE, SIGN_UP
    actions: { # required
      event_action: "BLOCK", # required, accepts BLOCK, NO_ACTION
    },
  },
  account_takeover_risk_configuration: {
    notify_configuration: {
      from: "StringType",
      reply_to: "StringType",
      source_arn: "ArnType", # required
      block_email: {
        subject: "EmailNotificationSubjectType", # required
        html_body: "EmailNotificationBodyType",
        text_body: "EmailNotificationBodyType",
      },
      no_action_email: {
        subject: "EmailNotificationSubjectType", # required
        html_body: "EmailNotificationBodyType",
        text_body: "EmailNotificationBodyType",
      },
      mfa_email: {
        subject: "EmailNotificationSubjectType", # required
        html_body: "EmailNotificationBodyType",
        text_body: "EmailNotificationBodyType",
      },
    },
    actions: { # required
      low_action: {
        notify: false, # required
        event_action: "BLOCK", # required, accepts BLOCK, MFA_IF_CONFIGURED, MFA_REQUIRED, NO_ACTION
      },
      medium_action: {
        notify: false, # required
        event_action: "BLOCK", # required, accepts BLOCK, MFA_IF_CONFIGURED, MFA_REQUIRED, NO_ACTION
      },
      high_action: {
        notify: false, # required
        event_action: "BLOCK", # required, accepts BLOCK, MFA_IF_CONFIGURED, MFA_REQUIRED, NO_ACTION
      },
    },
  },
  risk_exception_configuration: {
    blocked_ip_range_list: ["StringType"],
    skipped_ip_range_list: ["StringType"],
  },
})

Response structure


resp.risk_configuration.user_pool_id #=> String
resp.risk_configuration.client_id #=> String
resp.risk_configuration.compromised_credentials_risk_configuration.event_filter #=> Array
resp.risk_configuration.compromised_credentials_risk_configuration.event_filter[0] #=> String, one of "SIGN_IN", "PASSWORD_CHANGE", "SIGN_UP"
resp.risk_configuration.compromised_credentials_risk_configuration.actions.event_action #=> String, one of "BLOCK", "NO_ACTION"
resp.risk_configuration..notify_configuration.from #=> String
resp.risk_configuration..notify_configuration.reply_to #=> String
resp.risk_configuration..notify_configuration.source_arn #=> String
resp.risk_configuration..notify_configuration.block_email.subject #=> String
resp.risk_configuration..notify_configuration.block_email.html_body #=> String
resp.risk_configuration..notify_configuration.block_email.text_body #=> String
resp.risk_configuration..notify_configuration.no_action_email.subject #=> String
resp.risk_configuration..notify_configuration.no_action_email.html_body #=> String
resp.risk_configuration..notify_configuration.no_action_email.text_body #=> String
resp.risk_configuration..notify_configuration.mfa_email.subject #=> String
resp.risk_configuration..notify_configuration.mfa_email.html_body #=> String
resp.risk_configuration..notify_configuration.mfa_email.text_body #=> String
resp.risk_configuration..actions.low_action.notify #=> Boolean
resp.risk_configuration..actions.low_action.event_action #=> String, one of "BLOCK", "MFA_IF_CONFIGURED", "MFA_REQUIRED", "NO_ACTION"
resp.risk_configuration..actions.medium_action.notify #=> Boolean
resp.risk_configuration..actions.medium_action.event_action #=> String, one of "BLOCK", "MFA_IF_CONFIGURED", "MFA_REQUIRED", "NO_ACTION"
resp.risk_configuration..actions.high_action.notify #=> Boolean
resp.risk_configuration..actions.high_action.event_action #=> String, one of "BLOCK", "MFA_IF_CONFIGURED", "MFA_REQUIRED", "NO_ACTION"
resp.risk_configuration.risk_exception_configuration.blocked_ip_range_list #=> Array
resp.risk_configuration.risk_exception_configuration.blocked_ip_range_list[0] #=> String
resp.risk_configuration.risk_exception_configuration.skipped_ip_range_list #=> Array
resp.risk_configuration.risk_exception_configuration.skipped_ip_range_list[0] #=> String
resp.risk_configuration.last_modified_date #=> Time

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

    The user pool ID.

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

  • :compromised_credentials_risk_configuration (Types::CompromisedCredentialsRiskConfigurationType)

    The compromised credentials risk configuration.

  • :account_takeover_risk_configuration (Types::AccountTakeoverRiskConfigurationType)

    The account takeover risk configuration.

  • :risk_exception_configuration (Types::RiskExceptionConfigurationType)

    The configuration to override the risk decision.

Returns:

See Also:



8588
8589
8590
8591
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 8588

def set_risk_configuration(params = {}, options = {})
  req = build_request(:set_risk_configuration, params)
  req.send_request(options)
end

#set_ui_customization(params = {}) ⇒ Types::SetUICustomizationResponse

Sets the user interface (UI) customization information for a user pool's built-in app UI.

You can specify app UI customization settings for a single client (with a specific clientId) or for all clients (by setting the clientId to ALL). If you specify ALL, the default configuration is used for every client that has no previously set UI customization. If you specify UI customization settings for a particular client, it will no longer return to the ALL configuration.

To use this API, your user pool must have a domain associated with it. Otherwise, there is no place to host the app's pages, and the service will throw an error.

Examples:

Request syntax with placeholder values


resp = client.set_ui_customization({
  user_pool_id: "UserPoolIdType", # required
  client_id: "ClientIdType",
  css: "CSSType",
  image_file: "data",
})

Response structure


resp.ui_customization.user_pool_id #=> String
resp.ui_customization.client_id #=> String
resp.ui_customization.image_url #=> String
resp.ui_customization.css #=> String
resp.ui_customization.css_version #=> String
resp.ui_customization.last_modified_date #=> Time
resp.ui_customization.creation_date #=> Time

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

    The user pool ID for the user pool.

  • :client_id (String)

    The client ID for the client app.

  • :css (String)

    The CSS values in the UI customization.

  • :image_file (String, StringIO, File)

    The uploaded logo image for the UI customization.

Returns:

See Also:



8648
8649
8650
8651
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 8648

def set_ui_customization(params = {}, options = {})
  req = build_request(:set_ui_customization, params)
  req.send_request(options)
end

#set_user_mfa_preference(params = {}) ⇒ Struct

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.

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.

Examples:

Request syntax with placeholder values


resp = client.set_user_mfa_preference({
  sms_mfa_settings: {
    enabled: false,
    preferred_mfa: false,
  },
  software_token_mfa_settings: {
    enabled: false,
    preferred_mfa: false,
  },
  access_token: "TokenModelType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :sms_mfa_settings (Types::SMSMfaSettingsType)

    The SMS text message multi-factor authentication (MFA) settings.

  • :software_token_mfa_settings (Types::SoftwareTokenMfaSettingsType)

    The time-based one-time password (TOTP) software token MFA settings.

  • :access_token (required, String)

    A valid access token that Amazon Cognito issued to the user whose MFA preference you want to set.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



8711
8712
8713
8714
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 8711

def set_user_mfa_preference(params = {}, options = {})
  req = build_request(:set_user_mfa_preference, params)
  req.send_request(options)
end

#set_user_pool_mfa_config(params = {}) ⇒ Types::SetUserPoolMfaConfigResponse

Sets the user pool multi-factor authentication (MFA) configuration.

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

If you have never used SMS text messages with Amazon Cognito or any other Amazon Web 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:

Request syntax with placeholder values


resp = client.set_user_pool_mfa_config({
  user_pool_id: "UserPoolIdType", # required
  sms_mfa_configuration: {
    sms_authentication_message: "SmsVerificationMessageType",
    sms_configuration: {
      sns_caller_arn: "ArnType", # required
      external_id: "StringType",
      sns_region: "RegionCodeType",
    },
  },
  software_token_mfa_configuration: {
    enabled: false,
  },
  mfa_configuration: "OFF", # accepts OFF, ON, OPTIONAL
})

Response structure


resp.sms_mfa_configuration.sms_authentication_message #=> String
resp.sms_mfa_configuration.sms_configuration.sns_caller_arn #=> String
resp.sms_mfa_configuration.sms_configuration.external_id #=> String
resp.sms_mfa_configuration.sms_configuration.sns_region #=> String
resp.software_token_mfa_configuration.enabled #=> Boolean
resp.mfa_configuration #=> String, one of "OFF", "ON", "OPTIONAL"

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

    The user pool ID.

  • :sms_mfa_configuration (Types::SmsMfaConfigType)

    The SMS text message MFA configuration.

  • :software_token_mfa_configuration (Types::SoftwareTokenMfaConfigType)

    The software token MFA configuration.

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

Returns:

See Also:



8807
8808
8809
8810
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 8807

def set_user_pool_mfa_config(params = {}, options = {})
  req = build_request(:set_user_pool_mfa_config, params)
  req.send_request(options)
end

#set_user_settings(params = {}) ⇒ Struct

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

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

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

Examples:

Request syntax with placeholder values


resp = client.({
  access_token: "TokenModelType", # required
  mfa_options: [ # required
    {
      delivery_medium: "SMS", # accepts SMS, EMAIL
      attribute_name: "AttributeNameType",
    },
  ],
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :access_token (required, String)

    A valid access token that Amazon Cognito issued to the user whose user settings you want to configure.

  • :mfa_options (required, Array<Types::MFAOptionType>)

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

Returns:

  • (Struct)

    Returns an empty response.

See Also:



8860
8861
8862
8863
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 8860

def (params = {}, options = {})
  req = build_request(:set_user_settings, params)
  req.send_request(options)
end

#sign_up(params = {}) ⇒ Types::SignUpResponse

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

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

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

If you have never used SMS text messages with Amazon Cognito or any other Amazon Web 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:

Request syntax with placeholder values


resp = client.({
  client_id: "ClientIdType", # required
  secret_hash: "SecretHashType",
  username: "UsernameType", # required
  password: "PasswordType", # required
  user_attributes: [
    {
      name: "AttributeNameType", # required
      value: "AttributeValueType",
    },
  ],
  validation_data: [
    {
      name: "AttributeNameType", # required
      value: "AttributeValueType",
    },
  ],
  analytics_metadata: {
    analytics_endpoint_id: "StringType",
  },
  user_context_data: {
    ip_address: "StringType",
    encoded_data: "StringType",
  },
  client_metadata: {
    "StringType" => "StringType",
  },
})

Response structure


resp.user_confirmed #=> Boolean
resp.code_delivery_details.destination #=> String
resp.code_delivery_details.delivery_medium #=> String, one of "SMS", "EMAIL"
resp.code_delivery_details.attribute_name #=> String
resp.user_sub #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :client_id (required, String)

    The ID of the client associated with the user pool.

  • :secret_hash (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 (required, 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 (required, String)

    The password of the user you want to register.

  • :user_attributes (Array<Types::AttributeType>)

    An array of name-value pairs representing user attributes.

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

  • :validation_data (Array<Types::AttributeType>)

    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.

  • :analytics_metadata (Types::AnalyticsMetadataType)

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

  • :user_context_data (Types::UserContextDataType)

    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.

  • :client_metadata (Hash<String,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.

    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.

Returns:

See Also:



9043
9044
9045
9046
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 9043

def (params = {}, options = {})
  req = build_request(:sign_up, params)
  req.send_request(options)
end

#start_user_import_job(params = {}) ⇒ Types::StartUserImportJobResponse

Starts the user import.

Examples:

Request syntax with placeholder values


resp = client.start_user_import_job({
  user_pool_id: "UserPoolIdType", # required
  job_id: "UserImportJobIdType", # required
})

Response structure


resp.user_import_job.job_name #=> String
resp.user_import_job.job_id #=> String
resp.user_import_job.user_pool_id #=> String
resp.user_import_job.pre_signed_url #=> String
resp.user_import_job.creation_date #=> Time
resp.user_import_job.start_date #=> Time
resp.user_import_job.completion_date #=> Time
resp.user_import_job.status #=> String, one of "Created", "Pending", "InProgress", "Stopping", "Expired", "Stopped", "Failed", "Succeeded"
resp.user_import_job.cloud_watch_logs_role_arn #=> String
resp.user_import_job.imported_users #=> Integer
resp.user_import_job.skipped_users #=> Integer
resp.user_import_job.failed_users #=> Integer
resp.user_import_job.completion_message #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

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

  • :job_id (required, String)

    The job ID for the user import job.

Returns:

See Also:



9088
9089
9090
9091
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 9088

def start_user_import_job(params = {}, options = {})
  req = build_request(:start_user_import_job, params)
  req.send_request(options)
end

#stop_user_import_job(params = {}) ⇒ Types::StopUserImportJobResponse

Stops the user import job.

Examples:

Request syntax with placeholder values


resp = client.stop_user_import_job({
  user_pool_id: "UserPoolIdType", # required
  job_id: "UserImportJobIdType", # required
})

Response structure


resp.user_import_job.job_name #=> String
resp.user_import_job.job_id #=> String
resp.user_import_job.user_pool_id #=> String
resp.user_import_job.pre_signed_url #=> String
resp.user_import_job.creation_date #=> Time
resp.user_import_job.start_date #=> Time
resp.user_import_job.completion_date #=> Time
resp.user_import_job.status #=> String, one of "Created", "Pending", "InProgress", "Stopping", "Expired", "Stopped", "Failed", "Succeeded"
resp.user_import_job.cloud_watch_logs_role_arn #=> String
resp.user_import_job.imported_users #=> Integer
resp.user_import_job.skipped_users #=> Integer
resp.user_import_job.failed_users #=> Integer
resp.user_import_job.completion_message #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

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

  • :job_id (required, String)

    The job ID for the user import job.

Returns:

See Also:



9133
9134
9135
9136
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 9133

def stop_user_import_job(params = {}, options = {})
  req = build_request(:stop_user_import_job, params)
  req.send_request(options)
end

#tag_resource(params = {}) ⇒ Struct

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.

Examples:

Request syntax with placeholder values


resp = client.tag_resource({
  resource_arn: "ArnType", # required
  tags: { # required
    "TagKeysType" => "TagValueType",
  },
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :resource_arn (required, String)

    The Amazon Resource Name (ARN) of the user pool to assign the tags to.

  • :tags (required, Hash<String,String>)

    The tags to assign to the user pool.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



9179
9180
9181
9182
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 9179

def tag_resource(params = {}, options = {})
  req = build_request(:tag_resource, params)
  req.send_request(options)
end

#untag_resource(params = {}) ⇒ Struct

Removes the specified tags from an Amazon Cognito user pool. You can use this action up to 5 times per second, per account.

Examples:

Request syntax with placeholder values


resp = client.untag_resource({
  resource_arn: "ArnType", # required
  tag_keys: ["TagKeysType"], # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :resource_arn (required, String)

    The Amazon Resource Name (ARN) of the user pool that the tags are assigned to.

  • :tag_keys (required, Array<String>)

    The keys of the tags to remove from the user pool.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



9207
9208
9209
9210
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 9207

def untag_resource(params = {}, options = {})
  req = build_request(:untag_resource, params)
  req.send_request(options)
end

#update_auth_event_feedback(params = {}) ⇒ Struct

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

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

Examples:

Request syntax with placeholder values


resp = client.update_auth_event_feedback({
  user_pool_id: "UserPoolIdType", # required
  username: "UsernameType", # required
  event_id: "EventIdType", # required
  feedback_token: "TokenModelType", # required
  feedback_value: "Valid", # required, accepts Valid, Invalid
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

    The user pool ID.

  • :username (required, 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.

  • :event_id (required, String)

    The event ID.

  • :feedback_token (required, String)

    The feedback token.

  • :feedback_value (required, 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.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



9270
9271
9272
9273
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 9270

def update_auth_event_feedback(params = {}, options = {})
  req = build_request(:update_auth_event_feedback, params)
  req.send_request(options)
end

#update_device_status(params = {}) ⇒ Struct

Updates the device status. For more information about device authentication, see Working with user devices in your user pool.

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

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

Examples:

Request syntax with placeholder values


resp = client.update_device_status({
  access_token: "TokenModelType", # required
  device_key: "DeviceKeyType", # required
  device_remembered_status: "remembered", # accepts remembered, not_remembered
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :access_token (required, String)

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

  • :device_key (required, String)

    The device key.

  • :device_remembered_status (String)

    The status of whether a device is remembered.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



9319
9320
9321
9322
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 9319

def update_device_status(params = {}, options = {})
  req = build_request(:update_device_status, params)
  req.send_request(options)
end

#update_group(params = {}) ⇒ Types::UpdateGroupResponse

Updates the specified group with the specified attributes.

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

Learn more

Examples:

Request syntax with placeholder values


resp = client.update_group({
  group_name: "GroupNameType", # required
  user_pool_id: "UserPoolIdType", # required
  description: "DescriptionType",
  role_arn: "ArnType",
  precedence: 1,
})

Response structure


resp.group.group_name #=> String
resp.group.user_pool_id #=> String
resp.group.description #=> String
resp.group.role_arn #=> String
resp.group.precedence #=> Integer
resp.group.last_modified_date #=> Time
resp.group.creation_date #=> Time

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :group_name (required, String)

    The name of the group.

  • :user_pool_id (required, String)

    The user pool ID for the user pool.

  • :description (String)

    A string containing the new description of the group.

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

Returns:

See Also:



9394
9395
9396
9397
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 9394

def update_group(params = {}, options = {})
  req = build_request(:update_group, params)
  req.send_request(options)
end

#update_identity_provider(params = {}) ⇒ Types::UpdateIdentityProviderResponse

Updates IdP information for a user pool.

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

Learn more

Examples:

Request syntax with placeholder values


resp = client.update_identity_provider({
  user_pool_id: "UserPoolIdType", # required
  provider_name: "ProviderNameType", # required
  provider_details: {
    "StringType" => "StringType",
  },
  attribute_mapping: {
    "AttributeMappingKeyType" => "StringType",
  },
  idp_identifiers: ["IdpIdentifierType"],
})

Response structure


resp.identity_provider.user_pool_id #=> String
resp.identity_provider.provider_name #=> String
resp.identity_provider.provider_type #=> String, one of "SAML", "Facebook", "Google", "LoginWithAmazon", "SignInWithApple", "OIDC"
resp.identity_provider.provider_details #=> Hash
resp.identity_provider.provider_details["StringType"] #=> String
resp.identity_provider.attribute_mapping #=> Hash
resp.identity_provider.attribute_mapping["AttributeMappingKeyType"] #=> String
resp.identity_provider.idp_identifiers #=> Array
resp.identity_provider.idp_identifiers[0] #=> String
resp.identity_provider.last_modified_date #=> Time
resp.identity_provider.creation_date #=> Time

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

    The user pool ID.

  • :provider_name (required, String)

    The IdP name.

  • :provider_details (Hash<String,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_token" \}

  • :attribute_mapping (Hash<String,String>)

    The IdP attribute mapping to be changed.

  • :idp_identifiers (Array<String>)

    A list of IdP identifiers.

Returns:

See Also:



9586
9587
9588
9589
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 9586

def update_identity_provider(params = {}, options = {})
  req = build_request(:update_identity_provider, params)
  req.send_request(options)
end

#update_resource_server(params = {}) ⇒ Types::UpdateResourceServerResponse

Updates the name and scopes of resource server. All other fields are read-only.

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

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

Learn more

Examples:

Request syntax with placeholder values


resp = client.update_resource_server({
  user_pool_id: "UserPoolIdType", # required
  identifier: "ResourceServerIdentifierType", # required
  name: "ResourceServerNameType", # required
  scopes: [
    {
      scope_name: "ResourceServerScopeNameType", # required
      scope_description: "ResourceServerScopeDescriptionType", # required
    },
  ],
})

Response structure


resp.resource_server.user_pool_id #=> String
resp.resource_server.identifier #=> String
resp.resource_server.name #=> String
resp.resource_server.scopes #=> Array
resp.resource_server.scopes[0].scope_name #=> String
resp.resource_server.scopes[0].scope_description #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

    The user pool ID for the user pool.

  • :identifier (required, String)

    The identifier for the resource server.

  • :name (required, String)

    The name of the resource server.

  • :scopes (Array<Types::ResourceServerScopeType>)

    The scope values to be set for the resource server.

Returns:

See Also:



9658
9659
9660
9661
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 9658

def update_resource_server(params = {}, options = {})
  req = build_request(:update_resource_server, params)
  req.send_request(options)
end

#update_user_attributes(params = {}) ⇒ Types::UpdateUserAttributesResponse

With this operation, your users can update one or more of their attributes with their own credentials. You authorize this API request with the user's access token. To delete an attribute from your user, submit the attribute in your API request with a blank value. Custom attribute values in this request must include the custom: prefix.

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

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

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

If you have never used SMS text messages with Amazon Cognito or any other Amazon Web 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:

Request syntax with placeholder values


resp = client.update_user_attributes({
  user_attributes: [ # required
    {
      name: "AttributeNameType", # required
      value: "AttributeValueType",
    },
  ],
  access_token: "TokenModelType", # required
  client_metadata: {
    "StringType" => "StringType",
  },
})

Response structure


resp.code_delivery_details_list #=> Array
resp.code_delivery_details_list[0].destination #=> String
resp.code_delivery_details_list[0].delivery_medium #=> String, one of "SMS", "EMAIL"
resp.code_delivery_details_list[0].attribute_name #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_attributes (required, Array<Types::AttributeType>)

    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.

  • :access_token (required, String)

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

  • :client_metadata (Hash<String,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.

    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.

Returns:

See Also:



9791
9792
9793
9794
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 9791

def update_user_attributes(params = {}, options = {})
  req = build_request(:update_user_attributes, params)
  req.send_request(options)
end

#update_user_pool(params = {}) ⇒ Struct

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

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

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

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

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

Learn more

Examples:

Request syntax with placeholder values


resp = client.update_user_pool({
  user_pool_id: "UserPoolIdType", # required
  policies: {
    password_policy: {
      minimum_length: 1,
      require_uppercase: false,
      require_lowercase: false,
      require_numbers: false,
      require_symbols: false,
      temporary_password_validity_days: 1,
    },
  },
  deletion_protection: "ACTIVE", # accepts ACTIVE, INACTIVE
  lambda_config: {
    pre_sign_up: "ArnType",
    custom_message: "ArnType",
    post_confirmation: "ArnType",
    pre_authentication: "ArnType",
    post_authentication: "ArnType",
    define_auth_challenge: "ArnType",
    create_auth_challenge: "ArnType",
    verify_auth_challenge_response: "ArnType",
    pre_token_generation: "ArnType",
    user_migration: "ArnType",
    pre_token_generation_config: {
      lambda_version: "V1_0", # required, accepts V1_0, V2_0
      lambda_arn: "ArnType", # required
    },
    custom_sms_sender: {
      lambda_version: "V1_0", # required, accepts V1_0
      lambda_arn: "ArnType", # required
    },
    custom_email_sender: {
      lambda_version: "V1_0", # required, accepts V1_0
      lambda_arn: "ArnType", # required
    },
    kms_key_id: "ArnType",
  },
  auto_verified_attributes: ["phone_number"], # accepts phone_number, email
  sms_verification_message: "SmsVerificationMessageType",
  email_verification_message: "EmailVerificationMessageType",
  email_verification_subject: "EmailVerificationSubjectType",
  verification_message_template: {
    sms_message: "SmsVerificationMessageType",
    email_message: "EmailVerificationMessageType",
    email_subject: "EmailVerificationSubjectType",
    email_message_by_link: "EmailVerificationMessageByLinkType",
    email_subject_by_link: "EmailVerificationSubjectByLinkType",
    default_email_option: "CONFIRM_WITH_LINK", # accepts CONFIRM_WITH_LINK, CONFIRM_WITH_CODE
  },
  sms_authentication_message: "SmsVerificationMessageType",
  user_attribute_update_settings: {
    attributes_require_verification_before_update: ["phone_number"], # accepts phone_number, email
  },
  mfa_configuration: "OFF", # accepts OFF, ON, OPTIONAL
  device_configuration: {
    challenge_required_on_new_device: false,
    device_only_remembered_on_user_prompt: false,
  },
  email_configuration: {
    source_arn: "ArnType",
    reply_to_email_address: "EmailAddressType",
    email_sending_account: "COGNITO_DEFAULT", # accepts COGNITO_DEFAULT, DEVELOPER
    from: "StringType",
    configuration_set: "SESConfigurationSet",
  },
  sms_configuration: {
    sns_caller_arn: "ArnType", # required
    external_id: "StringType",
    sns_region: "RegionCodeType",
  },
  user_pool_tags: {
    "TagKeysType" => "TagValueType",
  },
  admin_create_user_config: {
    allow_admin_create_user_only: false,
    unused_account_validity_days: 1,
    invite_message_template: {
      sms_message: "SmsVerificationMessageType",
      email_message: "EmailVerificationMessageType",
      email_subject: "EmailVerificationSubjectType",
    },
  },
  user_pool_add_ons: {
    advanced_security_mode: "OFF", # required, accepts OFF, AUDIT, ENFORCED
  },
  account_recovery_setting: {
    recovery_mechanisms: [
      {
        priority: 1, # required
        name: "verified_email", # required, accepts verified_email, verified_phone_number, admin_only
      },
    ],
  },
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

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

  • :policies (Types::UserPoolPolicyType)

    A container with the policies you want to update in a user pool.

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

  • :lambda_config (Types::LambdaConfigType)

    The Lambda configuration information from the request to update the user pool.

  • :auto_verified_attributes (Array<String>)

    The attributes that are automatically verified when Amazon Cognito requests to update user pools.

  • :sms_verification_message (String)

    This parameter is no longer used. See VerificationMessageTemplateType.

  • :email_verification_message (String)

    This parameter is no longer used. See VerificationMessageTemplateType.

  • :email_verification_subject (String)

    This parameter is no longer used. See VerificationMessageTemplateType.

  • :verification_message_template (Types::VerificationMessageTemplateType)

    The template for verification messages.

  • :sms_authentication_message (String)

    The contents of the SMS authentication message.

  • :user_attribute_update_settings (Types::UserAttributeUpdateSettingsType)

    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.

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

  • :device_configuration (Types::DeviceConfigurationType)

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

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

  • :email_configuration (Types::EmailConfigurationType)

    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.

  • :sms_configuration (Types::SmsConfigurationType)

    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.

  • :user_pool_tags (Hash<String,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.

  • :admin_create_user_config (Types::AdminCreateUserConfigType)

    The configuration for AdminCreateUser requests.

  • :user_pool_add_ons (Types::UserPoolAddOnsType)

    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.

  • :account_recovery_setting (Types::AccountRecoverySettingType)

    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.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



10089
10090
10091
10092
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 10089

def update_user_pool(params = {}, options = {})
  req = build_request(:update_user_pool, params)
  req.send_request(options)
end

#update_user_pool_client(params = {}) ⇒ Types::UpdateUserPoolClientResponse

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

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

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

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

Learn more

Examples:

Request syntax with placeholder values


resp = client.update_user_pool_client({
  user_pool_id: "UserPoolIdType", # required
  client_id: "ClientIdType", # required
  client_name: "ClientNameType",
  refresh_token_validity: 1,
  access_token_validity: 1,
  id_token_validity: 1,
  token_validity_units: {
    access_token: "seconds", # accepts seconds, minutes, hours, days
    id_token: "seconds", # accepts seconds, minutes, hours, days
    refresh_token: "seconds", # accepts seconds, minutes, hours, days
  },
  read_attributes: ["ClientPermissionType"],
  write_attributes: ["ClientPermissionType"],
  explicit_auth_flows: ["ADMIN_NO_SRP_AUTH"], # accepts 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
  supported_identity_providers: ["ProviderNameType"],
  callback_urls: ["RedirectUrlType"],
  logout_urls: ["RedirectUrlType"],
  default_redirect_uri: "RedirectUrlType",
  allowed_o_auth_flows: ["code"], # accepts code, implicit, client_credentials
  allowed_o_auth_scopes: ["ScopeType"],
  allowed_o_auth_flows_user_pool_client: false,
  analytics_configuration: {
    application_id: "HexStringType",
    application_arn: "ArnType",
    role_arn: "ArnType",
    external_id: "StringType",
    user_data_shared: false,
  },
  prevent_user_existence_errors: "LEGACY", # accepts LEGACY, ENABLED
  enable_token_revocation: false,
  enable_propagate_additional_user_context_data: false,
  auth_session_validity: 1,
})

Response structure


resp.user_pool_client.user_pool_id #=> String
resp.user_pool_client.client_name #=> String
resp.user_pool_client.client_id #=> String
resp.user_pool_client.client_secret #=> String
resp.user_pool_client.last_modified_date #=> Time
resp.user_pool_client.creation_date #=> Time
resp.user_pool_client.refresh_token_validity #=> Integer
resp.user_pool_client.access_token_validity #=> Integer
resp.user_pool_client.id_token_validity #=> Integer
resp.user_pool_client.token_validity_units.access_token #=> String, one of "seconds", "minutes", "hours", "days"
resp.user_pool_client.token_validity_units.id_token #=> String, one of "seconds", "minutes", "hours", "days"
resp.user_pool_client.token_validity_units.refresh_token #=> String, one of "seconds", "minutes", "hours", "days"
resp.user_pool_client.read_attributes #=> Array
resp.user_pool_client.read_attributes[0] #=> String
resp.user_pool_client.write_attributes #=> Array
resp.user_pool_client.write_attributes[0] #=> String
resp.user_pool_client.explicit_auth_flows #=> Array
resp.user_pool_client.explicit_auth_flows[0] #=> String, one of "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"
resp.user_pool_client.supported_identity_providers #=> Array
resp.user_pool_client.supported_identity_providers[0] #=> String
resp.user_pool_client.callback_urls #=> Array
resp.user_pool_client.callback_urls[0] #=> String
resp.user_pool_client.logout_urls #=> Array
resp.user_pool_client.logout_urls[0] #=> String
resp.user_pool_client.default_redirect_uri #=> String
resp.user_pool_client.allowed_o_auth_flows #=> Array
resp.user_pool_client.allowed_o_auth_flows[0] #=> String, one of "code", "implicit", "client_credentials"
resp.user_pool_client.allowed_o_auth_scopes #=> Array
resp.user_pool_client.allowed_o_auth_scopes[0] #=> String
resp.user_pool_client.allowed_o_auth_flows_user_pool_client #=> Boolean
resp.user_pool_client.analytics_configuration.application_id #=> String
resp.user_pool_client.analytics_configuration.application_arn #=> String
resp.user_pool_client.analytics_configuration.role_arn #=> String
resp.user_pool_client.analytics_configuration.external_id #=> String
resp.user_pool_client.analytics_configuration.user_data_shared #=> Boolean
resp.user_pool_client.prevent_user_existence_errors #=> String, one of "LEGACY", "ENABLED"
resp.user_pool_client.enable_token_revocation #=> Boolean
resp.user_pool_client.enable_propagate_additional_user_context_data #=> Boolean
resp.user_pool_client.auth_session_validity #=> Integer

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :user_pool_id (required, String)

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

  • :client_id (required, String)

    The ID of the client associated with the user pool.

  • :client_name (String)

    The client name from the update user pool client request.

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

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

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

  • :token_validity_units (Types::TokenValidityUnitsType)

    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.

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

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

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

    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.

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

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

  • :logout_urls (Array<String>)

    A list of allowed logout URLs for the IdPs.

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

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

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

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

  • :analytics_configuration (Types::AnalyticsConfigurationType)

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

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

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

  • :enable_token_revocation (Boolean)

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

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

  • :auth_session_validity (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:

See Also:



10525
10526
10527
10528
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 10525

def update_user_pool_client(params = {}, options = {})
  req = build_request(:update_user_pool_client, params)
  req.send_request(options)
end

#update_user_pool_domain(params = {}) ⇒ Types::UpdateUserPoolDomainResponse

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.

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

Examples:

Request syntax with placeholder values


resp = client.update_user_pool_domain({
  domain: "DomainType", # required
  user_pool_id: "UserPoolIdType", # required
  custom_domain_config: { # required
    certificate_arn: "ArnType", # required
  },
})

Response structure


resp.cloud_front_domain #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :domain (required, 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.

  • :user_pool_id (required, String)

    The ID of the user pool that is associated with the custom domain whose certificate you're updating.

  • :custom_domain_config (required, Types::CustomDomainConfigType)

    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.

Returns:

See Also:



10620
10621
10622
10623
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 10620

def update_user_pool_domain(params = {}, options = {})
  req = build_request(:update_user_pool_domain, params)
  req.send_request(options)
end

#verify_software_token(params = {}) ⇒ Types::VerifySoftwareTokenResponse

Use this API to register a user's entered time-based one-time password (TOTP) code and mark the user's software token MFA status as "verified" if successful. The request takes an access token or a session string, but not both.

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

Examples:

Request syntax with placeholder values


resp = client.verify_software_token({
  access_token: "TokenModelType",
  session: "SessionType",
  user_code: "SoftwareTokenMFAUserCodeType", # required
  friendly_device_name: "StringType",
})

Response structure


resp.status #=> String, one of "SUCCESS", "ERROR"
resp.session #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

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

  • :user_code (required, String)

    The one- time password computed using the secret code returned by AssociateSoftwareToken.

  • :friendly_device_name (String)

    The friendly device name.

Returns:

See Also:



10685
10686
10687
10688
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 10685

def verify_software_token(params = {}, options = {})
  req = build_request(:verify_software_token, params)
  req.send_request(options)
end

#verify_user_attribute(params = {}) ⇒ Struct

Verifies the specified user attributes in the user pool.

If your user pool requires verification before Amazon Cognito updates the attribute value, VerifyUserAttribute updates the affected attribute to its pending value. For more information, see UserAttributeUpdateSettingsType.

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

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

Examples:

Request syntax with placeholder values


resp = client.verify_user_attribute({
  access_token: "TokenModelType", # required
  attribute_name: "AttributeNameType", # required
  code: "ConfirmationCodeType", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :access_token (required, String)

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

  • :attribute_name (required, String)

    The attribute name in the request to verify user attributes.

  • :code (required, String)

    The verification code in the request to verify user attributes.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



10738
10739
10740
10741
# File 'gems/aws-sdk-cognitoidentityprovider/lib/aws-sdk-cognitoidentityprovider/client.rb', line 10738

def verify_user_attribute(params = {}, options = {})
  req = build_request(:verify_user_attribute, params)
  req.send_request(options)
end