DEV Community

Chris Wang
Chris Wang

Posted on

AWS Cognito Setup for User Authentication

AWS Cognito Overview

Amazon Cognito lets you add user sign-up, sign-in, and access control to your web and mobile apps quickly and easily. Amazon Cognito scales to millions of users and supports sign-in with social identity providers, such as Facebook, Google, and Amazon, and enterprise identity providers via SAML 2.0.

Let’s understand what is AWS Cognito User Pool and AWS Cognito Federal Identity

  • AWS Cognito User Pool
  • AWS Cognito Federated Identities

1. AWS Cognito User Pool

A User Pool is the user directory that you can configure for your web and mobile apps. A User Pool securely stores your users’ profile attributes. You can create and manage a User Pool using the AWS console, AWS CLI, or AWS SDK.

Create Cognito User Pool

  • Sign in/up to your AWS account from the Services drop-down menu select Cognito then you will see the following screen. Click to the User Pools Button in the left sidebar.

Cognito User Pool

  • Click on the Create user pool button.

Cognito User Pool

  • Select Authentication Providers Type

Cognito User Pool

  • Select Password policy mode and Multi-factor authentication type

Cognito User Pool

  • Select MFA methods(Authenticator apps or SMS message)

Cognito User Pool

  • Choose the attributes, and click next button.

Cognito User Pool

  • Select Email provider, and click next button.

Cognito User Pool

  • Enter User pool name.

Cognito User Pool

  • Check Use the Cognito Hosted UI, enter a domain prefix.

Cognito User Pool

  • Enter a friendly name for yhour app client, and enter a callback URLs.

Cognito User Pool

  • You will see the user pool has been created as shown below in the screenshot.

Cognito User Pool

  • Finally you can check the all of authentication work flow in the Cognito Hosted UI.

Cognito User Pool

2. AWS Cognito Federated Identities

Identity pools are the containers that Cognito Identity uses to keep your apps’ federated identities organized. Identity Pool associates federated identities from social identity providers with a unique user-specific identifier. Identity Pools do not store any user profiles. An identity pool can be associated with one or many apps. If you use two different identity pools for two apps then the same end user will have a different unique identifier in each Identity Pool.

Create Cognito Federated Identities

  • Click a Create new identity pool button as shown in the below screenshot.

Cognito User Pool

  • Enter the User Pool Id and App client id as shown in the below screenshot.

Cognito User Pool

  • Enter the User Pool Id and App client id as shown in the below screenshot.

Cognito User Pool

  • Then you can get the Identity pool Id as shown in the below screenshot

Cognito User Pool

I just done with AWS Cognito User Pool, Cognito Federated Identities setup.
In the next post, we will discuss how you're going to integrate Cognito with a Node.js & Express.js app.

References

https://chrisw.vercel.app/projects/node/cognito/started

Top comments (0)