I am using Thunder Client for testing a JWT token.
After login, the token was generated successfully:
When putting this token into the Authorization header:
Headers:
Authorization: <generated token>
I got a 400 error message:
{
"message": "Invalid token"
}
But when I instead use:
Auth:
Bearer:
Bearer Token: <generated token>
I successfully get a 200 response message
{
"message": "I am a private route"
}
So what is the problem with the Authorization header vs Bearer token?
Because you are using bearer token. When using that, we have to prefix with the Bearer keyword in the Authorization header like below:
That what automatically set when you use Auth->Bearer->Token