:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(google-ads): declare adwords required scope on the oauth field (#68139)
Tom Owers3bac2a66fb0f
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/source.pyindex 742ae2fe8f67..57a6570b3927 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/source.py@@ -201,7 +201,11 @@ class GoogleAdsSource(secret=False,),SourceFieldOauthConfig(- name="google_ads_integration_id", label="Google Ads account", required=True, kind="google-ads"+ name="google_ads_integration_id",+ label="Google Ads account",+ required=True,+ kind="google-ads",+ requiredScopes="https://www.googleapis.com/auth/adwords",),SourceFieldSwitchGroupConfig(name="is_mcc_account",diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/tests/test_google_ads_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/tests/test_google_ads_source.pyindex 4ccce4a77b2e..4ef393b65370 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/tests/test_google_ads_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/tests/test_google_ads_source.py@@ -13,6 +13,8 @@ from google.ads.googleads.v23.errors.types.request_error import RequestErrorEnumfrom google.api_core import exceptions as google_api_exceptionsfrom google.auth import exceptions as google_auth_exceptions+from posthog.schema import SourceFieldOauthConfig+from posthog.models.integration import Integrationfrom products.warehouse_sources.backend.temporal.data_imports.sources.generated_configs import GoogleAdsSourceConfig@@ -40,6 +42,17 @@ _CUSTOMER_ID_ERROR = "valid Google Ads customer ID"_MANAGER_ID_ERROR = "valid Google Ads manager customer ID"+def test_get_source_config_oauth_field_declares_required_scope():+ oauth_field = next(+ (field for field in GoogleAdsSource().get_source_config.fields if field.name == "google_ads_integration_id"),+ None,+ )+ assert oauth_field is not None, "OAuth field 'google_ads_integration_id' not found in source config"+ assert isinstance(oauth_field, SourceFieldOauthConfig)+ assert oauth_field.kind == "google-ads"+ assert oauth_field.requiredScopes == "https://www.googleapis.com/auth/adwords"++class TestCleanCustomerId:@pytest.mark.parametrize("raw, expected",