Add service_account_json support to GoogleAdManagerAdapter validation #585
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes "Failed to fetch advertisers" error by adding
service_account_jsonsupport to GoogleAdManagerAdapter's config validation.Problem
After fixing the credential wrapping issues (PRs #579, #581, #584), service account authentication was still failing when fetching advertisers with:
Root Cause
GoogleAdManagerAdapter.__init__()was only checking for two authentication methods:service_account_key_file(legacy file-based service account)refresh_token(OAuth)It was not recognizing
service_account_json(JSON string-based service account, preferred for cloud deployments), even though:build_gam_config_from_adapter()correctly adds it to configGAMAuthManagercorrectly handles itGAMClientManagercorrectly uses itThe adapter was rejecting valid service account configs before they could reach the auth layer.
Solution
Updated
GoogleAdManagerAdapterto recognizeservice_account_json:Line 90: Store
service_account_jsonfrom configLine 110-111: Update validation to accept all three methods
Complete Service Account Fix
This completes the service account authentication implementation:
All service account authentication paths now work end-to-end!
Test Results
✅ All 8 service account auth tests pass
✅ All 35 GAM unit tests pass
✅ All 846 unit tests pass
✅ All 174 integration tests pass
🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com