Verify AWS serverless cognito jwt tokens.
npm install node-aws-verify-jwt
import { getPayload, verifyJWT } from 'node-aws-verify-jwt';
//Verify integrity of the token and return the payload.
const payload = await getPayload({
jwtToken,
region,
userPoolID,
});
//Verify the token and validate claims.
const valid = await verifyJWT({
jwtToken,
region,
userPoolID,
claims: {
client_id: '22vik2co81f7reethfbm8sfat5b',
exp: (val) => val > ~~(+new Date/1000)
},
});
npm run build
Runs babel src --out-dir lib
npm run test
Runs jest