if (!options.algorithms) throw new Error('algorithms should be set'); Error: algorithms should be set
You should add algorithms property to the jwt constructor.
Example;
expressJwt({ secret: process.env.JWT_SECRET, algorithms: ['RS256'] });
The issue caused by changes in version 6.0.0. Documentation also has been updated recently, it says:
The algorithms parameter is required to prevent potential downgrade attacks when providing third party libraries as secrets.
So now specifying algorithm property is mandatory, like so:
expressJwt({
secret: 'secret',
algorithms: ['HS256']
})
if the above algorithm : ['RS256'] does not work try this, algorithms: ['HS256']