title: Session lost with passport.js
body: <p>I manage to log in with passport.js</p>
  
  <pre><code>    app.post('/login', passport.authenticate('local'), function(req, res) {
          res.cookie('username', req.user.username);
          res.redirect('/');
      });
  </code></pre>
  
  <p>but after that my session seems lost.</p>
  
  <pre><code>    app.post('/user/favorites', function(req, res) {
      // `req.user` contains the authenticated user.
  
      console.log(req.user); // Undefined
      if(req.isAuthenticated()) { // false
          console.log('HI');
      }
  });
  </code></pre>