'AWS Amplify Auth: How to disable AmplifyConfirmSignUp?
I'm currently using AWS Amplify auth, using Cognito for React authentication. User sign-ups must confirm their new account by clicking on a confirmation link they receive via email.
When a submits their sign-up info, the next UI that is displayed is Confirm Signup that asks the user to confirm a code. I do not need this stage, as this is handled when the user confirms their email.
I'm using the react-ui Amplify components to control authentication and user signup/in/out.
import React from "react";
import "./App.css";
import { BrowserRouter as Router } from "react-router-dom";
import "bootstrap/dist/css/bootstrap.min.css";
import { Container } from "react-bootstrap";
import NavBar from "./components/NavBar.js";
import {
AmplifyAuthenticator,
AmplifySignUp,
AmplifyConfirmSignUp,
AmplifySignOut,
} from "@aws-amplify/ui-react";
import RouteContainer from "./components/RouteContainer";
function App() {
return (
<div>
<AmplifyAuthenticator usernameAlias="email">
<AmplifySignUp
slot="sign-up"
usernameAlias="email"
formFields={[
{
type: "email",
label: "Enter your email",
placeholder: "Enter your email",
required: true,
},
{
type: "password",
label: "Enter your password",
placeholder: "",
required: true,
},
{
type: "custom:postcode",
label: "Enter your postcode",
placeholder: "",
required: true,
},
]}
>
<AmplifyConfirmSignUp/>
</AmplifySignUp>
<AmplifySignOut />
<Router>
<Container>
<RouteContainer />
</Container>
</Router>
<NavBar />
</AmplifyAuthenticator>
</div>
);
}
export default App;
Is there a prop I can pass to disable <AmplifyConfirmSignUp/> or another way to disable this from the standard sign-up flow?
Thanks.
Solution 1:[1]
You can disable verification in Cognito panel.
- Go to https://console.aws.amazon.com/cognito/
- Click on "Manage User Pools"
- In "General settings" click on "MFA and verifications"
- Under "Which attributes do you want to verify?" choose "No verification"
Solution 2:[2]
You can auto-confirm the user using a lambda function. Here's the documentation
- Create a lambda function (See Docs) and return
autoConfirmUserin the response.
exports.handler = async (event, _context, callback) => {
console.log(`EVENT: ${JSON.stringify(event)}`);
event.response.autoConfirmUser = true;
callback(null, event);
};
- Attach your lambda function with the Pre Sign-up Lambda Trigger
There's one caveat though, if the user forgets his/her password. He wouldn't be able to recover it. So keep it in mind. Here's more about this on Github
I hope it helps :)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | MarkoR |
| Solution 2 |

