Amazon Cognito Identity Provider
  1. Root
Amazon Cognito Identity Provider
  • Root
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
    • /
      POST
  1. Root

/

POST
/
Responds to the authentication challenge.
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST '/' \
--header 'X-Amz-Target;' \
--header 'Content-Type: application/json' \
--data-raw '{
    "ClientId": "string",
    "ChallengeName": "SMS_MFA",
    "Session": "string",
    "ChallengeResponses": {
        "property1": "string",
        "property2": "string"
    },
    "AnalyticsMetadata": {},
    "UserContextData": {
        "IpAddress": "string",
        "EncodedData": "string"
    },
    "ClientMetadata": {
        "property1": "string",
        "property2": "string"
    }
}'
Response Response Example
200 - Example 1
{
    "ChallengeName": "SMS_MFA",
    "Session": "string",
    "ChallengeParameters": {
        "property1": "string",
        "property2": "string"
    },
    "AuthenticationResult": {
        "AccessToken": "string",
        "ExpiresIn": 0,
        "TokenType": "string",
        "RefreshToken": "string",
        "IdToken": "string",
        "NewDeviceMetadata": {
            "DeviceKey": "string",
            "DeviceGroupKey": "string"
        }
    }
}

Request

Header Params
X-Amz-Target
string 
required
Body Params application/json
The request to respond to an authentication challenge.
ClientId
string <password>
required
The app client ID.
>= 1 characters<= 128 characters
Match pattern:
[\w+]+
ChallengeName
enum<string> 
required
The challenge name. For more information, see InitiateAuth.
ADMIN_NO_SRP_AUTH isn't a valid value.
Allowed values:
SMS_MFASOFTWARE_TOKEN_MFASELECT_MFA_TYPEMFA_SETUPPASSWORD_VERIFIERCUSTOM_CHALLENGEDEVICE_SRP_AUTHDEVICE_PASSWORD_VERIFIERADMIN_NO_SRP_AUTHNEW_PASSWORD_REQUIRED
Session
string 
optional
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.
>= 20 characters<= 2048 characters
ChallengeResponses
object 
optional
The challenge responses. These are inputs corresponding to the value of ChallengeName, for example:
  • SMS_MFA: SMS_MFA_CODE, USERNAME.
  • PASSWORD_VERIFIER: PASSWORD_CLAIM_SIGNATURE, PASSWORD_CLAIM_SECRET_BLOCK, TIMESTAMP, USERNAME.
  • NEW_PASSWORD_REQUIRED: NEW_PASSWORD, USERNAME, SECRET_HASH (if app client is configured with client secret). To set any required attributes that Amazon Cognito returned as requiredAttributes in the InitiateAuth response, add a userAttributes.attributename parameter. This parameter can also set values for writable attributes that aren't required by your user pool.
  • SOFTWARE_TOKEN_MFA: USERNAME and SOFTWARE_TOKEN_MFA_CODE are required attributes.
  • DEVICE_SRP_AUTH requires USERNAME, DEVICE_KEY, SRP_A (and SECRET_HASH).
  • DEVICE_PASSWORD_VERIFIER requires everything that PASSWORD_VERIFIER requires, plus DEVICE_KEY.
  • MFA_SETUP requires USERNAME, plus you must use the session value returned by VerifySoftwareToken in the Session parameter.
AnalyticsMetadata
object 
optional
The Amazon Pinpoint analytics metadata that contributes to your metrics for RespondToAuthChallenge calls.
UserContextData
object 
optional
Contextual data about your user session, such as the device fingerprint, IP address, or location. Amazon Cognito advanced security evaluates the risk of an authentication event based on the context that your app generates and passes to Amazon Cognito when it makes API requests.
IpAddress
string 
optional
The source IP address of your user's device.
EncodedData
string 
optional
Encoded device-fingerprint details that your app collected with the Amazon Cognito context data collection library. For more information, see Adding user device and session data to API requests.
ClientMetadata
object 
optional
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.
Examples

Responses

🟢200Success
application/json
Body
The response to respond to the authentication challenge.
ChallengeName
enum<string> 
optional
The challenge name. For more information, see InitiateAuth.
Allowed values:
SMS_MFASOFTWARE_TOKEN_MFASELECT_MFA_TYPEMFA_SETUPPASSWORD_VERIFIERCUSTOM_CHALLENGEDEVICE_SRP_AUTHDEVICE_PASSWORD_VERIFIERADMIN_NO_SRP_AUTHNEW_PASSWORD_REQUIRED
Session
string 
optional
The session that should be passed both ways in challenge-response calls to the service. If the caller must pass another challenge, they return a session with other challenge parameters. This session should be passed as it is to the next RespondToAuthChallenge API call.
>= 20 characters<= 2048 characters
ChallengeParameters
object 
optional
The challenge parameters. For more information, see InitiateAuth.
AuthenticationResult
object 
optional
The result returned by the server in response to the request to respond to the authentication challenge.
AccessToken
string <password>
optional
A valid access token that Amazon Cognito issued to the user who you want to authenticate.
Match pattern:
[A-Za-z0-9-_=.]+
ExpiresIn
integer 
optional
The expiration period of the authentication result in seconds.
TokenType
string 
optional
The token type.
RefreshToken
string <password>
optional
The refresh token.
Match pattern:
[A-Za-z0-9-_=.]+
IdToken
string <password>
optional
The ID token.
Match pattern:
[A-Za-z0-9-_=.]+
NewDeviceMetadata
object 
optional
The new device metadata from an authentication result.
🟠480ResourceNotFoundException
🟠481InvalidParameterException
🟠482NotAuthorizedException
🟠483CodeMismatchException
🟠484ExpiredCodeException
🟠485UnexpectedLambdaException
🟠486UserLambdaValidationException
🟠487InvalidPasswordException
🟠488InvalidLambdaResponseException
🟠489TooManyRequestsException
🟠490InvalidUserPoolConfigurationException
🟠491MFAMethodNotFoundException
🟠492PasswordResetRequiredException
🟠493UserNotFoundException
🟠494UserNotConfirmedException
🟠495InvalidSmsRoleAccessPolicyException
🟠496InvalidSmsRoleTrustRelationshipException
🟠497AliasExistsException
🟠498InternalErrorException
🟠499SoftwareTokenMFANotFoundException
🔴500ForbiddenException
Modified at 2023-08-15 07:11:07
Previous
/
Next
/
Built with