Closed sudhanshuku01 closed 8 months ago
I found the official documentation of" jwt npm" ----
var jwt = require('jsonwebtoken'); var token = jwt.sign({ foo: 'bar' }, 'shhhhh');
var decoded = jwt.verify(token, 'shhhhh'); console.log(decoded.foo) // bar
so accordingly if we will pass the {id:user.id} we can easily decode that like decoded.id otherwise it can give error
I found the official documentation of" jwt npm" ----
var jwt = require('jsonwebtoken'); var token = jwt.sign({ foo: 'bar' }, 'shhhhh');
var decoded = jwt.verify(token, 'shhhhh'); console.log(decoded.foo) // bar
so accordingly if we will pass the {id:user.id} we can easily decode that like decoded.id otherwise it can give error