duandeng2265 2016-02-09 14:03
浏览 47
已采纳

没有用户输入的Facebook Marketing API令牌

I'm currently creating a server CLI application retrieving facebook Ads metrics through the Marketing API, it would be done as a long running service on the server doing so periodically without user input, but I can't seem to find a way to get a token for doing so.

All procedures to get an access token from facebook PHP Api seem to assume a user is there to login to facebook. I looked quickly to see if I could connect manually with curl but there is some js generated variables in the facebook login process, so that would complicate things.

Is there any way to get Marketing API insight with only an app id/secret ? Or is it possible to retrieve an access token without user input ?

The closest I've been is this :

Api::init(
          'appID', // App ID
          'APPSECRET',
          "appid|appstring"// APP token
        );
$campaign = new Campaign('campaignID');
$params = array(
  'date_preset' => InsightsPresets::LAST_7_DAYS,
);
$insights = $campaign->getInsights([], $params);
print_r($insights);

But I get an error "Cannot determine the target object for this request. Currently supported objects include ad account, business account and associated objects."

  • 写回答

2条回答 默认 最新

  • dougai0138 2016-02-09 14:40
    关注

    With App ID and App Secret, you can only get an App Access Token. There is no relation to any User with that one, so there is no way for Facebook to know if you are allowed to have access to the Marketing API or Insights:

    To access the Marketing API you need a user access token having the permissions ads_management or ads_read

    Source: https://developers.facebook.com/docs/marketing-api/quickstart#access-token

    You can use and store an Extended User Token that is valid for 60 days.

    More information about Tokens and how to extend them:

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog