Colin-b/requests_auth

request a new token when token is too close to expire

sdementen opened this issue · 8 comments

I have an issue with a token in the cache that is expiring at time T and a request sent at time T that will use this token as not yet expired. The request fails as the token, when reaching the API backend on T+some ms is expired.
It would be useful to be able to specify some delta/interval (in seconds) that would trigger a refresh of the token if it expires after this delta.
e.g. OAuth2ClientCredentials(validity_duration=5, ...) will request a new token if `now+5>expiry´.

Indeed that make sense, it might also be the occasion to look into #13

I will put a default value that can be overridden if there is a need (on some slow network) but in your case it would not require any changes.

What do you think for default value? 5s?

5s should cover it yes

hello @Colin-b , would you have an ETA for this feature ?

and/or any quick patch I could apply ?

Feel free to come up with a patch or I will try to find some time this weekend :-)

hello @Colin-b , did you already work on this ?

Fixed since release 6.0.0