title: Setting a request header in NodeJS
body: <p>I'm quite new to NodeJS. Lately, I've been trying to create a Login page with authentication using JWT and I've been running into the same error for a week now.</p>
  <p>Here is my logic though:</p>
  <ol>
  <li>user sign up and is been given an access token using JWT via</li>
  </ol>
  <pre class="lang-js prettyprint-override"><code>const token = jwt.sign({username:this.username, _id: this._id}, config.get('private keys));
  req.headers.authorization = token;
  </code></pre>
  <ol start="2">
  <li>While login in, I did this;</li>
  </ol>
  <pre class="lang-js prettyprint-override"><code>const token = req.headers.authorization;
  if(!token) return res.send(&quot;Access denied&quot;);
  ...
  </code></pre>
  <p>But then, every time I try to login, I always get Access denied, I don't know if it should be <code>req.headers.authorization</code> or <code>res.headers[&quot;authorization&quot;]</code>, or if the problem is in the sign up page.</p>