Answers for "generate a jwt token secret in node js"

0

generate a jwt token secret in node js

const jwt = require('jsonwebtoken');

const jwt_secret = require('crypto').randomBytes(64).toString('hex');

// preferably store and use jwt_secret as an environment variable rather than generating it at runtime
jwt.sign({ _id: emailExist._id }, jwt_secret);
Posted by: Guest on August-28-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language