Function gcp_auth::provider

source ยท
pub async fn provider() -> Result<Arc<dyn TokenProvider>, Error>
Expand description

Finds a service account provider to get authentication tokens from

Tries the following approaches, in order:

  1. Check if the GOOGLE_APPLICATION_CREDENTIALS environment variable if set; if so, use a custom service account as the token source.
  2. Look for credentials in .config/gcloud/application_default_credentials.json; if found, use these credentials to request refresh tokens.
  3. Send a HTTP request to the internal metadata server to retrieve a token; if it succeeds, use the default service account as the token source.
  4. Check if the gcloud tool is available on the PATH; if so, use the gcloud auth print-access-token command as the token source.