【问题标题】:Auto Posting on User wall with Feed使用 Feed 在用户墙上自动发布
【发布时间】:2013-09-14 18:24:31
【问题描述】:

我正在使用 Facebook 供稿在用户的墙上发帖,但没有显示供稿对话框,它按预期发布在登录用户的墙上。 但是如果用户没有授权应用程序,它不会在墙上发布,如果用户没有验证应用程序,我想显示对话框提示进行身份验证,我正在使用 FB.getLoginStatus(),但它返回连接状态,并且从我读过的文档中,如果 FB.getLoginStatus 将返回已连接,请参阅Here

the user is logged into Facebook and has authenticated your application

这就是我使用 FB.getLoginStatus() 的方式

 FB.getLoginStatus(function (response) {
                        if (response.status === 'connected') {
                            alert("connt");
                            // the user is logged in and has authenticated your
                            // app, and response.authResponse supplies
                            // the user's ID, a valid access token, a signed
                            // request, and the time the access token 
                            // and signed request each expire
                            var uid = response.authResponse.userID;
                            var accessToken = response.authResponse.accessToken;
                        } else if (response.status === 'not_authorized') {
                            alert("not");
                            // the user is logged in to Facebook, 
                            // but has not authenticated your app
                        } else {
                            alert("aa");
                            // the user isn't logged in to Facebook.
                        }
                    });

这是我的墙贴代码

 FB.api('/me/feed', 'post', { link: mywebsitelink, picture: mypicture, message: message }, function (response) {
                        if (!response || response.error) {
                            alert(response.error.message);
                        } else {
                            //  alert('Post ID: ' + response.id);
                        }
                    });

它显示错误消息,甚至 FB.getLoginStatus 显示已连接。

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

【问题讨论】:

  • “已连接”仅表示用户已经连接到您的应用程序 - 但没有说明他们可能授予的权限(除了连接所暗示的基本权限)。你知道你需要publish_actions 权限才能发布到用户的墙上,对吧?那么你之前有没有要求过……?

标签: facebook-graph-api


【解决方案1】:

用户需要接受扩展权限 () 才能在墙上发帖。当用户接受应用程序时,请记住在范围中包含“publish_stream”权限。

FB.login(function(response) {
// do you thing
}, {scope: 'publish_stream'});

FB.getLoginStatus() 仅告诉您应用程序是否已被接受,而不是任何扩展权限也已被接受。

【讨论】:

    猜你喜欢
    • 2013-06-04
    • 2011-02-16
    • 2018-10-14
    • 2011-07-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多