google-auth
Use when authenticating to Google APIs (GA4, Search Console, Ads, Sheets) via service account, Application Default Credentials, or OAuth, or when GOOGLE_APPLICATION_CREDENTIALS / ADC setup fails.
SKILL.mdskills/integrations/google-auth/SKILL.md
GitHubGoogle Auth
Shared credentials for Google Analytics, Search Console, and related APIs.
Prefer order
- MCP servers already configured with
GOOGLE_APPLICATION_CREDENTIALS - Service account JSON path in env
- Application Default Credentials (
gcloud auth application-default login)
Required env
| Variable | Purpose |
|---|---|
GOOGLE_APPLICATION_CREDENTIALS |
Absolute path to service-account JSON |
GOOGLE_CLOUD_PROJECT |
GCP project id (GA MCP / quota project) |
Resolve missing values via skills/integrations/obsidian-secrets/ then .env.local.
Service account checklist
- Create (or reuse) a GCP service account in
GOOGLE_CLOUD_PROJECT. - Enable APIs: Google Analytics Data API, Google Search Console API (and Ads if needed).
- Download JSON key → set
GOOGLE_APPLICATION_CREDENTIALS. - GA4: Admin → Property access → add SA email as Viewer (or Analyst).
- GSC: Settings → Users → add SA email as Full or Restricted.
- Never commit the JSON key; keep path in
.env.localonly.
Scopes (REST / client libraries)
| Product | Readonly scope |
|---|---|
| GA4 Data API | https://www.googleapis.com/auth/analytics.readonly |
| Search Console | https://www.googleapis.com/auth/webmasters.readonly |
Python ADC pattern
from google.auth import default
credentials, project = default(
scopes=["https://www.googleapis.com/auth/analytics.readonly"]
)
Common failures
| Symptom | Fix |
|---|---|
Could not load default credentials |
Set GOOGLE_APPLICATION_CREDENTIALS or run ADC login |
User does not have sufficient permissions |
Grant SA access on the GA4 property / GSC site |
API not enabled |
Enable the API on the GCP project |
| 403 on property | Wrong GA4_PROPERTY_ID or SA not added to that property |
Related
skills/integrations/google-analytics/skills/integrations/google-search-console/skills/org/TOOL-REGISTRY.md