[英]Google Ads API - OAuth2 - PHP Error - authorization_error - "login-customer-id" header - GetCampaigns.php / ListAccessibleCustomers.php
使用“Google Ads API” - PHP 客户端库。
在调用“ GetCampaigns.php
”/“ ListAccessibleCustomers.php
”示例代码时。 我仍然收到此错误(如下),但找到了解决方案(检查答案)。
错误-
authorization_error: User doesn't have permission to access customer.
Note: If you're accessing a client customer,
the manager's customer id must be set in the 'login-customer-id' header.
See https://developers.google.com/google-ads/api/docs/concepts/call-structure#cid
修复-
传递经理帐户的 ID(在我的案例中是测试经理帐户)= $loginCustomerId
->withLoginCustomerId($loginCustomerId)
所以在“ GoogleAdsClientBuilder
”中——
$googleAdsClient = (new GoogleAdsClientBuilder())
->fromFile()
->withOAuth2Credential($oAuth2Credential)
->withLoginCustomerId($loginCustomerId)
->build();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.