创建Facebook apprequests [英] Creating facebook apprequests

查看:131
本文介绍了创建Facebook apprequests的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当某个特定的事件发生时,我正在尝试从一个应用程序发送一条消息给用户。现在我有这个代码

  $ param = array(
'message'=>'XYZ共享一个文件与$',
'data'=>'additiona_string_data',
'access_token'=> $ facebook-> getAccessToken(),
);
$ tmp = $ facebook-> api(/ $ uid / apprequests,POST,$ param);

但我总是得到未捕获OAuthException:(#2)无法创建任何



$ b

我不知道问题在哪里。 >解决方案

您应该阅读请求文档。

有关两种不同类型请求的解释。





您需要的是应用生成的请求,这意味着您需要应用访问令牌,而不是用户。



I假设您正在使用用户访问令牌,因为您没有包含启动您的代码示例中的facebook对象的可能性已经可能已经验证了用户,因此 getAccessToken()调用将返回用户访问令牌,而不是应用程序访问令牌。 em>


I'm trying to send a message from an app to a user when a specific event happens. Right now I have this code

$param = array(
   'message'      => 'XYZ shared a file with you',
   'data'         => 'additiona_string_data',
   'access_token' => $facebook->getAccessToken(),
);
$tmp = $facebook->api("/$uid/apprequests", "POST", $param);

but I always get Uncaught OAuthException: (#2) Failed to create any app request thrown

I don't know where is the problem.

解决方案

You should read the requests documentation.
In there is an explination about two different types of requests.

What you need is the app generated requests, that means you'll need the apps access token and not the users.

I assume that you are using the users access token because you did not include the initiation of the facebook object in your code sample and have probably verified the user already hence the getAccessToken() call will return the users access token and not the applications access token.

这篇关于创建Facebook apprequests的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆