title: passing variable info in a session in Express
body: <p>I am new to Express sessions and was hoping I could get some help as to passing along variables using express-session.</p>
  
  <p>Essentially I am using passport to allow GitHub logins, and I can get the user's info using <code>req.user</code>. When the user logs in via GitHub I wanted to redirect the user to a login page which would ask the user to validate the information before creating the account, or if the account already exists render a welcome page.</p>
  
  <pre><code>let app = express();
  app.use(session({secret: "blahblahblah"}));
  
  console.log('github authenticated');
  let sess = req.session;
  //I want to pass the req.user(returned from GitHub) to a variable sess.user
  sess.user = req.user; 
  console.log(sess.user); //shows correct info    
  res.redirect('/user/login');
  
  module.exports = app;
  </code></pre>
  
  <p>However, when I try to access req.session from my route it returns 'undefined':</p>
  
  <pre><code>let session = require('express-session');
  let app = express();
  
  app.use(session({secret: "blahblahblah"}));
  app.use(router);
  
  router.get('/login', function(req, res, next) {
      let sess = req.session;
      console.log(sess.user); //undefined
      //would check the database
      //if user doesn't already exists pre-populate fields
      //render appropriate page
    });
  </code></pre>