Ville Miekk-oja Ville Miekk-oja - 1 month ago 22
Node.js Question

JWT auth0 create jwt without certificate

I want to use json web tokens from auth0 without any authentication/signature for nodeJS. I know it is possible to define the 'alg' to be 'none' when creating the token like so:

var token = jwt.sign({ foo: 'bar' }, cert, { algorithm: 'none'});


But since I'm not using any signing, how could I create the token without the 'cert' part? I guess it is expecting for me to insert a private key. But since I wouldn't be using it for anything, I don't see what's the point?

Answer

Just pass null:

var token = jwt.sign({ foo: 'bar' }, null, { algorithm: 'none'});