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 an authentication challenge, as an administrator.
Calling this action requires developer credentials.
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST '/' \
--header 'X-Amz-Target;' \
--header 'Content-Type: application/json' \
--data-raw '{
    "UserPoolId": "string",
    "ClientId": "string",
    "ChallengeName": "SMS_MFA",
    "ChallengeResponses": {
        "property1": "string",
        "property2": "string"
    },
    "Session": "string",
    "AnalyticsMetadata": {},
    "ContextData": {
        "IpAddress": "string",
        "ServerName": "string",
        "ServerPath": "string",
        "HttpHeaders": [],
        "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 the authentication challenge, as an administrator.
UserPoolId
string 
required
The ID of the Amazon Cognito user pool.
>= 1 characters<= 55 characters
Match pattern:
[\w-]+_[0-9a-zA-Z]+
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 AdminInitiateAuth.
Allowed values:
SMS_MFASOFTWARE_TOKEN_MFASELECT_MFA_TYPEMFA_SETUPPASSWORD_VERIFIERCUSTOM_CHALLENGEDEVICE_SRP_AUTHDEVICE_PASSWORD_VERIFIERADMIN_NO_SRP_AUTHNEW_PASSWORD_REQUIRED
ChallengeResponses
object 
optional
The challenge responses. These are inputs corresponding to the value of ChallengeName, for example:
  • SMS_MFA: SMS_MFA_CODE, USERNAME, SECRET_HASH (if app client is configured with client secret).
  • PASSWORD_VERIFIER: PASSWORD_CLAIM_SIGNATURE, PASSWORD_CLAIM_SECRET_BLOCK, TIMESTAMP, USERNAME, SECRET_HASH (if app client is configured with client secret).
  • ADMIN_NO_SRP_AUTH: PASSWORD, USERNAME, SECRET_HASH (if app client is configured with client secret).
  • 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 AdminInitiateAuth response, add a userAttributes.attributename parameter. This parameter can also set values for writable attributes that aren't required by your user pool.
  • MFA_SETUP requires USERNAME, plus you must use the session value returned by VerifySoftwareToken in the Session parameter.
The value of the USERNAME attribute must be the user's actual username, not an alias (such as an email address or phone number). To make this simpler, the AdminInitiateAuth response includes the actual username value in the USERNAMEUSER_ID_FOR_SRP attribute. This happens even if you specified an alias in your call to AdminInitiateAuth.
Session
string 
optional
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.
>= 20 characters<= 2048 characters
AnalyticsMetadata
object 
optional
The analytics metadata for collecting Amazon Pinpoint metrics for AdminRespondToAuthChallenge calls.
ContextData
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 
required
The source IP address of your user's device.
ServerName
string 
required
Your server endpoint where this API is invoked.
ServerPath
string 
required
Your server path where this API is invoked.
HttpHeaders
array[object (HttpHeader) {2}] 
required
HttpHeaders received on your server in same order.
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 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.
Examples

Responses

🟢200Success
application/json
Body
Responds to the authentication challenge, as an administrator.
ChallengeName
enum<string> 
optional
The name of the challenge. For more information, see AdminInitiateAuth.
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 AdminInitiateAuth.
AuthenticationResult
object 
optional
The result returned by the server in response to the authentication request.
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
🟠486InvalidPasswordException
🟠487UserLambdaValidationException
🟠488InvalidLambdaResponseException
🟠489TooManyRequestsException
🟠490InvalidUserPoolConfigurationException
🟠491InternalErrorException
🟠492MFAMethodNotFoundException
🟠493InvalidSmsRoleAccessPolicyException
🟠494InvalidSmsRoleTrustRelationshipException
🟠495AliasExistsException
🟠496PasswordResetRequiredException
🟠497UserNotFoundException
🟠498UserNotConfirmedException
🟠499SoftwareTokenMFANotFoundException
Modified at 2023-08-15 07:11:06
Previous
/
Next
/
Built with