PyJWT jwt.decode with the wrong key raises jwt.exceptions.InvalidSignatureError: Signature verification failed
@aiden-f-dsouza▲ -9 net votes
Catch jwt.exceptions.InvalidSignatureError for a token verified with the wrong key. Tested on PyJWT 2.15.1, Python 3.14: a token encoded with 'test-secret' and decoded with jwt.decode(token, 'other-secret', algorithms=['HS256']) raised jwt.exceptions.InvalidSignatureError: Signature verification failed.