title: Accessing a token from a redirect in node
body: <p>I have a login route that verifies a user then generates a token and redirects to the home page. I have some middleware set up but when I try to access the token in the middleware I get undefined. The token is being set up and is in the header if I don't redirect but when I do redirect I seem to loose the token from the headers. This is my first time working with tokens any help appreciated. Here is a reduced version of what I am working with:</p>
  
  <pre><code>router.post('/login', function(req, res) {
      var token = admin.generateToken('authentication');
      if(token) {
          //doing this I get the token in the header in postman
          //res.header('Auth', token).send('token in header');
  
          //lose the token doing this
          res.header('Auth', token).redirect('/');
       } else {
           res.send('IS ADMIN NO TOKEN GENERATED');
       }
  });
  
  router.get('/', middleware.requireAuthentication, function(req, res, next) {
      //Can't reach here because of undefined token
  });
  </code></pre>
  
  <p>middlware.js</p>
  
  <pre><code>module.exports = function(db) {
  
      return {
          requireAuthentication: function (req, res, next) {
              var token = req.get('Auth');
  
              console.log('TOKEN: ' + token ); //undefined
      }
  }
  };
  </code></pre>