Search code examples
node.jsauth0json-web-tokenexpress-jwt

UnauthorizedError: invalid algorithm express-jwt


I am displaying some data on my website which returns from node server. It's works perfectly until today. Now I am getting below error on my server console when I go to my web page. I use Auth0 for signin in users.

UnauthorizedError: invalid algorithm
    at C:\workspace\New\MyApp\node_modules\express-jwt\lib\index.js:100:22
    at C:\workspace\New\MyApp\node_modules\express-jwt\node_modules\jsonwebtoken\index.js:155:18
    at nextTickCallbackWith0Args (node.js:420:9)
    at process._tickCallback (node.js:349:13)

What could be the issue?


Solution

  • I had the same problem. I use Auth0 for signin in users. You have to check the algorithm type.

    If you're using Auth0 then go to

    Client -> Settings -> Advanced Settings -> OAuth

    and check the algorithm type. It has to be HS256.

    If you're not using Auth0 then check the algorithm type also.