Failed to create any app request

戏子无情 提交于 2019-12-24 03:39:24

问题


I want to send a request with the facebook app-graph.. sometimes successfully but sometimes failed with return value:

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

please help me .. why did it happen?hehe


回答1:


You need to send the app-to-user request using the application access_token. For example:

$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);

EDIT:

See the facebook documentation for generating an app access_token. The documentation states:

There is another method to make calls to the Graph API that doesn't require using a generated app token. You can just pass your app id and app secret as the access_token parameter when you make a call:

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



来源:https://stackoverflow.com/questions/9595517/failed-to-create-any-app-request

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!