I am logging in user successfully /login
and able to show information on my /profile
route.
Now, I am trying to /logout
the authenticate user, but seems it is not working. When trying passing logout route , nothing is happening. The JWT token is not getting expire so the /profile
data is there even after logout click.
//logout testing
router.post('/logout' , checkAuth, (req, res) => {
req.logOut();
res.status(200).send(["logged out"]).redirect('/login');
});
This is my /profile:-
router.get('/profile', checkAuth, (req, res, data) =>{
User.find(req.userData, function(err, users) {
res.send(req.userData);
});
});
I want the logout to be global. The user must get logged out from each device user is logged in