[source-google-ads] Add support for Google Service Account authentication
- Langage dominant
- Python
- Étoiles
- 22.1k
- Forks
- 5.3k
- Métriques de merge des PR
- Métriques de PR en attente
Description
### Problem
The `source-google-ads` connector currently only supports OAuth 2.0 installed application flow (`client_id` + `client_secret` + `refresh_token`). There is no way to authenticate using a **Google Service Account**, which is the recommended approach for server-to-server integrations without user interaction (e.g. automated pipelines, headless environments).
Reference: https://developers.google.com/google-ads/api/docs/oauth/service-accounts
### Proposed solution
Add a new authentication mode to the connector accepting **Service Account JSON credentials**, alongside the existing OAuth flow. The two modes should be mutually exclusive via a `oneOf` selector in the spec.
**New credential fields:**
- `service_account_json` (string, secret): the full JSON key content of the service account (avoids needing a file path inside a container)
- `developer_token` (string, secret): **required regardless of auth method** — this is a Google Ads Manager-level token, not tied to the auth flow
- `impersonated_email` (string, optional): the email of a real Google Ads user the service account will impersonate via domain-wide delegation
**Implementation impact (scoped):**
1. **spec.json** — Change `credentials` to use `oneOf` with two variants: `OAuth Credentials` (current) and `Service Account`
2. **manifest.yaml** — Add a conditional authenticator branch; when service account config is detected, use `NoAuth` (the Google Ads SDK handles auth internally)
3. **google_ads.py** — Detect `service_account_json` key, write to temp file, pass path as `json_key_file_path` to `GoogleAdsClient.load_from_dict()`
4. **components.py** — Update `get_credentials()` to handle both credential shapes
5. **config_migrations.py** — Add migration to tag existing configs with `auth_type: oauth2` for backward compatibility
6. **Unit tests** — Add tests for service account credential loading
### Context
- Connector version: **4.2.6-rc.1**
- Google Ads Python SDK version: **27.0.0** (already supports `json_key_file_path` + `impersonated_email` in `load_from_dict`)
- API version: **v20**
- This is an additive, non-breaking change (minor version bump to 4.3.0)
- Previous issue #5205 requested this in 2021 but was closed without implementation
### Willingness to contribute
I am willing to submit a PR for this feature.
---
**Internal Tracking:** https://github.com/airbytehq/oncall/issues/12110
Guide de contribution
Ouvrir le guide de contribution
Évaluation
Cette issue n'a pas encore été évaluée.