You are viewing the documentation for an older major version of the AWS SDK for JavaScript.
The modular AWS SDK for JavaScript (v3), the latest major version of AWS SDK for JavaScript, is now stable and recommended for general use. For more information, see the Migration Guide and API Reference.

Class: AWS.CognitoIdentity

Inherits:
AWS.Service show all
Identifier:
cognitoidentity
API Version:
2014-06-30
Defined in:
(unknown)

Overview

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

Service Description

Amazon Cognito Federated Identities is a web service that delivers scoped temporary credentials to mobile devices and other untrusted environments. It uniquely identifies a device and supplies the user with a consistent identity over the lifetime of an application.

Using Amazon Cognito Federated Identities, you can enable authentication with one or more third-party identity providers (Facebook, Google, or Login with Amazon) or an Amazon Cognito user pool, and you can also choose to support unauthenticated access from your app. Cognito delivers a unique identifier for each user and acts as an OpenID token provider trusted by AWS Security Token Service (STS) to access temporary, limited-privilege AWS credentials.

For a description of the authentication flow from the Amazon Cognito Developer Guide see Authentication Flow.

For more information see Amazon Cognito Federated Identities.

Sending a Request Using CognitoIdentity

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

Locking the API Version

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

var cognitoidentity = new AWS.CognitoIdentity({apiVersion: '2014-06-30'});

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

AWS.config.apiVersions = {
  cognitoidentity: '2014-06-30',
  // other service API versions
};

var cognitoidentity = new AWS.CognitoIdentity();

Version:

  • 2014-06-30

Constructor Summary collapse

Property Summary collapse

Properties inherited from AWS.Service

apiVersions

Method Summary collapse

Methods inherited from AWS.Service

makeRequest, makeUnauthenticatedRequest, waitFor, setupRequestListeners, defineService

Constructor Details

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

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

Examples:

Constructing a CognitoIdentity object

var cognitoidentity = new AWS.CognitoIdentity({apiVersion: '2014-06-30'});

Options Hash (options):

  • params (map)

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

  • endpoint (String|AWS.Endpoint)

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

  • accessKeyId (String)

    your AWS access key ID.

  • secretAccessKey (String)

    your AWS secret access key.

  • sessionToken (AWS.Credentials)

    the optional AWS session token to sign requests with.

  • credentials (AWS.Credentials)

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

  • credentialProvider (AWS.CredentialProviderChain)

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

  • region (String)

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

  • maxRetries (Integer)

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

  • maxRedirects (Integer)

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

  • sslEnabled (Boolean)

    whether to enable SSL for requests.

  • paramValidation (Boolean|map)

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

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

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

  • convertResponseTypes (Boolean)

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

  • correctClockSkew (Boolean)

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

  • s3ForcePathStyle (Boolean)

    whether to force path style URLs for S3 objects.

  • s3BucketEndpoint (Boolean)

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

  • s3DisableBodySigning (Boolean)

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

  • s3UsEast1RegionalEndpoint ('legacy'|'regional')

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

  • s3UseArnRegion (Boolean)

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

  • retryDelayOptions (map)

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

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

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

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

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

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

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

  • logger (#write, #log)

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

  • systemClockOffset (Number)

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

  • signatureVersion (String)

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

  • signatureCache (Boolean)

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

  • dynamoDbCrc32 (Boolean)

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

  • useAccelerateEndpoint (Boolean)

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

  • clientSideMonitoring (Boolean)

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

  • endpointDiscoveryEnabled (Boolean|undefined)

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

  • endpointCacheSize (Number)

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

  • hostPrefixEnabled (Boolean)

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

  • stsRegionalEndpoints ('legacy'|'regional')

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

Property Details

endpointAWS.Endpoint (readwrite)

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

Returns:

  • (AWS.Endpoint)

    an Endpoint object representing the endpoint URL for service requests.

Method Details

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

Creates a new identity pool. The identity pool is a store of user identity information that is specific to your AWS account. The keys for SupportedLoginProviders are as follows:

  • Facebook: graph.facebook.com

  • Google: accounts.google.com

  • Amazon: www.amazon.com

  • Twitter: api.twitter.com

  • Digits: www.digits.com

You must use AWS Developer credentials to call this API.

Service Reference:

Examples:

Calling the createIdentityPool operation

var params = {
  AllowUnauthenticatedIdentities: true || false, /* required */
  IdentityPoolName: 'STRING_VALUE', /* required */
  AllowClassicFlow: true || false,
  CognitoIdentityProviders: [
    {
      ClientId: 'STRING_VALUE',
      ProviderName: 'STRING_VALUE',
      ServerSideTokenCheck: true || false
    },
    /* more items */
  ],
  DeveloperProviderName: 'STRING_VALUE',
  IdentityPoolTags: {
    '<TagKeysType>': 'STRING_VALUE',
    /* '<TagKeysType>': ... */
  },
  OpenIdConnectProviderARNs: [
    'STRING_VALUE',
    /* more items */
  ],
  SamlProviderARNs: [
    'STRING_VALUE',
    /* more items */
  ],
  SupportedLoginProviders: {
    '<IdentityProviderName>': 'STRING_VALUE',
    /* '<IdentityProviderName>': ... */
  }
};
cognitoidentity.createIdentityPool(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

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

      A string that you provide.

    • AllowUnauthenticatedIdentities — (Boolean)

      TRUE if the identity pool supports unauthenticated logins.

    • AllowClassicFlow — (Boolean)

      Enables or disables the Basic (Classic) authentication flow. For more information, see Identity Pools (Federated Identities) Authentication Flow in the Amazon Cognito Developer Guide.

    • SupportedLoginProviders — (map<String>)

      Optional key:value pairs mapping provider names to provider app IDs.

    • DeveloperProviderName — (String)

      The "domain" by which Cognito will refer to your users. This name acts as a placeholder that allows your backend and the Cognito service to communicate about the developer provider. For the DeveloperProviderName, you can use letters as well as period (.), underscore (_), and dash (-).

      Once you have set a developer provider name, you cannot change it. Please take care in setting this parameter.

    • OpenIdConnectProviderARNs — (Array<String>)

      The Amazon Resource Names (ARN) of the OpenID Connect providers.

    • CognitoIdentityProviders — (Array<map>)

      An array of Amazon Cognito user pools and their client IDs.

      • ProviderName — (String)

        The provider name for an Amazon Cognito user pool. For example, cognito-idp.us-east-1.amazonaws.com/us-east-1_123456789.

      • ClientId — (String)

        The client ID for the Amazon Cognito user pool.

      • ServerSideTokenCheck — (Boolean)

        TRUE if server-side token validation is enabled for the identity provider’s token.

        Once you set ServerSideTokenCheck to TRUE for an identity pool, that identity pool will check with the integrated user pools to make sure that the user has not been globally signed out or deleted before the identity pool provides an OIDC token or AWS credentials for the user.

        If the user is signed out or deleted, the identity pool will return a 400 Not Authorized error.

    • SamlProviderARNs — (Array<String>)

      An array of Amazon Resource Names (ARNs) of the SAML provider for your identity pool.

    • IdentityPoolTags — (map<String>)

      Tags to assign to the identity pool. A tag is a label that you can apply to identity pools to categorize and manage them in different ways, such as by purpose, owner, environment, or other criteria.

Callback (callback):

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

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

    Context (this):

    • (AWS.Response)

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

    Parameters:

    • err (Error)

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

    • data (Object)

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

      • IdentityPoolId — (String)

        An identity pool ID in the format REGION:GUID.

      • IdentityPoolName — (String)

        A string that you provide.

      • AllowUnauthenticatedIdentities — (Boolean)

        TRUE if the identity pool supports unauthenticated logins.

      • AllowClassicFlow — (Boolean)

        Enables or disables the Basic (Classic) authentication flow. For more information, see Identity Pools (Federated Identities) Authentication Flow in the Amazon Cognito Developer Guide.

      • SupportedLoginProviders — (map<String>)

        Optional key:value pairs mapping provider names to provider app IDs.

      • DeveloperProviderName — (String)

        The "domain" by which Cognito will refer to your users.

      • OpenIdConnectProviderARNs — (Array<String>)

        The ARNs of the OpenID Connect providers.

      • CognitoIdentityProviders — (Array<map>)

        A list representing an Amazon Cognito user pool and its client ID.

        • ProviderName — (String)

          The provider name for an Amazon Cognito user pool. For example, cognito-idp.us-east-1.amazonaws.com/us-east-1_123456789.

        • ClientId — (String)

          The client ID for the Amazon Cognito user pool.

        • ServerSideTokenCheck — (Boolean)

          TRUE if server-side token validation is enabled for the identity provider’s token.

          Once you set ServerSideTokenCheck to TRUE for an identity pool, that identity pool will check with the integrated user pools to make sure that the user has not been globally signed out or deleted before the identity pool provides an OIDC token or AWS credentials for the user.

          If the user is signed out or deleted, the identity pool will return a 400 Not Authorized error.

      • SamlProviderARNs — (Array<String>)

        An array of Amazon Resource Names (ARNs) of the SAML provider for your identity pool.

      • IdentityPoolTags — (map<String>)

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

Returns:

  • (AWS.Request)

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

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

Deletes identities from an identity pool. You can specify a list of 1-60 identities that you want to delete.

You must use AWS Developer credentials to call this API.

Service Reference:

Examples:

Calling the deleteIdentities operation

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

Parameters:

  • params (Object) (defaults to: {})
    • IdentityIdsToDelete — (Array<String>)

      A list of 1-60 identities that you want to delete.

Callback (callback):

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

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

    Context (this):

    • (AWS.Response)

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

    Parameters:

    • err (Error)

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

    • data (Object)

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

      • UnprocessedIdentityIds — (Array<map>)

        An array of UnprocessedIdentityId objects, each of which contains an ErrorCode and IdentityId.

        • IdentityId — (String)

          A unique identifier in the format REGION:GUID.

        • ErrorCode — (String)

          The error code indicating the type of error that occurred.

          Possible values include:
          • "AccessDenied"
          • "InternalServerError"

Returns:

  • (AWS.Request)

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

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

Deletes an identity pool. Once a pool is deleted, users will not be able to authenticate with the pool.

You must use AWS Developer credentials to call this API.

Service Reference:

Examples:

Calling the deleteIdentityPool operation

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

Parameters:

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

      An identity pool ID in the format REGION:GUID.

Callback (callback):

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

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

    Context (this):

    • (AWS.Response)

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

    Parameters:

    • err (Error)

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

    • data (Object)

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

Returns:

  • (AWS.Request)

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

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

Returns metadata related to the given identity, including when the identity was created and any associated linked logins.

You must use AWS Developer credentials to call this API.

Service Reference:

Examples:

Calling the describeIdentity operation

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

Parameters:

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

      A unique identifier in the format REGION:GUID.

Callback (callback):

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

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

    Context (this):

    • (AWS.Response)

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

    Parameters:

    • err (Error)

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

    • data (Object)

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

      • IdentityId — (String)

        A unique identifier in the format REGION:GUID.

      • Logins — (Array<String>)

        The provider names.

      • CreationDate — (Date)

        Date on which the identity was created.

      • LastModifiedDate — (Date)

        Date on which the identity was last modified.

Returns:

  • (AWS.Request)

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

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

Gets details about a particular identity pool, including the pool name, ID description, creation date, and current number of users.

You must use AWS Developer credentials to call this API.

Service Reference:

Examples:

Calling the describeIdentityPool operation

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

Parameters:

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

      An identity pool ID in the format REGION:GUID.

Callback (callback):

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

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

    Context (this):

    • (AWS.Response)

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

    Parameters:

    • err (Error)

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

    • data (Object)

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

      • IdentityPoolId — (String)

        An identity pool ID in the format REGION:GUID.

      • IdentityPoolName — (String)

        A string that you provide.

      • AllowUnauthenticatedIdentities — (Boolean)

        TRUE if the identity pool supports unauthenticated logins.

      • AllowClassicFlow — (Boolean)

        Enables or disables the Basic (Classic) authentication flow. For more information, see Identity Pools (Federated Identities) Authentication Flow in the Amazon Cognito Developer Guide.

      • SupportedLoginProviders — (map<String>)

        Optional key:value pairs mapping provider names to provider app IDs.

      • DeveloperProviderName — (String)

        The "domain" by which Cognito will refer to your users.

      • OpenIdConnectProviderARNs — (Array<String>)

        The ARNs of the OpenID Connect providers.

      • CognitoIdentityProviders — (Array<map>)

        A list representing an Amazon Cognito user pool and its client ID.

        • ProviderName — (String)

          The provider name for an Amazon Cognito user pool. For example, cognito-idp.us-east-1.amazonaws.com/us-east-1_123456789.

        • ClientId — (String)

          The client ID for the Amazon Cognito user pool.

        • ServerSideTokenCheck — (Boolean)

          TRUE if server-side token validation is enabled for the identity provider’s token.

          Once you set ServerSideTokenCheck to TRUE for an identity pool, that identity pool will check with the integrated user pools to make sure that the user has not been globally signed out or deleted before the identity pool provides an OIDC token or AWS credentials for the user.

          If the user is signed out or deleted, the identity pool will return a 400 Not Authorized error.

      • SamlProviderARNs — (Array<String>)

        An array of Amazon Resource Names (ARNs) of the SAML provider for your identity pool.

      • IdentityPoolTags — (map<String>)

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

Returns:

  • (AWS.Request)

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

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

Returns credentials for the provided identity ID. Any provided logins will be validated against supported login providers. If the token is for cognito-identity.amazonaws.com, it will be passed through to AWS Security Token Service with the appropriate role for the token.

This is a public API. You do not need any credentials to call this API.

Service Reference:

Examples:

Calling the getCredentialsForIdentity operation

var params = {
  IdentityId: 'STRING_VALUE', /* required */
  CustomRoleArn: 'STRING_VALUE',
  Logins: {
    '<IdentityProviderName>': 'STRING_VALUE',
    /* '<IdentityProviderName>': ... */
  }
};
cognitoidentity.getCredentialsForIdentity(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

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

      A unique identifier in the format REGION:GUID.

    • Logins — (map<String>)

      A set of optional name-value pairs that map provider names to provider tokens. The name-value pair will follow the syntax "provider_name": "provider_user_identifier".

      Logins should not be specified when trying to get credentials for an unauthenticated identity.

      The Logins parameter is required when using identities associated with external identity providers such as Facebook. For examples of Logins maps, see the code examples in the External Identity Providers section of the Amazon Cognito Developer Guide.

    • CustomRoleArn — (String)

      The Amazon Resource Name (ARN) of the role to be assumed when multiple roles were received in the token from the identity provider. For example, a SAML-based identity provider. This parameter is optional for identity providers that do not support role customization.

Callback (callback):

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

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

    Context (this):

    • (AWS.Response)

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

    Parameters:

    • err (Error)

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

    • data (Object)

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

      • IdentityId — (String)

        A unique identifier in the format REGION:GUID.

      • Credentials — (map)

        Credentials for the provided identity ID.

        • AccessKeyId — (String)

          The Access Key portion of the credentials.

        • SecretKey — (String)

          The Secret Access Key portion of the credentials

        • SessionToken — (String)

          The Session Token portion of the credentials

        • Expiration — (Date)

          The date at which these credentials will expire.

Returns:

  • (AWS.Request)

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

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

Generates (or retrieves) a Cognito ID. Supplying multiple logins will create an implicit linked account.

This is a public API. You do not need any credentials to call this API.

Service Reference:

Examples:

Calling the getId operation

var params = {
  IdentityPoolId: 'STRING_VALUE', /* required */
  AccountId: 'STRING_VALUE',
  Logins: {
    '<IdentityProviderName>': 'STRING_VALUE',
    /* '<IdentityProviderName>': ... */
  }
};
cognitoidentity.getId(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

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

      A standard AWS account ID (9+ digits).

    • IdentityPoolId — (String)

      An identity pool ID in the format REGION:GUID.

    • Logins — (map<String>)

      A set of optional name-value pairs that map provider names to provider tokens. The available provider names for Logins are as follows:

      • Facebook: graph.facebook.com

      • Amazon Cognito user pool: cognito-idp.<region>.amazonaws.com/<YOUR_USER_POOL_ID>, for example, cognito-idp.us-east-1.amazonaws.com/us-east-1_123456789.

      • Google: accounts.google.com

      • Amazon: www.amazon.com

      • Twitter: api.twitter.com

      • Digits: www.digits.com

Callback (callback):

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

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

    Context (this):

    • (AWS.Response)

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

    Parameters:

    • err (Error)

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

    • data (Object)

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

      • IdentityId — (String)

        A unique identifier in the format REGION:GUID.

Returns:

  • (AWS.Request)

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

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

Gets the roles for an identity pool.

You must use AWS Developer credentials to call this API.

Service Reference:

Examples:

Calling the getIdentityPoolRoles operation

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

Parameters:

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

      An identity pool ID in the format REGION:GUID.

Callback (callback):

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

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

    Context (this):

    • (AWS.Response)

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

    Parameters:

    • err (Error)

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

    • data (Object)

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

      • IdentityPoolId — (String)

        An identity pool ID in the format REGION:GUID.

      • Roles — (map<String>)

        The map of roles associated with this pool. Currently only authenticated and unauthenticated roles are supported.

      • RoleMappings — (map<map>)

        How users for a specific identity provider are to mapped to roles. This is a String-to-RoleMapping object map. The string identifies the identity provider, for example, "graph.facebook.com" or "cognito-idp.us-east-1.amazonaws.com/us-east-1_abcdefghi:app_client_id".

        • Typerequired — (String)

          The role mapping type. Token will use cognito:roles and cognito:preferred_role claims from the Cognito identity provider token to map groups to roles. Rules will attempt to match claims from the token to map to a role.

          Possible values include:
          • "Token"
          • "Rules"
        • AmbiguousRoleResolution — (String)

          If you specify Token or Rules as the Type, AmbiguousRoleResolution is required.

          Specifies the action to be taken if either no rules match the claim value for the Rules type, or there is no cognito:preferred_role claim and there are multiple cognito:roles matches for the Token type.

          Possible values include:
          • "AuthenticatedRole"
          • "Deny"
        • RulesConfiguration — (map)

          The rules to be used for mapping users to roles.

          If you specify Rules as the role mapping type, RulesConfiguration is required.

          • Rulesrequired — (Array<map>)

            An array of rules. You can specify up to 25 rules per identity provider.

            Rules are evaluated in order. The first one to match specifies the role.

            • Claimrequired — (String)

              The claim name that must be present in the token, for example, "isAdmin" or "paid".

            • MatchTyperequired — (String)

              The match condition that specifies how closely the claim value in the IdP token must match Value.

              Possible values include:
              • "Equals"
              • "Contains"
              • "StartsWith"
              • "NotEqual"
            • Valuerequired — (String)

              A brief string that the claim must match, for example, "paid" or "yes".

            • RoleARNrequired — (String)

              The role ARN.

Returns:

  • (AWS.Request)

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

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

Gets an OpenID token, using a known Cognito ID. This known Cognito ID is returned by GetId. You can optionally add additional logins for the identity. Supplying multiple logins creates an implicit link.

The OpenID token is valid for 10 minutes.

This is a public API. You do not need any credentials to call this API.

Service Reference:

Examples:

Calling the getOpenIdToken operation

var params = {
  IdentityId: 'STRING_VALUE', /* required */
  Logins: {
    '<IdentityProviderName>': 'STRING_VALUE',
    /* '<IdentityProviderName>': ... */
  }
};
cognitoidentity.getOpenIdToken(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

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

      A unique identifier in the format REGION:GUID.

    • Logins — (map<String>)

      A set of optional name-value pairs that map provider names to provider tokens. When using graph.facebook.com and www.amazon.com, supply the access_token returned from the provider's authflow. For accounts.google.com, an Amazon Cognito user pool provider, or any other OpenID Connect provider, always include the id_token.

Callback (callback):

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

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

    Context (this):

    • (AWS.Response)

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

    Parameters:

    • err (Error)

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

    • data (Object)

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

      • IdentityId — (String)

        A unique identifier in the format REGION:GUID. Note that the IdentityId returned may not match the one passed on input.

      • Token — (String)

        An OpenID token, valid for 10 minutes.

Returns:

  • (AWS.Request)

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

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

Registers (or retrieves) a Cognito IdentityId and an OpenID Connect token for a user authenticated by your backend authentication process. Supplying multiple logins will create an implicit linked account. You can only specify one developer provider as part of the Logins map, which is linked to the identity pool. The developer provider is the "domain" by which Cognito will refer to your users.

You can use GetOpenIdTokenForDeveloperIdentity to create a new identity and to link new logins (that is, user credentials issued by a public provider or developer provider) to an existing identity. When you want to create a new identity, the IdentityId should be null. When you want to associate a new login with an existing authenticated/unauthenticated identity, you can do so by providing the existing IdentityId. This API will create the identity in the specified IdentityPoolId.

You must use AWS Developer credentials to call this API.

Examples:

Calling the getOpenIdTokenForDeveloperIdentity operation

var params = {
  IdentityPoolId: 'STRING_VALUE', /* required */
  Logins: { /* required */
    '<IdentityProviderName>': 'STRING_VALUE',
    /* '<IdentityProviderName>': ... */
  },
  IdentityId: 'STRING_VALUE',
  PrincipalTags: {
    '<PrincipalTagID>': 'STRING_VALUE',
    /* '<PrincipalTagID>': ... */
  },
  TokenDuration: 'NUMBER_VALUE'
};
cognitoidentity.getOpenIdTokenForDeveloperIdentity(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

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

      An identity pool ID in the format REGION:GUID.

    • IdentityId — (String)

      A unique identifier in the format REGION:GUID.

    • Logins — (map<String>)

      A set of optional name-value pairs that map provider names to provider tokens. Each name-value pair represents a user from a public provider or developer provider. If the user is from a developer provider, the name-value pair will follow the syntax "developer_provider_name": "developer_user_identifier". The developer provider is the "domain" by which Cognito will refer to your users; you provided this domain while creating/updating the identity pool. The developer user identifier is an identifier from your backend that uniquely identifies a user. When you create an identity pool, you can specify the supported logins.

    • PrincipalTags — (map<String>)

      Use this operation to configure attribute mappings for custom providers.

    • TokenDuration — (Integer)

      The expiration time of the token, in seconds. You can specify a custom expiration time for the token so that you can cache it. If you don't provide an expiration time, the token is valid for 15 minutes. You can exchange the token with Amazon STS for temporary AWS credentials, which are valid for a maximum of one hour. The maximum token duration you can set is 24 hours. You should take care in setting the expiration time for a token, as there are significant security implications: an attacker could use a leaked token to access your AWS resources for the token's duration.

      Note: Please provide for a small grace period, usually no more than 5 minutes, to account for clock skew.

Callback (callback):

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

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

    Context (this):

    • (AWS.Response)

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

    Parameters:

    • err (Error)

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

    • data (Object)

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

      • IdentityId — (String)

        A unique identifier in the format REGION:GUID.

      • Token — (String)

        An OpenID token.

Returns:

  • (AWS.Request)

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

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

Use GetPrincipalTagAttributeMap to list all mappings between PrincipalTags and user attributes.

Service Reference:

Examples:

Calling the getPrincipalTagAttributeMap operation

var params = {
  IdentityPoolId: 'STRING_VALUE', /* required */
  IdentityProviderName: 'STRING_VALUE' /* required */
};
cognitoidentity.getPrincipalTagAttributeMap(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

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

      You can use this operation to get the ID of the Identity Pool you setup attribute mappings for.

    • IdentityProviderName — (String)

      You can use this operation to get the provider name.

Callback (callback):

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

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

    Context (this):

    • (AWS.Response)

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

    Parameters:

    • err (Error)

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

    • data (Object)

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

      • IdentityPoolId — (String)

        You can use this operation to get the ID of the Identity Pool you setup attribute mappings for.

      • IdentityProviderName — (String)

        You can use this operation to get the provider name.

      • UseDefaults — (Boolean)

        You can use this operation to list

      • PrincipalTags — (map<String>)

        You can use this operation to add principal tags. The PrincipalTagsoperation enables you to reference user attributes in your IAM permissions policy.

Returns:

  • (AWS.Request)

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

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

Lists the identities in an identity pool.

You must use AWS Developer credentials to call this API.

Service Reference:

Examples:

Calling the listIdentities operation

var params = {
  IdentityPoolId: 'STRING_VALUE', /* required */
  MaxResults: 'NUMBER_VALUE', /* required */
  HideDisabled: true || false,
  NextToken: 'STRING_VALUE'
};
cognitoidentity.listIdentities(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

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

      An identity pool ID in the format REGION:GUID.

    • MaxResults — (Integer)

      The maximum number of identities to return.

    • NextToken — (String)

      A pagination token.

    • HideDisabled — (Boolean)

      An optional boolean parameter that allows you to hide disabled identities. If omitted, the ListIdentities API will include disabled identities in the response.

Callback (callback):

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

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

    Context (this):

    • (AWS.Response)

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

    Parameters:

    • err (Error)

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

    • data (Object)

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

      • IdentityPoolId — (String)

        An identity pool ID in the format REGION:GUID.

      • Identities — (Array<map>)

        An object containing a set of identities and associated mappings.

        • IdentityId — (String)

          A unique identifier in the format REGION:GUID.

        • Logins — (Array<String>)

          The provider names.

        • CreationDate — (Date)

          Date on which the identity was created.

        • LastModifiedDate — (Date)

          Date on which the identity was last modified.

      • NextToken — (String)

        A pagination token.

Returns:

  • (AWS.Request)

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

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

Lists all of the Cognito identity pools registered for your account.

You must use AWS Developer credentials to call this API.

Service Reference:

Examples:

Calling the listIdentityPools operation

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

Parameters:

  • params (Object) (defaults to: {})
    • MaxResults — (Integer)

      The maximum number of identities to return.

    • NextToken — (String)

      A pagination token.

Callback (callback):

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

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

    Context (this):

    • (AWS.Response)

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

    Parameters:

    • err (Error)

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

    • data (Object)

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

      • IdentityPools — (Array<map>)

        The identity pools returned by the ListIdentityPools action.

        • IdentityPoolId — (String)

          An identity pool ID in the format REGION:GUID.

        • IdentityPoolName — (String)

          A string that you provide.

      • NextToken — (String)

        A pagination token.

Returns:

  • (AWS.Request)

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

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

Lists the tags that are assigned to an Amazon Cognito identity pool.

A tag is a label that you can apply to identity pools to categorize and manage them in different ways, such as by purpose, owner, environment, or other criteria.

You can use this action up to 10 times per second, per account.

Service Reference:

Examples:

Calling the listTagsForResource operation

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

Parameters:

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

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

Callback (callback):

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

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

    Context (this):

    • (AWS.Response)

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

    Parameters:

    • err (Error)

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

    • data (Object)

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

      • Tags — (map<String>)

        The tags that are assigned to the identity pool.

Returns:

  • (AWS.Request)

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

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

Retrieves the IdentityID associated with a DeveloperUserIdentifier or the list of DeveloperUserIdentifier values associated with an IdentityId for an existing identity. Either IdentityID or DeveloperUserIdentifier must not be null. If you supply only one of these values, the other value will be searched in the database and returned as a part of the response. If you supply both, DeveloperUserIdentifier will be matched against IdentityID. If the values are verified against the database, the response returns both values and is the same as the request. Otherwise a ResourceConflictException is thrown.

LookupDeveloperIdentity is intended for low-throughput control plane operations: for example, to enable customer service to locate an identity ID by username. If you are using it for higher-volume operations such as user authentication, your requests are likely to be throttled. GetOpenIdTokenForDeveloperIdentity is a better option for higher-volume operations for user authentication.

You must use AWS Developer credentials to call this API.

Service Reference:

Examples:

Calling the lookupDeveloperIdentity operation

var params = {
  IdentityPoolId: 'STRING_VALUE', /* required */
  DeveloperUserIdentifier: 'STRING_VALUE',
  IdentityId: 'STRING_VALUE',
  MaxResults: 'NUMBER_VALUE',
  NextToken: 'STRING_VALUE'
};
cognitoidentity.lookupDeveloperIdentity(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

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

      An identity pool ID in the format REGION:GUID.

    • IdentityId — (String)

      A unique identifier in the format REGION:GUID.

    • DeveloperUserIdentifier — (String)

      A unique ID used by your backend authentication process to identify a user. Typically, a developer identity provider would issue many developer user identifiers, in keeping with the number of users.

    • MaxResults — (Integer)

      The maximum number of identities to return.

    • NextToken — (String)

      A pagination token. The first call you make will have NextToken set to null. After that the service will return NextToken values as needed. For example, let's say you make a request with MaxResults set to 10, and there are 20 matches in the database. The service will return a pagination token as a part of the response. This token can be used to call the API again and get results starting from the 11th match.

Callback (callback):

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

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

    Context (this):

    • (AWS.Response)

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

    Parameters:

    • err (Error)

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

    • data (Object)

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

      • IdentityId — (String)

        A unique identifier in the format REGION:GUID.

      • DeveloperUserIdentifierList — (Array<String>)

        This is the list of developer user identifiers associated with an identity ID. Cognito supports the association of multiple developer user identifiers with an identity ID.

      • NextToken — (String)

        A pagination token. The first call you make will have NextToken set to null. After that the service will return NextToken values as needed. For example, let's say you make a request with MaxResults set to 10, and there are 20 matches in the database. The service will return a pagination token as a part of the response. This token can be used to call the API again and get results starting from the 11th match.

Returns:

  • (AWS.Request)

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

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

Merges two users having different IdentityIds, existing in the same identity pool, and identified by the same developer provider. You can use this action to request that discrete users be merged and identified as a single user in the Cognito environment. Cognito associates the given source user (SourceUserIdentifier) with the IdentityId of the DestinationUserIdentifier. Only developer-authenticated users can be merged. If the users to be merged are associated with the same public provider, but as two different users, an exception will be thrown.

The number of linked logins is limited to 20. So, the number of linked logins for the source user, SourceUserIdentifier, and the destination user, DestinationUserIdentifier, together should not be larger than 20. Otherwise, an exception will be thrown.

You must use AWS Developer credentials to call this API.

Service Reference:

Examples:

Calling the mergeDeveloperIdentities operation

var params = {
  DestinationUserIdentifier: 'STRING_VALUE', /* required */
  DeveloperProviderName: 'STRING_VALUE', /* required */
  IdentityPoolId: 'STRING_VALUE', /* required */
  SourceUserIdentifier: 'STRING_VALUE' /* required */
};
cognitoidentity.mergeDeveloperIdentities(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

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

      User identifier for the source user. The value should be a DeveloperUserIdentifier.

    • DestinationUserIdentifier — (String)

      User identifier for the destination user. The value should be a DeveloperUserIdentifier.

    • DeveloperProviderName — (String)

      The "domain" by which Cognito will refer to your users. This is a (pseudo) domain name that you provide while creating an identity pool. This name acts as a placeholder that allows your backend and the Cognito service to communicate about the developer provider. For the DeveloperProviderName, you can use letters as well as period (.), underscore (_), and dash (-).

    • IdentityPoolId — (String)

      An identity pool ID in the format REGION:GUID.

Callback (callback):

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

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

    Context (this):

    • (AWS.Response)

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

    Parameters:

    • err (Error)

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

    • data (Object)

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

      • IdentityId — (String)

        A unique identifier in the format REGION:GUID.

Returns:

  • (AWS.Request)

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

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

Sets the roles for an identity pool. These roles are used when making calls to GetCredentialsForIdentity action.

You must use AWS Developer credentials to call this API.

Service Reference:

Examples:

Calling the setIdentityPoolRoles operation

var params = {
  IdentityPoolId: 'STRING_VALUE', /* required */
  Roles: { /* required */
    '<RoleType>': 'STRING_VALUE',
    /* '<RoleType>': ... */
  },
  RoleMappings: {
    '<IdentityProviderName>': {
      Type: Token | Rules, /* required */
      AmbiguousRoleResolution: AuthenticatedRole | Deny,
      RulesConfiguration: {
        Rules: [ /* required */
          {
            Claim: 'STRING_VALUE', /* required */
            MatchType: Equals | Contains | StartsWith | NotEqual, /* required */
            RoleARN: 'STRING_VALUE', /* required */
            Value: 'STRING_VALUE' /* required */
          },
          /* more items */
        ]
      }
    },
    /* '<IdentityProviderName>': ... */
  }
};
cognitoidentity.setIdentityPoolRoles(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

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

      An identity pool ID in the format REGION:GUID.

    • Roles — (map<String>)

      The map of roles associated with this pool. For a given role, the key will be either "authenticated" or "unauthenticated" and the value will be the Role ARN.

    • RoleMappings — (map<map>)

      How users for a specific identity provider are to mapped to roles. This is a string to RoleMapping object map. The string identifies the identity provider, for example, "graph.facebook.com" or "cognito-idp.us-east-1.amazonaws.com/us-east-1_abcdefghi:app_client_id".

      Up to 25 rules can be specified per identity provider.

      • Typerequired — (String)

        The role mapping type. Token will use cognito:roles and cognito:preferred_role claims from the Cognito identity provider token to map groups to roles. Rules will attempt to match claims from the token to map to a role.

        Possible values include:
        • "Token"
        • "Rules"
      • AmbiguousRoleResolution — (String)

        If you specify Token or Rules as the Type, AmbiguousRoleResolution is required.

        Specifies the action to be taken if either no rules match the claim value for the Rules type, or there is no cognito:preferred_role claim and there are multiple cognito:roles matches for the Token type.

        Possible values include:
        • "AuthenticatedRole"
        • "Deny"
      • RulesConfiguration — (map)

        The rules to be used for mapping users to roles.

        If you specify Rules as the role mapping type, RulesConfiguration is required.

        • Rulesrequired — (Array<map>)

          An array of rules. You can specify up to 25 rules per identity provider.

          Rules are evaluated in order. The first one to match specifies the role.

          • Claimrequired — (String)

            The claim name that must be present in the token, for example, "isAdmin" or "paid".

          • MatchTyperequired — (String)

            The match condition that specifies how closely the claim value in the IdP token must match Value.

            Possible values include:
            • "Equals"
            • "Contains"
            • "StartsWith"
            • "NotEqual"
          • Valuerequired — (String)

            A brief string that the claim must match, for example, "paid" or "yes".

          • RoleARNrequired — (String)

            The role ARN.

Callback (callback):

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

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

    Context (this):

    • (AWS.Response)

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

    Parameters:

    • err (Error)

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

    • data (Object)

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

Returns:

  • (AWS.Request)

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

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

You can use this operation to use default (username and clientID) attribute or custom attribute mappings.

Service Reference:

Examples:

Calling the setPrincipalTagAttributeMap operation

var params = {
  IdentityPoolId: 'STRING_VALUE', /* required */
  IdentityProviderName: 'STRING_VALUE', /* required */
  PrincipalTags: {
    '<PrincipalTagID>': 'STRING_VALUE',
    /* '<PrincipalTagID>': ... */
  },
  UseDefaults: true || false
};
cognitoidentity.setPrincipalTagAttributeMap(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

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

      The ID of the Identity Pool you want to set attribute mappings for.

    • IdentityProviderName — (String)

      The provider name you want to use for attribute mappings.

    • UseDefaults — (Boolean)

      You can use this operation to use default (username and clientID) attribute mappings.

    • PrincipalTags — (map<String>)

      You can use this operation to add principal tags.

Callback (callback):

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

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

    Context (this):

    • (AWS.Response)

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

    Parameters:

    • err (Error)

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

    • data (Object)

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

      • IdentityPoolId — (String)

        The ID of the Identity Pool you want to set attribute mappings for.

      • IdentityProviderName — (String)

        The provider name you want to use for attribute mappings.

      • UseDefaults — (Boolean)

        You can use this operation to select default (username and clientID) attribute mappings.

      • PrincipalTags — (map<String>)

        You can use this operation to add principal tags. The PrincipalTagsoperation enables you to reference user attributes in your IAM permissions policy.

Returns:

  • (AWS.Request)

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

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

Assigns a set of tags to the specified Amazon Cognito identity pool. A tag is a label that you can use to categorize and manage identity 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 an identity pool, one for testing and another for production, you might assign an Environment tag key to both identity pools. The value of this key might be Test for one identity 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 identity pools. In an IAM policy, you can constrain permissions for identity pools based on specific tags or tag values.

You can use this action up to 5 times per second, per account. An identity pool can have as many as 50 tags.

Service Reference:

Examples:

Calling the tagResource operation

var params = {
  ResourceArn: 'STRING_VALUE', /* required */
  Tags: { /* required */
    '<TagKeysType>': 'STRING_VALUE',
    /* '<TagKeysType>': ... */
  }
};
cognitoidentity.tagResource(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

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

      The Amazon Resource Name (ARN) of the identity pool.

    • Tags — (map<String>)

      The tags to assign to the identity pool.

Callback (callback):

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

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

    Context (this):

    • (AWS.Response)

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

    Parameters:

    • err (Error)

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

    • data (Object)

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

Returns:

  • (AWS.Request)

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

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

Unlinks a DeveloperUserIdentifier from an existing identity. Unlinked developer users will be considered new identities next time they are seen. If, for a given Cognito identity, you remove all federated identities as well as the developer user identifier, the Cognito identity becomes inaccessible.

You must use AWS Developer credentials to call this API.

Service Reference:

Examples:

Calling the unlinkDeveloperIdentity operation

var params = {
  DeveloperProviderName: 'STRING_VALUE', /* required */
  DeveloperUserIdentifier: 'STRING_VALUE', /* required */
  IdentityId: 'STRING_VALUE', /* required */
  IdentityPoolId: 'STRING_VALUE' /* required */
};
cognitoidentity.unlinkDeveloperIdentity(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

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

      A unique identifier in the format REGION:GUID.

    • IdentityPoolId — (String)

      An identity pool ID in the format REGION:GUID.

    • DeveloperProviderName — (String)

      The "domain" by which Cognito will refer to your users.

    • DeveloperUserIdentifier — (String)

      A unique ID used by your backend authentication process to identify a user.

Callback (callback):

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

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

    Context (this):

    • (AWS.Response)

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

    Parameters:

    • err (Error)

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

    • data (Object)

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

Returns:

  • (AWS.Request)

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

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

Unlinks a federated identity from an existing account. Unlinked logins will be considered new identities next time they are seen. Removing the last linked login will make this identity inaccessible.

This is a public API. You do not need any credentials to call this API.

Service Reference:

Examples:

Calling the unlinkIdentity operation

var params = {
  IdentityId: 'STRING_VALUE', /* required */
  Logins: { /* required */
    '<IdentityProviderName>': 'STRING_VALUE',
    /* '<IdentityProviderName>': ... */
  },
  LoginsToRemove: [ /* required */
    'STRING_VALUE',
    /* more items */
  ]
};
cognitoidentity.unlinkIdentity(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

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

      A unique identifier in the format REGION:GUID.

    • Logins — (map<String>)

      A set of optional name-value pairs that map provider names to provider tokens.

    • LoginsToRemove — (Array<String>)

      Provider names to unlink from this identity.

Callback (callback):

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

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

    Context (this):

    • (AWS.Response)

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

    Parameters:

    • err (Error)

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

    • data (Object)

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

Returns:

  • (AWS.Request)

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

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

Removes the specified tags from the specified Amazon Cognito identity pool. You can use this action up to 5 times per second, per account

Service Reference:

Examples:

Calling the untagResource operation

var params = {
  ResourceArn: 'STRING_VALUE', /* required */
  TagKeys: [ /* required */
    'STRING_VALUE',
    /* more items */
  ]
};
cognitoidentity.untagResource(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

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

      The Amazon Resource Name (ARN) of the identity pool.

    • TagKeys — (Array<String>)

      The keys of the tags to remove from the user pool.

Callback (callback):

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

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

    Context (this):

    • (AWS.Response)

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

    Parameters:

    • err (Error)

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

    • data (Object)

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

Returns:

  • (AWS.Request)

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

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

Updates an identity pool.

You must use AWS Developer credentials to call this API.

Service Reference:

Examples:

Calling the updateIdentityPool operation

var params = {
  AllowUnauthenticatedIdentities: true || false, /* required */
  IdentityPoolId: 'STRING_VALUE', /* required */
  IdentityPoolName: 'STRING_VALUE', /* required */
  AllowClassicFlow: true || false,
  CognitoIdentityProviders: [
    {
      ClientId: 'STRING_VALUE',
      ProviderName: 'STRING_VALUE',
      ServerSideTokenCheck: true || false
    },
    /* more items */
  ],
  DeveloperProviderName: 'STRING_VALUE',
  IdentityPoolTags: {
    '<TagKeysType>': 'STRING_VALUE',
    /* '<TagKeysType>': ... */
  },
  OpenIdConnectProviderARNs: [
    'STRING_VALUE',
    /* more items */
  ],
  SamlProviderARNs: [
    'STRING_VALUE',
    /* more items */
  ],
  SupportedLoginProviders: {
    '<IdentityProviderName>': 'STRING_VALUE',
    /* '<IdentityProviderName>': ... */
  }
};
cognitoidentity.updateIdentityPool(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

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

      An identity pool ID in the format REGION:GUID.

    • IdentityPoolName — (String)

      A string that you provide.

    • AllowUnauthenticatedIdentities — (Boolean)

      TRUE if the identity pool supports unauthenticated logins.

    • AllowClassicFlow — (Boolean)

      Enables or disables the Basic (Classic) authentication flow. For more information, see Identity Pools (Federated Identities) Authentication Flow in the Amazon Cognito Developer Guide.

    • SupportedLoginProviders — (map<String>)

      Optional key:value pairs mapping provider names to provider app IDs.

    • DeveloperProviderName — (String)

      The "domain" by which Cognito will refer to your users.

    • OpenIdConnectProviderARNs — (Array<String>)

      The ARNs of the OpenID Connect providers.

    • CognitoIdentityProviders — (Array<map>)

      A list representing an Amazon Cognito user pool and its client ID.

      • ProviderName — (String)

        The provider name for an Amazon Cognito user pool. For example, cognito-idp.us-east-1.amazonaws.com/us-east-1_123456789.

      • ClientId — (String)

        The client ID for the Amazon Cognito user pool.

      • ServerSideTokenCheck — (Boolean)

        TRUE if server-side token validation is enabled for the identity provider’s token.

        Once you set ServerSideTokenCheck to TRUE for an identity pool, that identity pool will check with the integrated user pools to make sure that the user has not been globally signed out or deleted before the identity pool provides an OIDC token or AWS credentials for the user.

        If the user is signed out or deleted, the identity pool will return a 400 Not Authorized error.

    • SamlProviderARNs — (Array<String>)

      An array of Amazon Resource Names (ARNs) of the SAML provider for your identity pool.

    • IdentityPoolTags — (map<String>)

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

Callback (callback):

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

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

    Context (this):

    • (AWS.Response)

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

    Parameters:

    • err (Error)

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

    • data (Object)

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

      • IdentityPoolId — (String)

        An identity pool ID in the format REGION:GUID.

      • IdentityPoolName — (String)

        A string that you provide.

      • AllowUnauthenticatedIdentities — (Boolean)

        TRUE if the identity pool supports unauthenticated logins.

      • AllowClassicFlow — (Boolean)

        Enables or disables the Basic (Classic) authentication flow. For more information, see Identity Pools (Federated Identities) Authentication Flow in the Amazon Cognito Developer Guide.

      • SupportedLoginProviders — (map<String>)

        Optional key:value pairs mapping provider names to provider app IDs.

      • DeveloperProviderName — (String)

        The "domain" by which Cognito will refer to your users.

      • OpenIdConnectProviderARNs — (Array<String>)

        The ARNs of the OpenID Connect providers.

      • CognitoIdentityProviders — (Array<map>)

        A list representing an Amazon Cognito user pool and its client ID.

        • ProviderName — (String)

          The provider name for an Amazon Cognito user pool. For example, cognito-idp.us-east-1.amazonaws.com/us-east-1_123456789.

        • ClientId — (String)

          The client ID for the Amazon Cognito user pool.

        • ServerSideTokenCheck — (Boolean)

          TRUE if server-side token validation is enabled for the identity provider’s token.

          Once you set ServerSideTokenCheck to TRUE for an identity pool, that identity pool will check with the integrated user pools to make sure that the user has not been globally signed out or deleted before the identity pool provides an OIDC token or AWS credentials for the user.

          If the user is signed out or deleted, the identity pool will return a 400 Not Authorized error.

      • SamlProviderARNs — (Array<String>)

        An array of Amazon Resource Names (ARNs) of the SAML provider for your identity pool.

      • IdentityPoolTags — (map<String>)

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

Returns:

  • (AWS.Request)

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