Hi All,
I’m befuddled by this issue I’m having with authentication using json web tokens. I’m able to get a jwt sent out after a successful login but any attempt to call a protected api route with the token in the auth header always return 401.
Here is the link to the repo: https://github.com/DanStockham/voting-app
I’m using Postman to make my api calls.
In my Authorization
header I’ve tried several values:
Authorization: Bearer <token>
Authorization: JWT <token>
Authorization: Bearer JWT <token>
All of them return back with 401. I even set the expiration for more than a year and setting the passport-jwt options to ignoreExpiration
and it still didn’t fix the issue.
Like I said, this has left me befuddled and even after looking at solutions on google, it still doesn’t solve my issue I’m having.
Has anyone ever encountered this? Is there a way to debug the jwt-strategy so I can compare the payload? It seems like it isn’t being run when the api call is made.
Thanks in advance.