gpt4 book ai didi

google-api-php-client - 访问 Google Tagmanager 帐户时出错 : (404) Not found or permission denied

转载 作者:行者123 更新时间:2023-12-01 04:36:55 24 4
gpt4 key购买 nike

我开始研究 Google Tag Manager API 并使用 php 语言调用 API 函数以列出具有 accountId 的所有容器:

$containers = $service->listAccountsContainers('accountId');

但是报错如下:

Error calling GET https://www.googleapis.com/tagmanager/v1/accounts/accountId/containers: (404) Not found or permission denied

否则,我已经在 https://developers.google.com/tag-manager/api/v1/reference/accounts/containers/list 上进行了测试并成功获得响应:200 OK

P/s:我已经设置了服务帐户名称、.p12 文件、范围并获得了 access_token 返回值。

最佳答案

默认情况下,服务帐户无权访问任何 Google 跟踪代码管理器帐户。如果您希望它能够访问您的帐户,您需要授予它对该帐户的访问权限。

转到 Google 标签管理器的管理部分

enter image description here

进入用户管理

enter image description here

点击添加新用户

enter image description here

获取服务帐户电子邮件地址并在上面表格的电子邮件字段中使用它。

关于google-api-php-client - 访问 Google Tagmanager 帐户时出错 : (404) Not found or permission denied,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32431116/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com