user2160919
user2160919

Reputation: 193

AWS Cognito RespondToAuthChallengeRequest : Missing required parameter Session

As per the documentation - https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_RespondToAuthChallenge.html the session parameter is optional.

Map<String, String> challengeResponses = new HashMap<String, String>();

        challengeResponses.put("USERNAME", "username");
        challengeResponses.put("SMS_MFA_CODE","code");
        challengeResponses.put("SECRET_HASH", secretHash);

        RespondToAuthChallengeRequest respondToAuthChallengeRequest = new RespondToAuthChallengeRequest()
                .withChallengeName(ChallengeNameType.SMS_MFA).withClientId("client_id")
                .withChallengeResponses(challengeResponses);

        RespondToAuthChallengeResult respondToAuthChallengeResult = null;
            respondToAuthChallengeResult = cognitoClient.respondToAuthChallenge(respondToAuthChallengeRequest);

I keep on getting the below exception when I dont add a session parameter to the request.

**Missing required parameter Session (Service: AWSCognitoIdentityProvider; Status Code: 400; Error Code: InvalidParameterException; Request ID: ef8780a3-a5f3-4d54-aac5-2251deb7e932)**

Upvotes: 6

Views: 2275

Answers (1)

David Morales
David Morales

Reputation: 1

I recommend adding the session parameter as "null".

Upvotes: -1

Related Questions