Closed Deepesh316 closed 6 months ago
Try resending login details.
is there a solution? Cognito seems very immature and committing to it a mistake.
With OTP codes we work around it like this.
We send a custom challenge answer that contains metadata which indicates the code should be resend.
const askToResendOtpCode = async () => {
const cognitoUser = await Auth.sendCustomChallengeAnswer(session, '0', {'resend': 'yes'})
alert("OTP code has been resend. Give it a minute.")
}
Then in your create challenge trigger lambda function check the metadata on the request:
const shouldResendCode = event.request.clientMetadata?.resend === 'yes' ? true : false;
...
if(shouldResendCode){
console.log("Asked to resend the code, will do")
await sendSms(phoneNumber, secretLoginCode)
}
...
This way the client has the option to ask for the code to be send again.
@Nxtra Which AWS cognito API endpoint did you use for this? The logic that you shared, did you write this in the lambda triggers?
2 years later and this hasn't been resolved
Any update, guys?
Same, would appreciate a method like resendMFaCode. Right now have to reauthenticate the user to trigger another code.
+1
+1 Following
Is your feature request related to a problem? Please describe. I have been searching for resending mfa code (via SMS) for login process in aws-sdk. But not able to find any possible method for implementing the same.
Requirement: 1) MFA is set to required in cognito.( through SMS ) 2) User enters Login username and password 3) User is redirected to Verify MFA code page 4) Now comes the edge case where user doesn't receives code on phone due to network issues or some other issues. Hence we need to provide user with option to resend MFA code
As per my understanding from the documentation, resend OTP is possible for signup. resend-otp-for-signup
Describe the solution you'd like A way to re-send MFA Code due to some edge case a user does not receive code in the initial signIn flow. We need a similar functionality like resendConfirmationCode.