jpadilla / pyjwt

JSON Web Token implementation in Python
https://pyjwt.readthedocs.io
MIT License
5.05k stars 676 forks source link

jwt.decode verifying against local time #837

Closed duggalmayank closed 1 year ago

duggalmayank commented 1 year ago

jwt_token = jwt.encode(payload={"exp": datetime.datetime.utcnow()}, key="secret")

jwt.decode(jwt=jwt_token, key="secret", leewayTIme=120, algorithms=['HS256'])

the last statement raises ExpiredSignatureError, but if I use datetime.datetime.now() insetead of utcnow(), it works and returns the decoded token.

The documentation mentions that expiration time is compared against UTC timestamp.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days