Could not load the default credentials ☁️ Google Cloud / Firebase

Google Cloud: Error: Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started

The Google client library found no Application Default Credentials (ADC) on this machine or environment.

Seen on: Google Cloud

Meaning

Locally you need gcloud auth application-default login (or GOOGLE_APPLICATION_CREDENTIALS pointing to a key file). On Google Cloud the attached service account is used automatically — outside GCP (other hosts, CI) you must provide credentials (workload identity federation preferred).

Common causes

  • Local machine without gcloud ADC login
  • GOOGLE_APPLICATION_CREDENTIALS unset or pointing to a missing file
  • Running outside GCP without credentials
  • Container missing the mounted key/metadata access

⚡ Quick fix

  1. gcloud auth application-default login (local)
  2. Use workload identity federation in CI
  3. On GCP, attach a service account with the needed roles

Detailed fix by platform

Shell

  1. bash
    gcloud auth application-default login
    export GOOGLE_APPLICATION_CREDENTIALS=/secrets/sa.json   # only if you must use a key

How to diagnose

  1. Environment — Local, GCP or other?
  2. Variable — GOOGLE_APPLICATION_CREDENTIALS
  3. Identity — gcloud auth list

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.