freezegun icon indicating copy to clipboard operation
freezegun copied to clipboard

Freezegun 0.3.13 FakeDateTime cannot be processed properly by JWT

Open pmg103 opened this issue 6 years ago • 1 comments

        # Payload
        for time_claim in ["exp", "iat", "nbf"]:
            # Convert datetime to a intDate value in known time-format claims
            if isinstance(payload.get(time_claim), datetime):
                payload[time_claim] = timegm(
                    payload[time_claim].utctimetuple()
                )  # type: ignore

from https://github.com/jpadilla/pyjwt/blob/master/jwt/api_jwt.py#L64

Although the UTC time tuple appears to show minutes correctly, the timestamp returned by timegm here does not include the minutes.

This code works correctly with freezegun 0.3.12.

pmg103 avatar Mar 10 '20 10:03 pmg103

More info here: https://github.com/spulec/freezegun/issues/327

ricky-sb avatar Dec 14 '20 20:12 ricky-sb