目前,在 facebook 使用新的 SDK 和 OAuth 2.0 进行更改后,FB.getLoginStatus 根本不会触发。 我们曾经在 FB.getLoginStatus 中获取响应并调用回调函数,该函数又进行重定向 我们的 Facebook 应用程序的用户。
请帮忙。
代码片段 -
FB.init({
appId: '<%=ConfigurationManager.AppSettings["APIKey"]%>', // App ID
//channelURL: 'xd_receiver.htm', // Channel File
status: true, // check login status
cookie: true, // enable cookies to allow the server to access the session
oauth: true // enable OAuth 2.0
//xfbml: true // parse XFBML
});
update_user_is_connected();
function update_user_is_connected()
{
FB.getLoginStatus(function(response)
{
callback();
});
}
function callback() {
var fbURL = "http://apps.facebook.com/" + '<%=Suffix%>' + "/MyPage.aspx";
eval("parent.location='" + fbURL + "'");
}
现在 FB.getLoginStatus 不起作用。
问候, KK
最佳答案
我遇到了同样的问题,并通过添加 true
作为第二个参数来修复它:
FB.getLoginStatus(function(response) {
callback();
},
true);
这会禁用缓存并强制重新加载。请参阅the docs
关于facebook-javascript-sdk - FB.getLoginStatus() 未触发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8500599/