The AWS Amplify Authentication module provides Authentication APIs and building blocks for developers who want to create user authentication experiences.
Amazon Cognito User Pools is a full-featured user directory service to handle user registration, authentication, and account recovery. Amazon Cognito Federated Identities on the other hand, is a way to authorize your users to use AWS services.
Amplify interfaces with User Pools to store your user information, including federation with other OpenID providers like Facebook & Google, and it leverages Federated Identities to manage user access to AWS Resources, for example allowing a user to upload a file to an S3 bucket. The Amplify CLI automates the access control policies for these AWS resources as well as provides fine grained access controls via GraphQL for protecting data in your APIs.
Use the Amplify CLI to create a new Cognito User Pool using the default settings. Once your User Pool is created and associated to the web application, you’ll use the Amazon Cognito Console to manage the new User Pool.
✅ Step-by-step directions
Execute the following commands to add the Amazon Cognito User Pool:
amplify add auth
The AWS Amplify CLI will now run through the set up for Amazon Cognito, select the folowing:
> Do you want to use the default authentication and security configuration? "Default configuration" > How do you want users to be able to sign in? "Username" > Do you want to configure advanced settings? "No, I am done."
Once the configuration has completed you will see the following confirmation:
Now you will build all your local amplify backend resources and provision it in the cloud but executing the following command:
✔ Successfully pulled backend environment prod from the cloud. Current Environment: prod | Category | Resource name | Operation | Provider plugin | | -------- | ----------------- | --------- | ----------------- | | Auth | wildrydesdb4634d6 | Create | awscloudformation | ? Are you sure you want to continue? Yes ⠇ Updating resources in the cloud. This may take a few minutes...
When Propted “Are you sure you want to continue?” enter
y and press return.
Next you will See how the AWS Amplify CLI has configured the web application to use this userpool.