Closed cesarqdt closed 1 year ago
@cesarqdt See PyJWT docs
exp
is a registered claim name. datetime
actually isn't JSON serializable. Scrolling down to Expiration Time Claim (exp), you will see that the library actually converts datetime
objects into a UNIX timestamp.
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
Summary. There is a bug in the
json.dumps
part of the code when trying to encode a payload if the payload contains the keyexpires
and raises aTypeError
TypeError: Object of type datetime is not JSON serializable
. The payload gets encoded correctly if the keyexpires
is changed toexp
only.Expected Result
Actual Result
If I change the key
expires
forexp
in the payload, the code works as expected.