cognitoken-verifier
v0.0.21
Published
Verify AWS Cognito user pool JSON Web Token
Downloads
24
Readme
Cognitoken-Verifier
A class implementation to simplify the validation process of JWT generated by AWS Cognito as prescribed in https://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-user-pools-using-tokens-verifying-a-jwt.html
Install
npm install cognitoken-verifier
Usage
const { CognitokenVerifier } = require('cognitoken-verifier');
// Parameters for CognitoVerifier class
const appClientId = '<Enter app client Id of User Pool>';
const issuer = 'https://cognito-idp.<REGION>.amazonaws.com/<USERPOOLID>';
const verifier = new CognitokenVerifier(appClientId, issuer);
verifier.verify(['<Tokens>'], '<id/access>')
.then(payload=>{
//Verification Success
})
.catch(err=>{
// Verification Fail
// returns CognitokenError class
})