Colin-b / requests_auth

Authentication classes to be used with requests
MIT License
35 stars 13 forks source link

issue with timestamp calculations #32

Closed sdementen closed 4 years ago

sdementen commented 4 years ago

Line https://github.com/Colin-b/requests_auth/blob/edcad63999610c79e34824a7c59dae32213a46d4/requests_auth/oauth2_tokens.py#L66 should be self._add_token(key, token, expiry.replace(tzinfo=datetime.timezone.utc).timestamp()) to get correct utc timestamp.

utcnow does not set tzinfo (see https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow) timestamp assume localtime of not tzinfo (see see https://docs.python.org/3/library/datetime.html#datetime.datetime.timestamp)

Colin-b commented 4 years ago

Will be fixed in next release (you can already retrieve the fix from develop branch).

Thanks for reporting !