You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 6, 2026. It is now read-only.
I observed that requests to Google Cloud APIs take much longer when using UserAccessTokenCredentials (documented here) as credentials for client libraries, e.g., Storage library for Python.
Diving into the code, I realized that UserAccessTokenCredentials triggers token refresh (resulting in an additional API request) on each request due to how the before_request method is implemented:
I observed that requests to Google Cloud APIs take much longer when using
UserAccessTokenCredentials(documented here) ascredentialsfor client libraries, e.g., Storage library for Python.Diving into the code, I realized that
UserAccessTokenCredentialstriggers token refresh (resulting in an additional API request) on each request due to how thebefore_requestmethod is implemented:In comparison, the
before_requestmethod in the base class has a mechanism to trigger token refresh only when necessary:Would it be reasonable to check token validity before request in the
UserAccessTokenCredentialsstrategy?