Skip to content

Instantly share code, notes, and snippets.

@QuatoHub
Created November 23, 2021 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save QuatoHub/da45b721d68701ec97b8d9170985f2a2 to your computer and use it in GitHub Desktop.
Save QuatoHub/da45b721d68701ec97b8d9170985f2a2 to your computer and use it in GitHub Desktop.
const jwt = require('jsonwebtoken');
const userInfo = {id: 1, username: 'inyong'};
const secretKey = 'SeCrEtKeYfOrHaShInG';
const options = {expiresIn: '7d', issuer: 'inyongTest', subject: 'userInfo'};
jwt.sign(userInfo, secretKey, options,
function(err,token){
if(err) console.log(err);
else console.log(token);
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment