title: Node req.user undefined after login while using Angular
body: <p>I know that there has been another answer to this found <a href="https://stackoverflow.com/questions/16434893/node-express-passport-req-user-undefined">here</a> but I cannot for the life of me get my req.user to populate anything other than undefined while using angularjs.</p>
  
  <p>I have tried cookieParser, including the session secret in cookieParser, making sure the order of my express session comes before the passport session, I have User serialzed and deserialized. Nothing is working. </p>
  
  <p>here is my code, hope someone could help!</p>
  
  <pre><code>var HelperController = require('./controllers/helpers.js');
  app.use("/helper", HelperController);
  
  var passport = require('passport');
  var cookieParser = require('cookie-parser');
  var session = require('express-session');
  //PASSPORT
  //=================================
  app.use(cookieParser('keyboard cat'));
  app.use(session({
    secret: 'keyboard cat',
    resave: false,
    saveUninitialized: false
  }));
  app.use(passport.initialize());
  app.use(passport.session());
  
  //To be used when user is created ********
  passport.use(User.createStrategy());
  passport.serializeUser(User.serializeUser());
  passport.deserializeUser(User.deserializeUser());
  
  //USER HOME REGISTER
  //=================================
  app.post('/register',  function(req, res){
    console.log(req.body);
    User.register(new User({
      username: req.body.username
    }),
    req.body.password,
    function(err, user){
      req.login(user, function(err){
        if (err) {console.log(err); }
        return res.json(user);
      });
    });
  });
  
  //USER HOME LOGIN
  //=================================
  app.post('/login', passport.authenticate('local'), function(req, res){
    res.json(req.user);
  });
  
  
  
  //ROUTER SETUP
  //=========================================
  var express = require('express');
  var router = express.Router();
  
  router.get('/get-user', function(req, res){
    var user = req.user;
    console.log(user);
    res.json({user: user});
  });
  
  
  module.exports = router;
  </code></pre>