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

Unable to Implement Email-Based MFA Authentication #13929

Closed arpita3112 closed 1 month ago

arpita3112 commented 1 month ago

Before opening, please confirm:

JavaScript Framework

React

Amplify APIs

Authentication

Amplify Version

v6

Amplify Categories

auth

Backend

None

Environment information

``` # Put output below this line ```

Describe the bug

We are trying to implement MFA (Multi-Factor Authentication) using email-based authentication. We have followed the steps and configured the SDK as per the official documentation: https://docs.amplify.aws/javascript/start/connect-to-aws-resources/

However, we are still encountering the following error: signInHelpers.ts:611 Uncaught (in promise) SignInException: An error occurred during the sign in process. EMAIL_OTP challengeName returned by the underlying service was not addressed. at getSignInResult (http://localhost:3000/static/js/bundle.js:85307:9) at signInWithSRP (http://localhost:3000/static/js/bundle.js:82737:85) at async loginBtnClick (http://localhost:3000/main.a99b129….hot-update.js:67:9)

We have reviewed the guide but could only find information related to SMS or TOTP-based MFA: https://docs.amplify.aws/react/build-a-backend/auth/concepts/multi-factor-authentication/#enable-totp-after-a-user-is-signed-in

We also tried implementing the functionality using amplify/ui-react, but the error persists.

We are using the SDK version : aws-amplify : v6.6.5

Is there a way to achieve email-based MFA with the above setup? Any guidance or solutions would be greatly appreciated.

Expected behavior

Complete the sign-in process without errors after the correct OTP is entered.

Reproduction steps

1) First, install the SDK and configure it with Cognito.
2) After that, call the signIn method from the SDK and pass the email and password.

Code Snippet

  Amplify.configure({
          Auth: {
            Cognito: {
              userPoolId: get(authcredetilas, "userPoolId", null),
              region: get(authcredetilas, "region", null),
              userPoolClientId: get(
                authcredetilas,
                "userPoolWebClientId",
                null
              ),
              identityPoolId: get(authcredetilas, "identityPoolId", null),
              loginWith: {
                email: true,
              },
            },
          },
        });

And

await signIn({
      username: "****",
      password: "****",
    })

Log output

``` // Put your logs below this line ```

aws-exports.js

No response

Manual configuration

No response

Additional configuration

No response

Mobile Device

No response

Mobile Operating System

No response

Mobile Browser

No response

Mobile Browser Version

No response

Additional information and screenshots

No response

arpita3112 commented 1 month ago

@cwomack Is there any update on this?

cwomack commented 1 month ago

Hello, @arpita3112 👋. This feature was released by Cognito recently and we are actively working on this feature to be supported within Amplify. We're tracking this feature request in #13837 as well as #5829 on the amplify-ui repo for support on the Authenticator connected component. You can also keep an eye on this feature branch in particular.

Please follow those issues for updates and progress as it's made, and I'll close this one out as a duplicate.

sators commented 1 month ago

Following