Amplify-js: Resend MFA Code API

Created on 28 Aug 2020  路  8Comments  路  Source: aws-amplify/amplify-js

Is your feature request related to a problem? Please describe.
Our workflow

MFA is set to required in cognito.( through SMS )
User enters Login username and password
user is redirected to Verify MFA code page
Now comes the edge case where user doesn't receives code on phone due to network issues
Hence we need to provide user with option to resend MFA code

Describe the solution you'd like
A way to re-send MFA Code due to some edge cause a user does not receive code in the initial signIn flow.
A similar hook to Auth.resendSignUp() but for MFA Code

Describe alternatives you've considered
Calling the Auth.SignIn() to re send MFA Code. This is not ideal because signIn requires username and password.

Auth feature-request question

Most helpful comment

This has been an issue for us for quite some time. I don't like having to hold on to a password in order to call Auth.signIn again for this feature, and asking users to sign in again is really clunky.

All 8 comments

@aoloo

doing Auth.signIn(..) will resend the code, in that case you will need to store in memory the username and password for that purpose.

@elorzafe @amhinson we are currently implementing that, but the authentication code does not always get sent. There some instances where calling Auth.signIn() does not work.

try {
  const user = await Auth.signIn(username,password);
} catch (err) {
   `Code was not sent successfully!`
 }

This is my current implementation within a on click event when a user clicks a resend-mfa code on a form. It will be really nice to have a resendMFA api call. This can benefit the community implementing MFA.

@elorzafe Just to note when calling Auth.signIn it returns {"__type":"CodeMismatchException","message":"Invalid code or auth state for the user."}. So it is crucial that we have an api for re sending mfa authentication code.

Seconding! This is an issue for me as well. Would be great if I could resend confirmation codes, without having to make users re-sign in.

Yeah, also seeing this. We'll workaround with posting to Auth.logIn again, but it does feel like there ought to be an api method for this - it's the only part of the sign up/sign in/reset password etc... workflows that doesn't have a re-send.

This has been an issue for us for quite some time. I don't like having to hold on to a password in order to call Auth.signIn again for this feature, and asking users to sign in again is really clunky.

@harrysolovay @elorzafe any movement on this?

Has anyone heard any update on this issue?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

leantide picture leantide  路  3Comments

callmekatootie picture callmekatootie  路  3Comments

cgarvis picture cgarvis  路  3Comments

rygo6 picture rygo6  路  3Comments

cosmosof picture cosmosof  路  3Comments