我制作了一个Facebook应用程序。 现在我需要使用弹出许可框获取用户信息。 如果一个用户认证了该应用程序, Facebook不应该打开对话框以获得许可, 但是如果一个用户第一次使用应用程序, 那么它必须打开一个对话框。 我试图在这里做的是... 并获取错误, 如...
无法调用 showPermissionDialog 方法未定义
FB.getLoginStatus(function (response) {
if (response.status === connected ) {
alert("1");
// 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;
//alert(uid);
var accessToken = response.authResponse.accessToken;
jQuery("#<%= accessToken.ClientID %>").val(accessToken);
// alert(accessToken);
fqlQuerynew();
} else if (response.status === not_authorized ) {
// the user is logged in to Facebook,
// but has not authenticated your app
alert( not_authorized );
OnRequestPermission();
} else {
alert("3");
//alert( the user isnt logged in to Facebook );
}
});
};
function OnRequestPermission() {
var myPermissions = "publish_stream, manage_pages"; // permissions your app needs
FB.Connect.showPermissionDialog("email,offline_access", function (perms) {
if (!perms) {
alert("hi");
// document.location.href = YouNeedToAuthorize.html ;
} else {
alert("buy");
document.location.href = homePage.html ;
}
});
}