You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tried several things, how do I get access to req.user on the server side once logged in?
Trying to save data to database with a user id attached to it, but can't get the user id.
The text was updated successfully, but these errors were encountered:
You should have access to req.user as long as the endpoints are protected by the JWT strategy. For example:
app.get('/some-resource',passport.authenticate('jwt'),// The middleware both protects you endpoint, and sets req.user(req,res)=>{console.log(req.user);res.json({foo: 'bar'});});
Tried several things, how do I get access to req.user on the server side once logged in?
Trying to save data to database with a user id attached to it, but can't get the user id.
The text was updated successfully, but these errors were encountered: