Last active
January 18, 2019 14:34
-
-
Save dimitrisdovinos/c13e98126ee2f025ad4aab0270fb6b6c to your computer and use it in GitHub Desktop.
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
const jwt = require('jsonwebtoken'); | |
function generateAuthToken(user) { | |
const token = jwt.sign( | |
{ | |
id: user.id, | |
email: user.email, | |
firstName: user.firstName, | |
lastName: user.lastName, | |
avatarUrl: user.avatarUrl, | |
bannerUrl: user.bannerUrl, | |
isApproved: user.isApproved, | |
role: user.role, | |
}, | |
config.secret, | |
); | |
return token; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment