hokaccha/node-jwt-simple
hokaccha/node-jwt-simple has 1,356 GitHub stars and 138 forks. GitHot measured 0 stars in 24 hours. Last checked 2026-11-07 07:24 UTC. Last push 2026-10-30.
JWT(JSON Web Token) encode and decode module for node.js
Measured star growth
- in 24h
- 0
- in 7 days
- Update delayed
- in 15 days
- Update delayed
- in 1 month
- Update delayed
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
Originaljwt-simple
[!WARNING] This project is no longer maintained. No further updates or security fixes will be provided. Please migrate to an actively maintained library such as jose or jsonwebtoken.
If you continue to use jwt-simple, always pass the expected algorithm to
jwt.decode(e.g.jwt.decode(token, key, false, 'RS256')) instead of relying on thealgheader of the token.
JWT(JSON Web Token) encode and decode module for node.js.
Install
$ npm install jwt-simple
Usage
let jwt = require('jwt-simple');
let payload = { foo: 'bar' };
let secret = 'xxx';
// HS256 secrets are typically 128-bit random strings, for example hex-encoded:
// let secret = Buffer.from('fe1a1915a379f3be5394b64d14794932', 'hex')
// encode
let token = jwt.encode(payload, secret);
// decode
let decoded = jwt.decode(token, secret);
console.log(decoded); //=> { foo: 'bar' }
decode params
/*
* jwt.decode(token, key, noVerify, algorithm)
*/
// decode, by default the signature of the token is verified
let decoded = jwt.decode(token, secret);
console.log(decoded); //=> { foo: 'bar' }
// decode without verify the signature of the token,
// be sure to KNOW WHAT ARE YOU DOING because not verify the signature
// means you can't be sure that someone hasn't modified the token payload
let decoded = jwt.decode(token, secret, true);
console.log(decoded); //=> { foo: 'bar' }
// decode with a specific algorithm (not using the algorithm described in the token payload)
let decoded = jwt.decode(token, secret, false, 'HS256');
console.log(decoded); //=> { foo: 'bar' }
Algorithms
By default the algorithm to encode is HS256.
The supported algorithms for encoding and decoding are HS256, HS384, HS512 and RS256.
// encode using HS512
jwt.encode(payload, secret, 'HS512')
Explore related projects
freeCodeCamp/freeCodeCamp
freeCodeCamp.org's open-source codebase and curriculum. Learn math, programming, and computer science for free.
458,715 starsdonnemartin/system-design-primer
Learn how to design large-scale systems. Prep for the system design interview. Includes Anki flashcards.
377,243 starsreact/react
The library for web and native user interfaces.
252,361 starsvuejs/vue
This is the repo for Vue 2. For Vue 3, go to https://github.com/vuejs/core
212,631 stars