CodeWithHarry / iNotebook-React

INotebook is a React Application for managing personal notes on the cloud
343 stars 193 forks source link

Update auth.js #58

Closed sudhanshuku01 closed 8 months ago

sudhanshuku01 commented 1 year 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