JsonWebTokenError: invalid signature while verifying token using JWT
In this quick post, we will see how to fix JsonWebTokenError: invalid signature error when you are implementing JSON Web Token in node.js and Java.
Advertisements
I’m using node.js example. I give a plain text secret key and I verify the token using the following line.
jwt.verify(token, jwtKey);
This line would throw the error JsonWebTokenError: invalid signature when the key looks valid when you validate it in the JWT Debugging Tool. JWT would actually say Signature Verified.

I fixed this error by using the Base64 version of the secret key. Plain text just didn’t work for me.
const jwtKey = 'QHhpZGlvCg=='
Advertisements
You could try the same.
Fin.