title: Node + Express + Passport: req.user Undefined
body: <p>My question is similar to this <a href="https://stackoverflow.com/questions/13824314/req-user-undefined-node-express-passport-facebook">one</a>, but there was no insight into his solution.</p>
  
  <p>I'm using Passport to auth using Instagram.  After successful auth, users are directed to "/".  At this point, the request has the user object (aka it's working).  However, once I redirect, the req.user is undefined.  :'(</p>
  
  <p>The odd part is that passport.deserializeUser is being called with each request.  It's successfully getting the user object, but somewhere along the middleware road, req.user is not being set (or being unset).</p>
  
  <pre><code>// on successful auth, goto "/" 
  app.get('/', function(req, res) {
      // if the request has the user object, go to the user page
      if (req.user) {
          res.redirect("/user/" + req.user._id);
      }
  
      res.render("index");
  }
  
  app.get('/user/:uid', function(req, res) {
      console.log(req.user) // undefined
  }
  </code></pre>