Cannot read property 'isZero' of undefined

Having trouble generating a token when running code below:
const token = jwt.sign(tokenPayload, tokenSecret, { algorithm: 'RS256' });
(where tokenSecret is a public key, same one used by server)

If I don’t include the algorithm option it works, but then the server is unable to verify saying invalid algorithm. Which makes sense because algorithm on server is RS256 and from my understanding, jwt.sign uses HS256 by default.

But when I do include the algorithm option, jwt.sign throws an error saying Cannot read property 'isZero' of undefined caused by the bn package which I assume is a dependancy of dependancies of jsonwebtoken.

Any ideas?

1 Like

Hey there @ahonarpour, I see you have opened a Github issue related to this which is perfect for tracking purposes! I will look into this and see if I can find anything more on our side of things while the Github issue stands active. Thanks!

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.