https://github.com/pushpabrol/auth0-cognito-custom-db
custom database connection scripts for cognito in Auth0
https://github.com/pushpabrol/auth0-cognito-custom-db
auth0 cognito cognito-user-pool custom-database migration
Last synced: about 1 month ago
JSON representation
custom database connection scripts for cognito in Auth0
- Host: GitHub
- URL: https://github.com/pushpabrol/auth0-cognito-custom-db
- Owner: pushpabrol
- Created: 2020-02-17T15:42:53.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-02-17T15:48:20.000Z (over 6 years ago)
- Last Synced: 2025-06-27T10:08:17.144Z (11 months ago)
- Topics: auth0, cognito, cognito-user-pool, custom-database, migration
- Language: JavaScript
- Size: 1.95 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Custom database connection with Cognito & Migration turned on
This repo contains the files and insturctions required to setup Cognito as a custom database connection with Auth0.
## Cognito Setup
- Create a user pool in aws cognito
- For this user pool create an app client
- This client should have no client secret
- Make sure to check `Enable username password auth for admin APIs for authentication (ALLOW_ADMIN_USER_PASSWORD_AUTH)`
- Make sure to select `Legacy` under `Prevent User Existence Errors`
- Make a note of the following properties
- `UserPoolId` - ID of the user pool
- `ClientID` - Client ID of the application created above
- `region` - AWS Region
- `accessKeyId` - Access Key ID
- `secretAccessKey` - Secret Access Key
## Auth0 Setup
- Create a database connection
- Create a custom database connection and choose the name you want to use for it
- Turn on the toggle `Use my own database` under the `Custom Database` tab
- Under the database `settings` tab turn on toggles for
- `Requires Username`
- `Import Users to Auth0` - This enables migration at login with Cognito
- Go back to the `Custom Database` tab
- Copy contents of `auth0LoginDirect.js` under the `Login` script
- Copy contents of `auth0GetUserDirect.js` under the `Get User` script
- Make sure you save both the scripts above
- Remain on the same tab and scroll down to `settings`
- Set the Confgiuration variables
- accessKeyId : your access key for AWS
- secretAccessKey: your secret key for AWS>
- region : region of aws
- UserPoolId : Id of the User Pool
- ClientId : client id of the app created in cognito
- At this point you have everything setup for the connection
- Enable the connection in Auth0 by enabling this connection on an application
- Test login and get user scripts