title: Node JS - Passport logout not working
body: <p>I'm currently learning node and i'm trying to write a successful logout function using passport js. So far I've managed to register users and also log them in. I've setup an Auth controller below with the login code and works and the logout code that doesn't seem to:</p>
  
  <pre><code>const passport = require('passport');
  
  exports.login = passport.authenticate('local',{
      failureFlash:'Failed Login!',
      successFlash:'Login successful!'
  });
  
  exports.logout = (req,res) =&gt; {
      req.logout();
      req.flash('Success','You are now logged out!')
  };
  </code></pre>
  
  <p>Here is the routing for both the functions:</p>
  
  <pre><code>router.get('/logout',authController.logout);
  router.post('/login',authController.login);
  </code></pre>
  
  <p>Not sure if it makes a difference but i'm building the front end with react and using Axios which acts more or less like Ajax to connect to these routes and use them as endpoints. My understanding is that when I hit the /logout route passport js should remove the user object from the request - is this correct? At the moment it's not removing it. I have MongoDB Compass also setup and can see the session in there when I login. Every time I login the session time updates but doesn't when I logout. Any idea where I was gone wrong?</p>