fix(performance): 구글 광고 — 개발자 토큰 입력칸·머리글 제거(구글 2026-09-09 폐지)

- 접근 등급(Explorer 등)은 서비스 계정을 가진 Google Cloud 프로젝트에 붙는다 — 토큰 입력 불필요
- developer-token 머리글은 무시되고 다음 큰 버전부터 거부 예정이라 보내지 않음
- CLOUD_PROJECT_NOT_APPROVED_FOR_PRODUCTION·AUTHORIZATION_ERROR 안내 추가, 설정 창 안내 문구·문서 갱신

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-15 15:20:21 +09:00
parent 3ead7aa9f6
commit 66a99e2733
4 changed files with 30 additions and 25 deletions
@@ -50,7 +50,7 @@ class Creds:
def _ctx(**over):
values = {"developer_token": "DEVTOKEN", "customer_id": "123-456-7890", "service_account_json": SA}
values = {"customer_id": "123-456-7890", "service_account_json": SA}
values.update(over)
return AdapterContext(code="google", credentials=Creds(values))
@@ -86,9 +86,10 @@ ROWS = [{"results": [
def test_validate_credentials():
src = ga.GoogleAdsSource()
ok = {"developer_token": "x", "customer_id": "123-456-7890", "service_account_json": SA}
ok = {"customer_id": "123-456-7890", "service_account_json": SA}
assert src.validate_credentials(ok) == []
assert src.validate_credentials({**ok, "service_account_json": "__stored__", "developer_token": "__stored__"}) == []
assert src.validate_credentials({**ok, "service_account_json": "__stored__"}) == []
assert "developer_token" not in {f.key for f in src.visible_fields()} # 개발자 토큰 폐지(2026-09-09) — 입력칸 없음
errs = src.validate_credentials({**ok, "customer_id": "12345", "login_customer_id": "abc", "api_version": "26",
"service_account_json": '{"type": "authorized_user"}'})
assert len(errs) == 4 and not any("BEGIN" in e for e in errs) # 키 내용은 문구에 없음
@@ -102,7 +103,7 @@ def test_fetch_days_converts_and_sends_headers(monkeypatch):
date(2026, 10, 1), date(2026, 10, 3))
api = seen[-1]
assert str(api.url) == "https://googleads.googleapis.com/v27/customers/1234567890/googleAds:searchStream"
assert api.headers["Authorization"] == "Bearer ya29.TOKEN" and api.headers["developer-token"] == "DEVTOKEN"
assert api.headers["Authorization"] == "Bearer ya29.TOKEN" and "developer-token" not in api.headers # 폐지된 머리글은 보내지 않음
assert api.headers["login-customer-id"] == "9998887777"
q = json.loads(api.content)["query"]
assert "segments.date BETWEEN '2026-10-01' AND '2026-10-03'" in q and "metrics.conversions_value" in q
@@ -174,11 +175,11 @@ def test_ad_credentials_use_own_namespace():
t = Table()
svc = CredentialService(t, lambda: ring, aad_ns=ad_sync.AD_NS)
svc.save(ga.GoogleAdsSource(), {"developer_token": "DEV", "customer_id": "1234567890"}, user="king")
assert svc.accessor("google").get("developer_token") == "DEV"
assert aad_for("google", "developer_token", "ad:") == "perf:ad:google:developer_token"
svc.save(ga.GoogleAdsSource(), {"service_account_json": SA, "customer_id": "1234567890"}, user="king")
assert svc.accessor("google").get("service_account_json") == SA
assert aad_for("google", "service_account_json", "ad:") == "perf:ad:google:service_account_json"
with pytest.raises(Exception):
crypto.decrypt(t.rows[("google", "developer_token")], aad=aad_for("google", "developer_token"), ring=ring)
crypto.decrypt(t.rows[("google", "service_account_json")], aad=aad_for("google", "service_account_json"), ring=ring)
class FakeStore:
@@ -186,7 +187,7 @@ class FakeStore:
self.replaced, self.status = [], []
def ad_credential_keys_by_code(self):
return {"google": {"developer_token", "customer_id", "service_account_json"}}
return {"google": {"customer_id", "service_account_json"}}
def ad_credential_rows(self, code):
return {}
@@ -222,11 +223,11 @@ def test_sync_service_saves_and_records(monkeypatch):
# 실패: 저장 안 하고 상태에 오류(저장된 비밀값은 가림)
def boom(ctx, s, e):
raise AuthFailed("토큰 DEVTOKEN 거부")
raise AuthFailed("거부된 값 123-456-7890")
monkeypatch.setattr(src, "fetch_days", boom)
res = svc.sync("google", date(2026, 10, 1), date(2026, 10, 1))
assert not res["ok"] and res["status"] == "auth_failed" and "DEVTOKEN" not in res["message"]
assert not res["ok"] and res["status"] == "auth_failed" and "123-456-7890" not in res["message"] # 꺼낸 인증정보 값은 가림
assert len(store.replaced) == 1 and store.status[-1][1:3] == ("auth_failed", False)
# 같은 채널 동시 실행 막기