atlassian-jwt
JWT (JSON Web Token) encoding & decoding library for node.js. Built of jwt-simple and adds Atlassian's custom QSH (query string hash) claim.
Install
$ npm install atlassian-jwt
Usage
var jwt = require('atlassian-jwt');
var payload = { foo: 'bar' };
var secret = 'xxx';
var token = jwt.encode(payload, secret);
var decoded = jwt.decode(token, secret);
console.log(decoded);
decode params
var decoded = jwt.decode(token, secret);
console.log(decoded);
var decoded = jwt.decode(token, secret, true);
console.log(decoded);
var decoded = jwt.decode(token, secret, false, 'HS256');
console.log(decoded);
Algorithms
By default the algorithm to encode is HS256
.
The supported algorithms for encoding and decoding are HS256
, HS384
, HS512
and RS256
.
jwt.encode(payload, secret, 'HS512')