title: Having issues with JWT and express-JWT
body: <p>I'm testing out express-jwt and jsonwebtokens. I've never used this before and would like some help!</p>
  
  <p>I've got the basics setup done and I only have one protected route.</p>
  
  <pre><code>app.use('/api', expressJWT({secret: 'cat'}));
  </code></pre>
  
  <p>Unfortunatley, i'm not able to access '/api' because it gives me this error </p>
  
  <pre><code>UnauthorizedError: No authorization token was found
  </code></pre>
  
  <p>If I use POSTman and issue a GET request with the following header </p>
  
  <pre><code>Authorization -&gt; Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6ImJhc2hpciIsImlhdCI6MTQ1MTQ0MjM4NywiZXhwIjoxNDUxNDQyNjg3fQ.CnaLvS_oCEy_mp_9MSAmTTylJqQMI2Qlq9V3emAmN3E
  </code></pre>
  
  <p>Everything works fine and I'm able to access the content in '/api'.</p>
  
  <p>But my issue is in my express application, specifically when I try to redirect the user to a new protected route.</p>
  
  <p>User logs in and I create a new jwt token and redirect the user to '/api'</p>
  
  <pre><code>router.post('/login', passport.authenticate('local'), function (req, res) {
      myToken = jwt.sign({
        username: req.body.username
      }, 'cat', {expiresIn: 60*5});
      res.redirect('/api');
  });
  </code></pre>
  
  <p>In this route, I set the headers and render the page. </p>
  
  <pre><code>router.get('/api',  function (req, res) {
    res.render('index', {user: req.user});
  });
  </code></pre>
  
  <p>Unfortunately, I get the following error </p>
  
  <pre><code>UnauthorizedError: No authorization token was found
  </code></pre>
  
  <p>My goal is to be able to redirect a user to a protected route. </p>
  
  <p>From my understanding, since /api is a protected route, express-jwt should be setting my authorization headers. Even if I try to manually set my headers using a middleware I still get an error.</p>
  
  <p>Any help is greatly appreciated!</p>
  
  <p>Thanks!</p>