Skip to content

Instantly share code, notes, and snippets.

@akumbhani66
Created July 24, 2020 10:33
Show Gist options
  • Save akumbhani66/95b2837f549060d4671d92057a9703af to your computer and use it in GitHub Desktop.
Save akumbhani66/95b2837f549060d4671d92057a9703af to your computer and use it in GitHub Desktop.
const jwt = require('jwt-simple');
const payload = {
"this is": "simple payload"
}
const secret = 'top-secret@2020';
// encode
const token = jwt.encode(payload, secret);
console.log(">>>>>", token);
// decode
const decoded = jwt.decode(
token,
secret
);
console.log(decoded); //=> { "this is": "simple payload" }%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment