2010-06-05 63 views
0

我想使用下面的代码检索我的朋友的生日列表。我使用旧的REST API使用Facebook的FQL方法。Facebook的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 - 此方法调用必须使用应用程序密钥进行签名(您可能正在使用会话密钥调用安全方法)

我以为我已经用应用程序密码签署了代码。我正在脱机运行,并具有正确的权限来执行此操作。

有什么想法?

回答

1

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

相关问题