AWS Cognito Web Starter
A simple starter project for using AWS-Cognito SDK in the web browser.
About
This code takes the example code from the AWS Cognito JavaScript SDK, and implements it in the most simple way I know how: an HTML page with 1 JavaScript file. The purpose of this is to vet the service and API before implementing it in product.
./aws-cognito-web-starter/
├── LICENSE
├── index.css
├── index.html
└── index.js
Instructions
Checkout and Install
git clone [email protected]/f1lt3r/aws-congito-web-starter.git
cd aws-congito-web-starter
npm install
Serve Web Page (Optional)
Alternative: Try the Demo
npm install serve -g
serve
Open your browser to http://localhost:5000, or wherever you are serving your code.
Create your AWS Cognito User Pool
- Login into you AWS Console
- Create a Cognito User/Identity pool
- DO NOT ENABLE CLIENT SECRET WHEN CREATING YOUR POOL!
- Make sure email can be used as an alias (username)
- Take note of:
- Pool Id: General Settings
- App Client Id: App Integration > App Client Settings > ID
- Allow all custom attributes for this test
Follow the Forms
Follow the web forms from left to right.
- Configure your Pool and Client Ids
- For convenience, these are saved in sessionStorrage and are deleted when you close your tab
- Sign up a user
- Confirm registration code sent to email
- Authenticate the user and receive access token