我正在建立一个Rails应用程序,并尝试通过Facebook JS SDK实现登录。遗憾的是失去了Omniauth的支持... :(
不管怎样,弹出对话框会出现,用户提供登录信息,但然后重定向到
如果我手动关闭它,然后刷新我的页面,我就能看到登录成功了。
有趣的是,在第一次登录时,当请求权限时,一切如预期地工作,弹出窗口在授予权限或拒绝后关闭。
在Chrome、FF、Safari和Opera上测试。行为一致。
如果我在Chrome上调试空白重定向页面,会出现两个错误:
1)
2)
非常感谢您提供的帮助……这件事让我疯了!=(
编辑:这可能是Facebook的一个bug,因为它正在从http重定向到https吗?
不管怎样,弹出对话框会出现,用户提供登录信息,但然后重定向到
https://www.facebook.com/connect/window_comm.php?_id=some-string&_relation=opener&auth_token=some-big-string
页面,一个空白屏幕。弹出窗口没有关闭。如果我手动关闭它,然后刷新我的页面,我就能看到登录成功了。
有趣的是,在第一次登录时,当请求权限时,一切如预期地工作,弹出窗口在授予权限或拒绝后关闭。
在Chrome、FF、Safari和Opera上测试。行为一致。
如果我在Chrome上调试空白重定向页面,会出现两个错误:
1)
Unsafe JavaScript attempt to access frame with URL http://something from frame with URL https://something. Domains, protocols and ports must match.
(请注意http和https...)2)
window_comm.php:7Uncaught TypeError: Cannot call method '_recv' of undefined
以下是相关代码:<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'my-app-id',
status : true,
channelURL : 'http://localhost:3000/channel.html',
cookie : true,
oauth : true,
xfbml : true
});
FB.Event.subscribe('auth.login', function(response) {
window.location.reload();
});
};
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/pt_BR/all.js"
fjs.parentNode.insertBefore(js, fjs);
}
(document, 'script', 'facebook-jssdk'));
</script>
<div class="fb-login-button" data-show-faces="true" data-width="400" data-max-rows="1" perms="offline_access"></div>
非常感谢您提供的帮助……这件事让我疯了!=(
编辑:这可能是Facebook的一个bug,因为它正在从http重定向到https吗?