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 次
沒有答案

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南