title: Passport JWT - Unauthorized
body: <p>I'm having a problem where its always returning unauthorized for me. When i set the header Authorization to the token that received. It returns back with.</p>
  
  <blockquote>
    <p>Unauthorized</p>
  </blockquote>
  
  <p>.</p>
  
  <pre><code>router.get('/dashboard', passport.authenticate('jwt', {session: false}), (req, res) =&gt; {
  
      res.json('It worked: User ID is: ' + req.user._id);
  
  });
  </code></pre>
  
  <p>.</p>
  
  <pre><code>var jwtOptions = {
  
      jwtFromRequest: ExtractJwt.fromAuthHeader(),
      secretOrKey: config.jwt.secretOrKey
      //issuer: config.jwt.issuer,
      //audience: config.jwt.audience,
  };
  
  passport.use(new JWTStrategy(jwtOptions, (jwt_payload, done) =&gt; {
  
      User.findOne({id: jwt_payload.id}, (err, user) =&gt; {
  
          if (err) {
              return done(err, false);
          }
  
          if (!user) {
              return done(null, false);
          }
  
          return done(null, user);
  
      });
  
  }));
  </code></pre>