0.1.6 • Published 3 months ago

nodejs-jwt-validator v0.1.6

Weekly downloads
2,978
License
Apache-2.0
Repository
github
Last release
3 months ago

nodejs-jwt-validator

NodeJS module which validates the signature and the claims of a JWT.

Description

This module was created following the documentation of AWS for verification of Cognito tokens: https://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-user-pools-using-tokens-verifying-a-jwt.html

and the example code from this repo: https://github.com/awslabs/aws-support-tools/blob/master/Cognito/decode-verify-jwt/decode-verify-jwt.ts

Example

import { JwtValidator } from "nodejs-jwt-validator";
import { IJwtValidatorConfig } from "nodejs-jwt-validator/declarations/declarations";

const clientId = "my-client-id";
const issuerUrl = "https://my-issuer.com/";
const tokenUse = "access";

const config: IJwtValidatorConfig = { issuerUrl, clientId, tokenUse };

const validator = new JwtValidator(config);

const token = "my-jwt";
// Validate the signature of the token and the exp, iss and token_use claims.
const result = await validator.validateToken(token);
console.log(result);
0.1.6

3 months ago

0.1.5

1 year ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2-dev

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

4 years ago

0.1.0-dev4

4 years ago

0.1.0-dev3

4 years ago

0.1.0-dev2

4 years ago

0.1.0-dev1

4 years ago