For Users to SignIn to the App, we need to setup AWS User Pool. All the users will be registered automatically to this Pool. We will create a Custom Auth Pool with SMS & Email verification as the verification methods.
Refer to the Steps below to add the Auth User pool for your App.
STEP 1: #
- Sign in to the AWS Console, Navigate/Search for Amazon Cognito
- Click on “User pools“
- Select the “Server Location/Region” where your App Database is/will be hosted.
- Click on “Create user pool“
![](https://docs.tctech.in/wp-content/uploads/2023/12/ca_1-1024x207.png)
STEP 2: #
- Select “Cognito user pool” as Provider types
- Select “Email“, “Phone number” as Sign in options
- Click Next
![](https://docs.tctech.in/wp-content/uploads/2023/12/ca_2-1024x497.png)
STEP 3: #
Select all the options as shown below:
![](https://docs.tctech.in/wp-content/uploads/2023/12/ca_3-876x1024.png)
STEP 4: #
- “Enable self-registration” must be checked
- “Allow Cognito to automatically……..” must be un-checked
- Add “website” as Additional required attributes (Needed for passing Auth metaData while Sign In)
- Click Next
![](https://docs.tctech.in/wp-content/uploads/2023/12/ca_4-833x1024.png)
STEP 5: #
- Select “Send email with Cognito” as Email Provider
- Select “Create a new IAM role“
- Set role name as – “AppSMSRole“
- Select the SNS Region (the region where your app database is/will be hosted. SNS will only work if it is migrated to Production mode from Sandbox mode in the same region)
![](https://docs.tctech.in/wp-content/uploads/2023/12/ca_5-800x1024.png)
STEP 6: #
- Set “CustomAuthenticationPool” as User pool name
- Select “Public Client” as App type
- Set “CustomAuthClient” as App client name
- Click on “Don’t generate a client secret“
Click Next
![](https://docs.tctech.in/wp-content/uploads/2023/12/ca_6-808x1024.png)
STEP 7: #
Click on “Create user pool“
![](https://docs.tctech.in/wp-content/uploads/2023/12/ca_7-793x1024.png)
STEP 8: #
User pool will be created successfully. You can find this in:
AWS Console –> Amazon cognito –> User pools –> “CustomAuthenticationPool“, (NOTE: You should be in the same AWS region from the top right region selector)
Click on “CustomAuthenticationPool“
![](https://docs.tctech.in/wp-content/uploads/2023/12/ca_8-1024x369.png)
STEP 9: #
- Go to “App Integration” tab
- Click on “CustomAuthClient” located at the bottom
![](https://docs.tctech.in/wp-content/uploads/2023/12/ca_9-941x1024.png)
STEP 10: #
Click on “Edit” to edit Client Information
![](https://docs.tctech.in/wp-content/uploads/2023/12/ca_10-1024x490.png)
STEP 11: #
- App client name should be “CustomAuthClient“
- Uncheck other options & check only “ALLOW_CUSTOM_AUTH” as Authentication Flows (since we will be using SMS/Email Registration in App)
- Click “Save changes“
![](https://docs.tctech.in/wp-content/uploads/2023/12/ca_11-723x1024.png)
👏 Congratulations! Custom Auth User Pool setup is completed.
STEP 12: [Copy Credentials] #
Copy “Client ID” and use it in the App wherever AWS_AUTH_APP_CLIENT_ID is required in the source code.
![](https://docs.tctech.in/wp-content/uploads/2023/12/ca_12-1024x490.png)
STEP 13: #
Navigate to AWS Console –> Amazon cognito –> User pools –> “CustomAuthenticationPool“, click on it to view its details
![](https://docs.tctech.in/wp-content/uploads/2023/12/ca_13-1024x369.png)
STEP 14: [Copy Credentials] #
- Copy “User pool ID” and paste into the source code for AWS_AUTH_POOL_ID field
- Copy “your-aws-region” as shown below and paste into the source code for AWS_AUTH_POOL_ID field
![](https://docs.tctech.in/wp-content/uploads/2023/12/ca_14-1024x523.png)