无法创建任何应用请求

时间:2012-03-07 03:45:46

标签: facebook apprequests

我想用facebook app-graph发送请求.. 有时成功,但有时失败并返回值:

{
   "error": {
      "message": "(#2) Failed to create any app request",
      "type": "OAuthException",
      "code": 2
   }
}

请帮助我..为什么会这样?呵呵

1 个答案:

答案 0 :(得分:2)

您需要使用应用程序access_token发送应用程序到用户请求。例如:

$param = array(
   'message'      => 'Check out the latest update',
   'data'         => 'some_data_string',
   'access_token' => 'app_id|app_secret',
);
$tmp = $facebook->api("/[user_id]/apprequests", "POST", $param);

修改

请参阅facebook documentation以生成app access_token。文档说明:

  

还有另一种调用Graph API的方法   要求使用生成的应用令牌。您只需传递您的应用ID即可   当您拨打电话时,app secret作为access_token参数:

     

https://graph.facebook.com/endpoint?key=value&access_token=app_id|app_secret