aws-amplify / amplify-ui

Amplify UI is a collection of accessible, themeable, performant React (and more!) components that can connect directly to the cloud.
https://ui.docs.amplify.aws
Apache License 2.0
913 stars 295 forks source link

[FR] Email OTP challenge not handled by Authenticator component #5829

Open goatcube opened 1 month ago

goatcube commented 1 month 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?

Create React App

What browsers are you seeing the problem on?

Chrome

Which region are you seeing the problem in?

No response

Please describe your bug.

In an app using the Authenticator component, when Advanced security is enabled for a Cognito user pool and email MFA is required, attempts to login result in the following error message being displayed:

An error occurred during the sign in process. EMAIL_OTP challengeName returned by the underlying service was not addressed.

What's the expected behaviour?

When there is an email OTP challenge, the user is prompted to enter the code that is sent via email and no error messages are displayed.

Help us reproduce the bug!

  1. Enable Advanced security for a Cognito user pool
  2. Require email messages MFA option
  3. In the app, enter email and password, click Sign in.

The following error message is displayed:

An error occurred during the sign in process. EMAIL_OTP challengeName returned by the underlying service was not addressed.

Code Snippet

// Put your code below this line.
import { Amplify } from "aws-amplify";

import { Authenticator } from "@aws-amplify/ui-react";
import "@aws-amplify/ui-react/styles.css";

import awsExports from "./aws-exports";
Amplify.configure(awsExports);

export default function App() {
  return (
    <Authenticator>
      {({ signOut, user }) => (
        <main>
          <h1>Hello {user.username}</h1>
          <button onClick={signOut}>Sign out</button>
        </main>
      )}
    </Authenticator>
  );
}

Console log output

No response

Additional information and screenshots

No response

calebpollman commented 1 month ago

Hi @goatcube, thanks for opening this. Marking as a feature request for the Authenticator, adding support for Email OTP is something we are interested in

msudol commented 1 month ago

Hi @goatcube, thanks for opening this. Marking as a feature request for the Authenticator, adding support for Email OTP is something we are interested in

I just ran into this exact same issue and found this thread on it. So, e-mail MFA isn't currently supported with amplify (authenticator)?

cwomack commented 1 month ago

@msudol, email MFA is not currently supported in the Authenticator component. However, the amplify-js repo is tracking this in a related feature request (Issue #13837). The support for this will likely be released sooner for the JS API's, but we'll update this issue with progress as it's made for the Authenticator component as well.