Closed joshk132 closed 5 years ago
It seems like it is skipping my sessions.authorize,
totally. I was expecting to at the least see the output from console.log('payload received: ', jwt_payload);
but nothing from that shows.
If I put passport.authenticate('jwt', {session: false}),
in my route instead of sessions.authorize
I get a 401 with a valid token and also no output from that console.log
Have you been able to solve you issue? This doesn't sound like an issue with passport-jwt, but a broader issue you are having with passport or your application.
I also have the same issue, I even copy-pasted the code from here and I got the same issue, not even the console.log from the JwtStrategy function is running.
Closing as the original author has not responded.
I seem to not be able to call my JWT passport strategy at all, the reason that makes me think it is not calling it is that I am getting no output from a console.log which I would expect to run every time no matter whether the token is valid or not. Heck even if there was no token I think it should run.
Here is an example route of mine, keep in mind I am using controllers and that the method I am using has been used for both my login as well as sign up local strategies.
Here is that controller/middleware I mentioned before
And finally my passport strategy. I have tried a few different
opts.jwtFromRequest
that I found here and on StackOverflow none of which worked so I went back to this one.I am using Postman with the authorization type of Bearer token and I am have tried just the plain token as well as doing
JWT <token>
with the space as well as JWT in lower case too.I'm not sure what else might be helpful, hopefully someone can help as I have been at this for a few days now.