Closed developerasun closed 2 years ago
Passport exposes a logout() function on req (also aliased as logOut()) that can be called from any route handler which needs to terminate a login session. Invoking logout() will remove the req.user property and clear the login session (if any).
app.post('/logout', function(req, res){
req.logout();
res.redirect('/');
});
It is a good idea to use POST or DELETE requests instead of GET requests for the logout endpoints, in order to prevent accidental or malicious logouts.
topic : understanding differerence between logOut and logout method in passport
read this
reference