Open megmatty opened 6 years ago
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.