A simple, exportable function for getting the payload from a JWT (JSON Web Token).
$ npm install jwt-payload-decoder --saveRequire the package in your application:
var jwtPayloadDecoder = require('jwt-payload-decoder')Then get the payload like so:
var payload = jwtPayloadDecoder.getPayload(token)
var user = {
email: payload.email,
name: payload.name
}