错误(#200)用户尚未授权应用程序执行此操作 [英] Error (#200) The user hasn't authorized the application to perform this action

查看:156
本文介绍了错误(#200)用户尚未授权应用程序执行此操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用PHP发送消息到Facebook页面,但是我有这个错误

I would like to send messages to a Facebook page with PHP but I have this error


(#200)用户hasn'我授权应用程序执行此操作。

(#200) The user hasn't authorized the application to perform this action.

我是Facebook页面和Facebook应用程序的管理员。

I'm the administrator of the Facebook page and the Facebook application.

我认为我有这个问题,因为我没有很好的权限,但我不知道如何做到这一点。

I think I have this problems because I don't have the good permissions but I don't know how to have this.

我在网页上搜索了许多同一个问题的网页,但我没有找到答案。

I have search in many many pages with same question in the web but I don't have find the answer.

他们是我的权限。

array(1) {
         ["data"]=> array(3) {
                     [0]=> array(2) {
                         ["permission"]=> string(9) "installed"
                         ["status"]=> string(7) "granted"
                         }
                     [1]=> array(2) {
                         ["permission"]=> string(14)"public_profile"
                         ["status"]=> string(7) "granted" 
                     }
                    [2]=> array(2) {
                         ["permission"]=> string(12) "manage_pages"
                         ["status"]=> string(7) "granted" } } } 

这是我的代码。

$permissions = 'manage_pages, publish_stream';
$fb = new Facebook(array('appId'=>$appId, 'secret'=>$secret));

 $fbuser = $fb->getUser();
 if($fbuser){
    $permissions = $fb->api('/me/permissions');
    if(isset($_POST['msg']) and $_POST['msg']!=''){
        try{
            $message = array(
                'access_token' => $token,
                'message' => $_POST['msg']
            );
         //   $posturl = '/'.$_POST['pageid'].'/feed';
            $posturl = '/me/feed';
            $result = $fb->api($posturl,'POST',$message);
            if($result){
                echo 'Successfully posted to Facebook Wall...';
            }
        }catch(FacebookApiException $e){
            echo $e->getMessage();
        }
    }

...

}else{
    $fbloginurl = $fb->getLoginUrl(array('redirect-uri'=>$returnurl, 'scope'=>$permissions));
    echo '<a href="'.$fbloginurl.'">Login with Facebook</a>';
 }


推荐答案

您可以在回复中看到发布许可不被授予。

You can see in the response that the publishing permission is not granted.

原因是现在已经不推荐使用 publish_stream 使用 publish_actions

The reason is that publish_stream is now deprecated; use publish_actions instead.

这篇关于错误(#200)用户尚未授权应用程序执行此操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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