When you use a Google Cloud cloud-based development environment such as
Cloud Shell or Cloud Code, the tool uses the credentials you provided
when you signed in, and manages any authorizations required. You cannot use
the gcloud CLI to configure ADC in these environments. If
you need to use a different user account to configure ADC, or configure ADC
using a service account, use a local development environment or a
Google Cloud compute resource as your development environment.

In Cloud Workstations, you can provide credentials to ADC in one of the
following ways:

- **Sign in using the [Workstations UI](https://docs.cloud.google.com/workstations/docs/authentication.md.txt#ui-sign-in):**
  When you sign in to your workstation through the Google Cloud console,
  Cloud Workstations makes your user credentials available through the
  workstation's [metadata server](https://docs.cloud.google.com/compute/docs/metadata/overview.md.txt#metadata_server_endpoints). Cloud Client Libraries, the
  gcloud CLI, and other tools that support ADC automatically
  retrieve these credentials from the metadata server without requiring a
  local credential file or the `GOOGLE_APPLICATION_CREDENTIALS` environment
  variable.

  Because ADC checks `GOOGLE_APPLICATION_CREDENTIALS` and local credential
  files before querying the metadata server, ensure neither is set if you
  want ADC to use your workstation sign-in credentials.
- **Authenticate manually:** Run `gcloud auth application-default login` in
  your workstation terminal to generate a
  [local ADC credential file](https://docs.cloud.google.com/docs/authentication/application-default-credentials.md.txt#personal).

> [!WARNING]
> **Warning:** In multi-user workstations, other users who have access to the workstation can access your OAuth access tokens. To help secure your environment, [keep workstations single-user by default](https://docs.cloud.google.com/workstations/docs/set-up-security-best-practices.md.txt#iam-permissions).

## What's next

- Get more information about [Cloud Workstations authentication](https://docs.cloud.google.com/workstations/docs/authentication.md.txt).
- Get more information about [Cloud Code](https://docs.cloud.google.com/code/docs.md.txt).
- Get more information about [Cloud Shell](https://docs.cloud.google.com/shell/docs.md.txt).
- Learn more about [how ADC finds credentials](https://docs.cloud.google.com/docs/authentication/application-default-credentials.md.txt).
- [Authenticate for using Cloud Client Libraries](https://docs.cloud.google.com/docs/authentication/client-libraries.md.txt).
- [Authenticate for using REST](https://docs.cloud.google.com/docs/authentication/rest.md.txt).
- Explore [authentication methods](https://docs.cloud.google.com/docs/authentication.md.txt).