This question relates to authlib python module:
I'm using an authlib OAuth2Session
to trigger a lot of requests to an API. I provided a refresh_token_url
to my OAuth2Session
, so that the access_token is seamlessly refreshed when expired.
Most of the time, it works perfectly, but sometimes, I receive a 401 response (token expired). What I suspect is : the request is fired on the client side since the token is not expired yet, but it becomes expired by the time this request is processed on the server side...
Here is my question:
Is there a way to make OAuth2Session
refresh its token x seconds before it expires?
Would it be possible to add an integer attribute to OAuth2Session
to make this duration configurable?