algorithms
argument to allow you to customize your allowed algorithms (make sure you disallow none
), a secretOrPublicKey
argument that you populate with either the secret or the RSA public key (depending on selected signing algorithm), and other input arguments that allow you to customize claim validation. If parsing fails, then the library returns a JsonWebTokenError error with the message jwt malformed
, after which you must reject the associated request.
General recommendations for using third-party libraries:
verify()
method to validate the claims and the signature. Avoid using the decode()
method to validate a token, especially if it’s coming from a .-----BEGIN PUBLIC KEY-----
.https://{yourDomain}/.well-known/jwks.json