━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

GCP OAuth 2.0 tokenUses temporary OAuth 2.0 tokens explicitly configured by the user.

This method has the major limitation that the user must regularly generate new tokens and update the connector configuration as OAuth 2.0 tokens expire. On the other hand, this method is ideal in cases where the connector only needs to be used for a short period of time, such as sharing access temporarily with someone else in your team.

Using any of the other authentication methods will automatically generate and refresh OAuth 2.0 tokens for clients upon request.

A GCP project is required and the connector may only be used to access GCP resources in the specified project.

Fetching OAuth 2.0 tokens from the local GCP CLI is possible if the GCP CLI is already configured with valid credentials (i.e. by running gcloud auth application-default login). We need to force the ZenML CLI to use the OAuth 2.0 token authentication by passing the --auth-method oauth2-token option, otherwise, it would automatically pick up long-term credentials:

zenml service-connector register gcp-oauth2-token --type gcp --auto-configure --auth-method oauth2-token

Example Command Output

Successfully registered service connector `gcp-oauth2-token` with access to the following resources:

┏━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓

┃     RESOURCE TYPE     │ RESOURCE NAMES                                  ┃

┠───────────────────────┼─────────────────────────────────────────────────┨

┃    🔵 gcp-generic     │ zenml-core                                      ┃

┠───────────────────────┼─────────────────────────────────────────────────┨

┃     📦 gcs-bucket     │ gs://zenml-bucket-sl                            ┃

┃                       │ gs://zenml-core.appspot.com                     ┃

┃                       │ gs://zenml-core_cloudbuild                      ┃

┃                       │ gs://zenml-datasets                             ┃