Created
April 14, 2019 22:20
-
-
Save iskenxan/c8dcf798b4a5b9a4eabe6d9520814da0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
jwt = require('jsonwebtoken'); | |
const ADMINS = ['[email protected]']; | |
module.exports = function createToken(userEmail) { | |
let access = userEmail; | |
ADMINS.forEach(email => { | |
if (email === userEmail) | |
access = 'admin' | |
}); | |
const token = jwt.sign({ | |
access, | |
}, 'secret'); | |
return token; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment