AWS Cognito returns Invalid session token error when responding to SMS MFA right after responding to a NEW_PASSWORD_REQUIRED challenge

0

I'm working with a custom auth flow that follows this flow: SRP -> New password (if it's the user's first login) -> SMS MFA -> custom challenge to accept T&Cs

The flow works properly when there's no new password required step, but when I respond to the SMS_MFA challenge right after having changed the password in the NEW_PASSWORD_CHANGE challenge, I get this error: "Invalid session for the user, session can only be used once mfa cognito"

In the RespondToAuthChallange call that responds to the SMS_MFA challenge I'm passing the Session token that was returned by the NEW_PASSWORD_CHANGE response. I've also tried passing no Session token in the SMS_MFA request but that triggers an error stating that the Session field is missing. I also thought about returning the user to the initial login screen right after they change their password so that the auth flow is started from scratch, but I haven't found a way to stop the custom auth flow from sending the SMS OTP message after the new password change (the DefineAuthChallenge Lambda is only called after the SRP_A challenge and after the SMS_MFA challenge are responded to, the NEW _PASSWORD_CHANGE response doesn't trigger said lambda).

I'm using the Javascript v3 SDK.

질문됨 4달 전73회 조회
답변 없음

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠