google-auth-library-python
google-auth-library-python copied to clipboard
Implement pre-emptive credential refresh
Thanks for stopping by to let us know something could be better!
PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.
Is your feature request related to a problem? Please describe. In the current implementation OAuth credentials get refreshed inline when auth headers are requested by gRPC. This causes latency spikes that are hard to debug.
Describe the solution you'd like Implement a stale state for OAuth tokens where the existing token is returned, and a refresh is triggered in the background. Prior art: https://github.com/googleapis/google-auth-library-java/pull/646
Describe alternatives you've considered Other possibilities are:
- Have an always running background thread to always refresh the token. This will have lifetime issues since credentials dont currently have a way to close them/stop the thread
Implemented for sync credentials in https://github.com/googleapis/google-auth-library-python/pull/1368.
Async implementation is blocked until the API / Inheritance issues are sorted.