对于已获得“ads_read”权限的用户,无法从 Facebook Graph API 检索广告帐户

问题描述

我有一个用户可以使用 ads_read 权限在我们的应用程序上向 Facebook 授权,但是当我们尝试使用 Facebook Graph 上的 /adaccounts 边缘从该用户的帐户获取广告帐户时API,它返回一个错误

{
  error: {
    message: "Unsupported get request. Object with ID '<USER_ID>' does not exist,cannot be loaded due to missing permissions,or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",type: 'GraphMethodException',code: 100,error_subcode: 33,fbtrace_id: 'A3UCn8GlZiw9s3MRFG8sDUx'
  }
}

我在 Facebook 社区中发现了一个类似的问题,但它来自 Graph API 版本 3。 https://developers.facebook.com/community/threads/489913344898099/

为什么我无法检索此用户的广告帐户?

我正在使用来自 Node.js 服务器的 fetch 向 Graph API 发出常规 GET 请求来检索此数据。

      fetch(
        `https://graph.facebook.com/v10.0/${<USER_ID>}/adaccounts?fields=name,id,account_id&access_token=${<ACCESS_TOKEN>}`,{
          method: "GET"
        }
      )
        .then((_res) => _res.json())
        .then((accounts) => {
        // ... do stuff with ad accounts
      })

解决方法

尝试获得 ads_management 权限。

根据 FB 文档,我猜与 /adaccounts 关联的权限是 ads_management。而 ads_read 与 Insight API 等阅读广告报告相关。