Created
February 7, 2015 10:19
-
-
Save PavelDemyanenko/bc7ea80491cfbf5439a8 to your computer and use it in GitHub Desktop.
jwt service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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