rhewitt22 / node-jwt-simple

JWT(JSON Web Token) encode and decode module for node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

node-jwt-simple

JWT(JSON Web Token) encode and decode module for node.js.

Install

$ npm install jwt-simple

Usage

var jwt = require('jwt-simple');
var payload = { foo: 'bar' };
var secret = 'xxx';

// encode
var token = jwt.encode(payload, secret);

// decode
var decoded = jwt.decode(token, secret);
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')

About

JWT(JSON Web Token) encode and decode module for node.js

License:MIT License


Languages

Language:JavaScript 100.0%