Signing up for the ReactJS app
In the previous chapter, we created the sign-up and sign-in form with the Amplify UI. Now, we will make a small modification to the original code.
Let's open the App.jsx
file and replace the entire original code with the following code. We will use the withAutenticator
component this time:
- Import the
withAuthenticator
andAmplifySignOut
Amplify UI components to keep the code simple and lean. Then, import theAuth
Amplify library:import React from 'react'; import './App.css'; import Amplify, { Auth } from 'aws-amplify'; import { AuthState, onAuthUIStateChange } from '@aws-amplify/ui-components'; import { withAuthenticator, AmplifySignOut } from '@aws-amplify/ui-react'; import awsExports from "./aws-exports"; Amplify.configure(awsExports);
- Make sure that you configure the
authenticationFlowType
parameter with theUSER_PASSWORD_AUTH
value. This tells the Cognito service to use...