eduardo3g / cognito-token-generator

Utility script to authenticate users on AWS Cognito User Pool and return a Bearer token.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Util - Cognito Authenticator

Simple and useful script to generate user token with Cognito.

How to do it

Install the dependencies.

npm install

Create a .env file based on the .env.example.

cp .env.example .env

Update the Client ID, User Pool ID, User Pool region, user name and password.

Now, run the index.js file to generate the token.

node index.js

What if it fails?

It's important to remember that the flow ADMIN_USER_PASSWORD_AUTH needs to be enabled in the Cognito's app client configuration.

Ask your AWS administrator to:

  • Open Cognito;
  • On the left menu, click on App clients;
  • Click on Show Details;
  • Under Auth Flows Configuration, enable the first option (ADMIN_USER_PASSWORD_AUTH);

About

Utility script to authenticate users on AWS Cognito User Pool and return a Bearer token.


Languages

Language:JavaScript 82.5%Language:Shell 17.5%