【发布时间】: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 - 此方法调用必须使用应用程序机密进行签名(您可能正在使用会话机密调用安全方法)
我以为我已经用应用程序密码签署了代码。我正在离线运行它并拥有这样做的正确权限。
有什么想法吗?!
【问题讨论】: