var jwt = require('jsonwebtoken');
var token = jwt.sign({ foo: 'abcd' }, 'shhhhh');
console.log(token);
Giải mã token
var jwt = require('jsonwebtoken');
var token = jwt.sign({ foo: 'abcd' }, 'shhhhh');
var decoded = jwt.verify(token, 'shhhhh');
console.log(decoded);
decode token
var jwt = require('jsonwebtoken');
var token = jwt.sign({ foo: 'abcd' }, 'shhhhh');
// var decoded = jwt.verify(token, 'shhhhh');
var decoded = jwt.decode(token);
console.log(decoded);
var jwt =require('jsonwebtoken');var token =jwt.sign({ foo:'abcd' },'shhhhh');console.log(token);// ==var decoded =jwt.verify(token,'shhhhh');console.log(decoded);
get the decoded payload and header
var jwt = require('jsonwebtoken');
var token = jwt.sign({ foo: 'abcd' }, 'shhhhh');
// var decoded = jwt.verify(token, 'shhhhh');
// var decoded = jwt.decode(token);
// // get the decoded payload and header
var decoded = jwt.decode(token, {complete: true});
console.log(decoded);