【问题标题】:Facebook REST api Application SecretFacebook REST api 应用程序秘密
【发布时间】:2011-02-28 03:34:41
【问题描述】:

我正在尝试使用以下代码检索我朋友的生日列表。我正在使用 Facebook 的 FQL 方法,使用旧的 REST API。

<?php 
  $appapikey = '<app api key>';
  $appsecret = '<app secret>';
  $token = 'access_token=<token>';
  $fql = "SELECT uid, first_name, last_name, birthday, sex, proxied_email FROM standard_user_info WHERE uid = <my uid>";

  $fqlqueryuri = 'https://api.facebook.com/method/fql.query?query='.urlencode($fql).'&'.$token.'&application_secret='.$appsecret;
  $fqlquery = htmlentities(file_get_contents($fqlqueryuri));
  echo "<pre>" . $fqlquery . "</pre>";
?>

当我运行查询时,我收到以下错误;

<?xml version="1.0" encoding="UTF-8"?>
<error_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <error_code>15</error_code>
  <error_msg>The method you are calling or the FQL table you are querying cannot be called using a session secret</error_msg>
  <request_args list="true">
    <arg>
      <key>method</key>
      <value>fql.query</value>
    </arg>
    <arg>
      <key>query</key>
      <value>SELECT uid, first_name, last_name, birthday, sex, proxied_email FROM standard_user_info WHERE uid = xxx</value>
    </arg>
    <arg>
      <key>access_token</key>
      <value>xxx</value>
    </arg>
    <arg>
      <key>application_secret</key>
      <value>xxx</value>
    </arg>
  </request_args>
</error_response>

在 Facebook 上查看更详细的错误描述后,我发现了这一行; 15 - API_EC_SESSION_SECRET_NOT_ALLOWED - 此方法调用必须使用应用程序机密进行签名(您可能正在使用会话机密调用安全方法)

我以为我已经用应用程序密码签署了代码。我正在离线运行它并拥有这样做的正确权限。

有什么想法吗?!

【问题讨论】:

    标签: php api facebook rest


    【解决方案1】:

    您不直接传递应用程序机密。您应该使用它来生成签名并发送那个

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-01-05
      • 2017-09-26
      • 2013-07-31
      • 1970-01-01
      • 1970-01-01
      • 2023-03-11
      • 1970-01-01
      相关资源
      最近更新 更多