0.1.11 • Published 10 months ago

nodejs-jwt-validator v0.1.11

Weekly downloads
2,978
License
Apache-2.0
Repository
github
Last release
10 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.10

12 months ago

0.1.11

10 months ago

0.1.8

12 months ago

0.1.7

1 year ago

0.1.6

1 year ago

0.1.5

2 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2-dev

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

5 years ago

0.1.0-dev4

5 years ago

0.1.0-dev3

5 years ago

0.1.0-dev2

5 years ago

0.1.0-dev1

5 years ago