https://github.com/damiancipolat/authflow-nodejs-cognito
Integration between cognito and Node.js to create an authentication flow for a web site.
https://github.com/damiancipolat/authflow-nodejs-cognito
auth aws aws-sdk cognito cognito-user-pool es6 nodejs
Last synced: 3 months ago
JSON representation
Integration between cognito and Node.js to create an authentication flow for a web site.
- Host: GitHub
- URL: https://github.com/damiancipolat/authflow-nodejs-cognito
- Owner: damiancipolat
- Created: 2019-02-18T22:46:30.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-02-16T13:30:14.000Z (over 3 years ago)
- Last Synced: 2025-03-24T10:21:14.982Z (over 1 year ago)
- Topics: auth, aws, aws-sdk, cognito, cognito-user-pool, es6, nodejs
- Language: JavaScript
- Size: 239 KB
- Stars: 2
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Auth flow using cognito
- Amazon Cognito lets you add user sign-up, sign-in, and access control to your web and mobile apps quickly and easily.
- How to use?: we can use cognito throw the aws-sdk.
- I used this link: https://medium.com/@prasadjay/amazon-cognito-user-pools-in-nodejs-as-fast-as-possible-22d586c5c8ec as reference.
- I recommend this fake email generator website: https://getnada.com/msg
## Server & serverless
We can use cognito in a full serverless architecture (using lambda functions) or using a server in this example, we will work with an api rest server created with NODEJS.
### With classic server:

### Serverless:

## Using Node.js:
In this repository you can download a nodejs server that allows as to communicate with aws cognito, allowing as to implement a authentication workflow.
**To install:**
```sh
$ npm install
```
**To run:**
```sh
$ npm start
```
**To test:**
Load in Post man the JSON file "Auth flow.postman_collection.json" to test the server.
Server functionalities:
- Login
- Signup user
- Verify tokens
- Renew token
- Change password
The signup workflow is very interesting, I attach a diagram of how function:

1) The user make a signup request to the server.
2) Cognito receives the user data, and sent to them an activation link, depends the setup that we choose, you can handle by differents ways.
3) The use click the action link in the email.
4) The browser go to the activarion url and cognito, set
as verified the user.