title: express-jwt always sending 401 unauthorized while verifying user
body: <p>I have this middle-ware function which checks if the user is logged in or not, since I have web application and android platform as well therefore I am using tokens for the android and for web I am using session which is by default manager by passport.</p>
  
  <p><code>In my function</code> I am checking If I have a Authorization header, I know it's my android platform and therefore verify user by verifying jwt token, but It is always sending me 401 unauthorized and not setting the req.user.</p>
  
  <p>Here is the middle-ware function, if someone can please point out my mistake where I am going wrong in my logic.</p>
  
  <pre><code>var jwt_auth = require('express-jwt')
  
  // route middleware to make sure a user is logged in
  function isLoggedIn(req, res, next) {
  
      if (req.get("Authorization")) {
          jwt_auth({secret: 'somesecret'});
          if (req.user) {
              return next();
          }
          res.send(200, "Unauthorized access");
      }
      else {
          // if user is authenticated in the session, carry on
          if (req.isAuthenticated())
              return next();
  
          // if they aren't redirect them to the home page
          res.redirect('/');
      }
  }
  </code></pre>