[英]POST Facebook Notification using Graph API
我正在尝试使用facebook graph api post方法发布通知,但我正在
(#15) This method must be called with an app access_token.
但是我要在querystring中发送的access_token是使用此方法获取的应用访问令牌
$token_url = "https://graph.facebook.com/oauth/access_token?client_id=".FB_APP_ID."&client_secret=".FB_SECRET."&grant_type=client_credentials";
我见过很少有人实施它,但是不知道为什么它对我不起作用,有人请告诉我我错在哪里。
谢谢
编辑
我知道了,这是零钱
这行代码将永远无法使用,因为内部access_token将覆盖我们尝试传递查询字符串的应用程序access_token。
$this->facebook->api("/".$to_userId."/notifications?access_token=$app_token_url&template=message",'POST');
所以用这个代码
$data = array(
'href'=> 'https://apps.facebook.com/MY_APP/',
'access_token'=> $app_token,
'template'=> 'test'
);
try {
$this->facebook->api("/".$to_userId."/notifications",'POST',$data);
} catch (FacebookApiException $e) {
}
您的应用是否在应用设置中意外配置为“本地/桌面”应用? 如果是这样,请将其更改回“网络”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.