我在使用 Facebook 对话框时遇到问题。
当我点击 Facebook 按钮时,我会看到 Facebook 登录屏幕。当我完成时,弹出窗口更改为 permissions.request(弹出窗口中的 url 是https://www.facebook.com/dialog/permissions.request?_path=permissions.request& ....")。它显示我请求的三条信息(基本信息、关于您和您的生日)。当我单击“使用 Facebook 登录”按钮时,弹出窗口变为空白屏幕,尽管 url 显示https:// /www.facebook.com/dialog/permissions.request没有任何附加参数。
任何帮助都感激不尽。
这是我用来打开 facebook 对话框的 html 和下面的 javascript:
<script type="text/javascript" language="javascript">
/*
window.fbAsyncInit = function () {
FB.init({ appId: '<my app id>',
channelUrl: '<MY SITE ADDRESSS>/channel.html',");
status: true,
cookie: true,
xfbml: true,
oauth: true
});
function CheckIfPreExistingFBLogin(response) {
alert("check if pre existing fb login");
if (response.authResponse) {
alert("pre existing fb login active");
//user is already logged in and connected
FB.api('/me', function (response) {
jQuery('#<%=hdnFBUID.ClientID%>').val(response.id);
jQuery('#<%=hdnFBemail.ClientID%>').val(response.email);
jQuery('#<%=hdnFBFirstName.ClientID%>').val(response.first_name);
jQuery('#<%=hdnFBLastName.ClientID%>').val(response.last_name);
jQuery('#<%=hdnFBBirthday.ClientID%>').val(response.birthday);
jQuery('#<%=hdnFBPreExistingLogin.ClientID%>').val("y");
alert("CheckIfPreExistingFBLogin got FB data - UserID=" + response.id);
PostItBack();
});
} else {
alert("pre existing fb login is not active");
//user is not connected to your app or logged out
//do nothing
}
}
function CheckForNewFBLogin(response) {
alert("try to check for new fb login");
if (response.authResponse) {
alert("got a new FB login");
FB.api('/me', function (response) {
jQuery('#<%=hdnFBUID.ClientID%>').val(response.id);
jQuery('#<%=hdnFBemail.ClientID%>').val(response.email);
jQuery('#<%=hdnFBFirstName.ClientID%>').val(response.first_name);
jQuery('#<%=hdnFBLastName.ClientID%>').val(response.last_name);
jQuery('#<%=hdnFBBirthday.ClientID%>').val(response.birthday);
jQuery('#<%=hdnFBPreExistingLogin.ClientID%>').val("n");
alert("Check for newFBLogin got FB data - UserID=" + response.id);
PostItBack();
});
//user is already logged in and connected
// PostItBack();
} else {
alert("no new FB login");
//user is not connected to your app or logged out
//do nothing
}
}
}
function PostItBack() {
__doPostBack('', 'gotLogin');
}
// run once with current status and whenever the status changes
FB.getLoginStatus(CheckIfPreExistingFBLogin); //updateButton1
FB.Event.subscribe('auth.statusChange', CheckForNewFBLogin);
};
jQuery(document).ready(function () {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol
+ '//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
});
*/
</script>
and here is the code for the facebook login button in the body of the form:
<div id="fb-root" "></div>
<div class="fb-login-button" scope="user_birthday, user_about_me"> Login with Facebook </div>