[英]How to fix “(#200) The user hasn't authorized the application to perform this action” error while posting on facebook wal
I am getting "(#200) The user hasn't authorized the application to perform this action" error when posting message on user's facebook wall. 在用户的Facebook墙上发布消息时,出现“(#200)用户未授权应用程序执行此操作”错误。 I am using facebook graph API. 我正在使用facebook graph API。 I have also set the "publish_actions" permission in the scope, but didn't working. 我还在范围内设置了“ publish_actions”权限,但没有起作用。 My code is 我的代码是
require 'facebook/facebook.php';
$facebook = new Facebook(array(
'appId' => APP_ID,
'secret' => APP_SECRET,
));
$user = $facebook->getUser();
if ($user) {
$accessToken = $facebook->getAccessToken();
try {
//create message with token gained before
$post = array(
'access_token' => $accessToken,
'message' => 'Test message'
);
$res = $facebook->api('/me/feed', 'POST', $post);
} catch (FacebookApiException $e) {
error_log($e);
$user = null;
}
} else {
# There's no active session, let's generate one
$login_url = $facebook->getLoginUrl(array(
'scope' => 'publish_actions'
));
header("Location: " . $login_url);
}
Can you please suggest me what i am missing in the code or in the app? 您能建议我代码或应用程序中缺少的内容吗?
Since you mentioned that it does work for Admins, but not for anyone else, it´s very clear what the problem is: You need to go through Login Review with publish_actions
- else, that permission will only work for users with a role in the App. 由于您提到它确实适用于Admins,但不适用于其他任何人,所以很清楚问题出在哪里:您需要使用publish_actions
进行Login publish_actions
否则,该权限仅对具有以下角色的用户有效:应用。
All the information you need about Login Review is in the docs: https://developers.facebook.com/docs/facebook-login/review 您需要有关Login Review的所有信息都在docs中: https : //developers.facebook.com/docs/facebook-login/review
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.