Created
August 3, 2017 13:35
-
-
Save travist/cc3509423c2eda7d37abce53349d268d to your computer and use it in GitHub Desktop.
Form.io External JWT Token Generation
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
/** | |
* This code does require our Docker deployment where the "JWT_SECRET" would be the | |
* same secret of the environment variable when the docker is spun up. | |
*/ | |
var jwt = require('jsonwebtoken'); | |
var token = jwt.sign({ | |
external: true, | |
form: { | |
_id: '59795d259be16e3ee58fddaa', | |
project: '59795d259be16e3ee58fdda6' | |
}, | |
user: { | |
_id: 'external', | |
roles: [ | |
'59795d259be16e3ee58fdda7' | |
] | |
} | |
}, 'JWT_SECRET'); | |
console.log(token); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment