在与 Facebook OAuth 2 进行了一次相当令人沮丧的较量之后,我的 Facebook Connect 登录完全在我的网站 (www.thegameeffect.com) 上中断,我转向 StackOverflow 的聪明头脑,希望得到一些指导。
事情在 1-2 个月前工作得相当好,但最近我遇到了问题。基本上,我已经按照 FB 开发者网站的步骤进行操作,并从这里点击了其他几个帮助指南,例如这个链接:(http://stackoverflow.com/questions/8537007/facebook-cookie-and-oauth-2 -0-changes),遗憾的是没有任何运气。
我的 FB.Init 代码如下所示:
<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function () {
FB.init({ appId: '145290112183820', status: true, cookie: true, xfbml: true, channelUrl: 'http://www.thegameeffect.com/fbchannel.html' });
//, oauth:true
};
(function () {
// var js, id = 'facebook-jssdk'; if (d.getElementById(id)) { return; }
// js = d.createElement('script'); js.id = id; js.async = true;
// js.src = "//connect.facebook.net/en_US/all.js";
// d.getElementsByTagName('head')[0].appendChild(js);
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js#xfbml=1';
document.getElementById('fb-root').appendChild(e);
} ());
</script>
我已经尝试了所有变体,包括 oauth:true,排除了 channelurl,顶部未注释的自调用函数,当我尝试登录时仍然发生的所有事情是身份验证窗口短暂弹出,然后消失. 单击标题左上角的 FB 图标时执行的代码如下:
FB.login(function (response) {
if (response.session) {
// do server side work (this never gets hit)
}
});
有什么建议么?