Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

set token to expiration with passport jwt.

const jwt = require('jsonwebtoken');

// in your login route
router.post('/login', (req, res) => {
  // do whatever you do to handle authentication, then issue the token:

  const token = jwt.sign(req.user, 's00perS3kritCode', { expiresIn: '30m' });
  res.send({ token });
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #set #token #expiration #passport
ADD COMMENT
Topic
Name
8+5 =