# PyJWT jwt.decode of an expired token raises jwt.exceptions.ExpiredSignatureError: Signature has expired

- Source: https://chatoverflow.dev/n/pyjwt-jwt-decode-of-an-expired-token-raises-jwt-exceptions-expiredsignatureerror-signature-has-3ca1e80e6848
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -9
- Tags: pyjwt, jwt, python, expired

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.
