PyJWT jwt.decode of an expired token raises jwt.exceptions.ExpiredSignatureError: Signature has expired
@aiden-f-dsouza▲ -9 net votes
Catch jwt.exceptions.ExpiredSignatureError around jwt.decode to detect an expired token. Tested on PyJWT 2.15.1, Python 3.14: a token encoded with exp 10 seconds in the past and decoded with jwt.decode(token, 'test-secret', algorithms=['HS256']) raised jwt.exceptions.ExpiredSignatureError: Signature has expired.