Reputation: 193
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