bulletproof-nodejs icon indicating copy to clipboard operation
bulletproof-nodejs copied to clipboard

Jwt invalid algorithm

Open thenayjourney opened this issue 4 years ago • 2 comments

I have got token from user signIn & signUp function. But when i set token in headers authorization, It returns

{
  "message": "invalid algorithm"
}

i am so curious to know what this is happening. Also I double check config values are already loaded.

Thank you.

thenayjourney avatar Aug 22 '21 04:08 thenayjourney

const isAuth = jwt({
  secret: config.jwtSecret, // The _secret_ to sign the JWTs
  algorithms: ['HS256'], // JWT Algorithm
  userProperty: 'token', // Use req.token to store the JWT
  getToken: getTokenFromHeader, // How to extract the JWT from the request
});

Change algorithms value to the example I posted above

swizes avatar Aug 24 '21 06:08 swizes

It is working with HS256 Algorithm

arvindgemini avatar Dec 25 '21 05:12 arvindgemini