我正在使用 Facebook Feed 在用户的墙上发布,而不显示提要对话框,它按预期发布在登录用户的墙上。但是如果用户没有授权应用程序,它不会在墙上发布,如果用户没有验证应用程序,我想显示对话框提示进行身份验证,我正在使用 FB.getLoginStatus(),但它返回连接状态,并且从我读过的文档中,如果 FB.getLoginStatus 将返回已连接,请参见此处
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