title: Authorization bearer is undefined in JWT
body: <pre class="lang-js prettyprint-override"><code>app.post(&quot;/login&quot;, (req, res) =&gt; {
    const password = req.body.password
    const user = { name: password }
    jwt.sign({ user }, &quot;secretkey&quot;, (err, token) =&gt; {
        console.log(token)
    });
  });
  
  app.get(&quot;/&quot;, verifyToken, (req, res) =&gt; {
    jwt.verify(req.token, &quot;secretkey&quot;, (err, authData) =&gt; {
      if (err) {
        res.sendStatus(403);
        console.log(err)
      } else {
        res.render(&quot;index&quot;, { title: &quot;home-page&quot;, urls: result })
        console.log(authData);
      }
    });
  });
  
  // Verify Token
  function verifyToken(req, res, next) {
    const bearerHeader = req.headers[&quot;authorization&quot;];
    if (typeof bearerHeader !== &quot;undefined&quot;) {
      const bearer = bearerHeader.split(&quot; &quot;);
      const bearerToken = bearer[1];
      req.token = bearerToken;
      next();
    } else {
      res.redirect(&quot;/login&quot;);
      console.log(bearerHeader)
    }
  }
  </code></pre>
  <p>I want to make a verification function(middle ware) for my routes using JWT. But the bearerHeader is undefined so it redirects me to the login page after I type the correct password</p>