In this video I am going to show you how to implement AWS Cognito login and registration in React JS. This is an essential use case whenever you are using AWS Cognito together with React to build a web application.
The video will show you step by step how to create the necessary infrastructure as well, so we’re going to deploy a Cognito User Pool (with App Client), a CloudFront distibution with an S3 origin using AWS SAM. After the infrastructure is deployed we implement the login and registration and then add some additional fields like family_name, given_name and email.
After this is done we’re adding the code to retrieve the JWT token and display it. Finally we build and upload the static website to the S3 bucket which serves as the origin for the CDN (CloudFront Distribution).
The full code can be found in this GitHub repo: https://github.com/majestic-cloud/react-cognito
Also if you are curious how to create a Cognito User Pool manually using the
AWS Console and use the JWT token to secure an API Gateway then you can watch my video on that: https://www.youtube.com/watch?v=LI31QxfAgho