Skip to content

Instantly share code, notes, and snippets.

@PavelDemyanenko
Created February 7, 2015 10:19
Show Gist options
  • Save PavelDemyanenko/bc7ea80491cfbf5439a8 to your computer and use it in GitHub Desktop.
Save PavelDemyanenko/bc7ea80491cfbf5439a8 to your computer and use it in GitHub Desktop.
jwt service
var jwt = require('jsonwebtoken');
module.exports.issueToken = function(payload) {
var token = jwt.sign(payload, process.env.TOKEN_SECRET || "our biggest secret");
return token;
};
module.exports.verifyToken = function(token, verified) {
return jwt.verify(token, process.env.TOKEN_SECRET || "our biggest secret", {}, verified);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment