Hi there,
I'm working with jwt.verify and I'm getting an "invalid algorithm" error.
Uncaught JsonWebTokenError {name: "JsonWebTokenError", message: "invalid algorithm"}
_Note: I tried switching up my PEM encoding from PKCS8 to traditional OpenSSL, but then I get an "invalid signature" error instead, which leads me to believe that PKCS8 is required._
Here is my code:
var jwt = require('jsonwebtoken');
var payload = {foo: 'bar'};
var rsa_token = jwt.sign(payload, private_pem, {algorithms: 'RS256'});
jwt.verify(rsa_token, public_pem);
Is RS256 properly supported?
Also please note that I'm testing this in the browser with browserify.
Any guidance on this would be much appreciated. Thanks!
You are doing it wrong, on the sign part. It is algorithmsingular
Please check the documentation.
OK thank you. It now works for RSA PEMs with PKCS8 encoding, but I still get "invalid signature" when I use traditional OpenSSL encoding.
@shea256 please open another issue with an example and I will have a look
Most helpful comment
You are doing it wrong, on the sign part. It is
algorithmsingularPlease check the documentation.