首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Google API - OAuth2 - PHP错误- authorization_error -“登录-客户-id”标题- GetCampaigns.php / ListAccessibleCustomers.php

Google API - OAuth2 - PHP错误- authorization_error -“登录-客户-id”标题- GetCampaigns.php / ListAccessibleCustomers.php
EN

Stack Overflow用户
提问于 2022-08-19 20:54:25
回答 1查看 65关注 0票数 0

使用"Google“- PHP客户端库。

同时调用"GetCampaigns.php“/ "ListAccessibleCustomers.php”示例代码。我仍然得到这个错误(下面),但找到了一个解决方案(检查答案)。

错误-

代码语言:javascript
复制
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
EN

回答 1

Stack Overflow用户

发布于 2022-08-19 20:54:25

Fix -

传递Manager帐户的ID (在我的例子中是test帐户)= $loginCustomerId

代码语言:javascript
复制
->withLoginCustomerId($loginCustomerId)

所以在“GoogleAdsClientBuilder”中-

代码语言:javascript
复制
$googleAdsClient = (new GoogleAdsClientBuilder())
            ->fromFile()
            ->withOAuth2Credential($oAuth2Credential)
            ->withLoginCustomerId($loginCustomerId)
            ->build();
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73422166

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档