# nodejs-jwt-validator

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

Latest version **0.1.11** (published 2024-08-16) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install nodejs-jwt-validator
pnpm add nodejs-jwt-validator
yarn add nodejs-jwt-validator
bun add nodejs-jwt-validator
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.11 |
| Published | 2024-08-16 |
| First published | 2020-09-15 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 25.3 KB |
| Known vulnerabilities | 0 (+33 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Progress |
| Maintainers | kerezov, tsvetan.milanov, tnikolov |

## Links

- npm: https://www.npmjs.com/package/nodejs-jwt-validator
- Repository: https://github.com/NativeChat/nodejs-jwt-validator
- Homepage: https://github.com/NativeChat/nodejs-jwt-validator#readme
- Issues: https://github.com/NativeChat/nodejs-jwt-validator/issues
- npm.io page: https://npm.io/package/nodejs-jwt-validator

## Dependencies (3)

- [axios](https://npm.io/package/axios.md) 1.7.4
- [jwk-to-pem](https://npm.io/package/jwk-to-pem.md) 2.0.4
- [jsonwebtoken](https://npm.io/package/jsonwebtoken.md) 9.0.0

## Recent versions

- 0.1.11 (latest) — 2024-08-16
- 0.1.2-dev (dev) — 2021-10-07
- 0.1.10 — 2024-07-02
- 0.1.8 — 2024-07-01
- 0.1.7 — 2024-06-10
- 0.1.6 — 2024-02-06
- 0.1.5 — 2023-01-30
- 0.1.4 — 2022-06-01
- 0.1.3 — 2022-05-05
- 0.1.2 — 2021-10-13
- 0.1.1 — 2021-03-23
- 0.1.0 — 2020-09-18
- 0.1.0-dev4 — 2020-09-17
- 0.1.0-dev3 — 2020-09-15
- 0.1.0-dev2 — 2020-09-15
- … 1 more at https://npm.io/package/nodejs-jwt-validator/versions

## README

# 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
```TypeScript
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);
```

---
_Source: https://npm.io/package/nodejs-jwt-validator · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
