Is your feature request related to a problem? Please describe.
The latency of repeated requests (at least to Sheets API) is non-trivial, as it appears on each request a new token is requested. This likely results in extra unnecessary bandwidth consumption for devices and delays in the user experience.
Describe the solution you'd like
If the current token is unexpired, it should be returned. Additionally, if a request comes in before an imminently expiring token an asynchronous process should be kicked off to refresh it. Alternatively, upon creation of a token schedule a refresh slightly before token expiry.
Describe alternatives you've considered
See above for two possible solutions.
Additional context
I will craft a PR for one of the alternatives shortly.
Is your feature request related to a problem? Please describe.
The latency of repeated requests (at least to Sheets API) is non-trivial, as it appears on each request a new token is requested. This likely results in extra unnecessary bandwidth consumption for devices and delays in the user experience.
Describe the solution you'd like
If the current token is unexpired, it should be returned. Additionally, if a request comes in before an imminently expiring token an asynchronous process should be kicked off to refresh it. Alternatively, upon creation of a token schedule a refresh slightly before token expiry.
Describe alternatives you've considered
See above for two possible solutions.
Additional context
I will craft a PR for one of the alternatives shortly.