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?