NodeJS
(Solved) How to fix UnauthorizedError invalid algorithm?
August 30, 2020
1 min
While using package express-jwt
, I faced issue UnauthorizedError No authorization token was found
Below is stack trace of same
UnauthorizedError: No authorization token was found at middleware (/server/node_modules/express-jwt/lib/index.js:79:21) at Layer.handle [as handle_request] (/server/node_modules/express/lib/router/layer.js:95:5) at next (/server/node_modules/express/lib/router/route.js:137:13) ...
Add Authorization
header while sending request with value of Bearer <token>
.
Replace <token>
with jwt token
. Make sure you have space between Bearer
and <token>
curl --location --request GET 'http://localhost:8000/api/user/5f47eaaada0785698c571b68' \ --header 'Accept: application/json' \ --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI1ZjQ3ZWFhYWRhMDc4NTY5OGM1NzFiNjgiLCJpYXQiOjE1OTg2MTMyMTYsImV4cCI6MTU5OTIxODAxNn0.yHkKewj4oyPZK9hTY6gR7us8zfvW5L7z6UxmLXfy8H0' \ --data-raw ''