1.0.2 • Published 5 years ago

aws-cognito-verify-token v1.0.2

Weekly downloads
12
License
IMT
Repository
github
Last release
5 years ago

aws-cognito-verify-token

validate cognito token using nodejs

Install

npm i aws-cognito-verify-token --save 
yarn add aws-cognito-verify-token

and you need also to set (USER_POOL, region, AppClient) in your env varibales.

Example

You can passed the jwt token generate by coginto in your front application with the function verifyToken , this function will call cognito (!USER_POOL, !region, !AppClient) to verify is this tokent is valide, if the verification is okey this function will output the user informations.

const { verifyToken } = require("aws-cognito-verify-token");

exports.handler = async event => {
  const { httpMethod, path, headers } = event;
  let { authorization } = headers;
  let cognitoData = {};
  if (authorization) {
    cognitoData = await verifyToken(authorization);
  }
  console.log('cognitoData',cognitoData);
    
}
1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago