aws-amplify / amplify-js

A declarative JavaScript library for application development using cloud services.
https://docs.amplify.aws/lib/q/platform/js
Apache License 2.0
9.44k stars 2.13k forks source link

Can't send the MFA token when user has both of SMS MFA method and Software Token MFA method #13962

Open KimThanh27920 opened 4 weeks ago

KimThanh27920 commented 4 weeks ago

Before creating a new issue, please confirm:

On which framework/platform are you having an issue?

React

Which UI component?

Authenticator

How is your app built?

React App

What browsers are you seeing the problem on?

Chrome, Microsoft Edge

Which region are you seeing the problem in?

No response

Please describe your bug.

When user has multiple MFA methods, I try to send MFA code with type SOFTWARE_TOKEN_MFA, it always return invalid code error

What's the expected behaviour?

I believe the function should execute successfully and return my token.

Help us reproduce the bug!

Set up both of SMS MFA and Software Token MFA for the user, login normally and enter correct Software Token Code. It return invalid code error

Code Snippet

cognitoUser.sendMFACode(
          verifyCode,
          {
            onSuccess: () => {
               updateChallengeScreen();
               clearLoginProcessCookies();
              setIsSubmitting(false);
            },
            onFailure: function (err) {
              handleSessionExpired(err.message);
              setIsSubmitting(false);
            },
          },
          MFA_TYPE.SOFTWARE_TOKEN_MFA
        );

Console log output

No response

Additional information and screenshots

No response

jacoblogan commented 3 weeks ago

@KimThanh27920 Thank you for bringing this issue to our attention. Transferring the issue to aws-amplify/amplify-js repo that handles the underlying functions used by the authenticator component where the error message originates.

HuiSF commented 18 hours ago

Hi @KimThanh27920 Thanks for opening this issue. Could you post the packages and versions listed in the package.json of your project?