title: Set authorization in Node request.headers
body: <p>I'm attempting to send a Passport-Local login request to the client side to be analyzed by Satellizer, and I would like the request from the server side to send an authorization token. Unfortunately, there is no key <code>authorization</code> in <code>request.headers</code>:</p>
  
  <pre><code>{ host: 'localhost:3000',
    connection: 'keep-alive',
    'cache-control': 'max-age=0',
    accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' }
  </code></pre>
  
  <p>The login function redirects here, and this is where <code>ensureAuthenticated()</code> is called.</p>
  
  <pre><code>app.get('/main', ensureAuthenticated, function(req, res, next){
      res.render('main.ejs', { token: createSendToken(req.user, config.secret), id: req.user._id, username: req.user.username, authorization: req.user.authorization });
  });
  </code></pre>
  
  <p><code>ensureAuthenticated()</code> then analyzes the login request and makes sure the tokens match:</p>
  
  <pre><code>function ensureAuthenticated(req, res, next) {
  
    if (!req.headers.authorization) {
       return res.status(401).send({ message: 'Please make sure your request has an Authorization header' });
    }
    var token = req.headers.authorization.split(' ')[1];
  
    var payload = null;
    try {
      payload = jwt.decode(token, config.token_secret);
    }
    catch (err) {
      return res.status(401).send({ message: err.message });
    }
  
    if (payload.exp &lt;= moment().unix()) {
      return res.status(401).send({ message: 'Token has expired' });
    }
    req.user = payload.sub;
    next();
  }
  </code></pre>
  
  <p>It then redirects and shows the message</p>
  
  <pre><code>{ message: 'Please make sure your request has an Authorization header' }
  </code></pre>
  
  <p><strong>How would I set an authorization key to request.headers?</strong></p>