Facebook的OAuth的,FB.getLoginStatus&安培; FB.logout在IE浏览器,Chrome浏览器,Firefox和放大器; Android的浏览器 [英] Facebook oauth, FB.getLoginStatus & FB.logout on IE, Chrome, Firefox & Android browsers

查看:299
本文介绍了Facebook的OAuth的,FB.getLoginStatus&安培; FB.logout在IE浏览器,Chrome浏览器,Firefox和放大器; Android的浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用FB的OAuth认证成功的用户,但我无法使用可靠似乎是建议的方法记录出来:使用FB JDK FB.logout

I'm using FB's oauth to successfully authenticate users, but I'm having trouble reliably logging them out using what seems to be the recommended approach: FB.logout using the FB JDK.

具体而言,调用 FB.logout 成功撤销了(装载FB JDK并调用 FB.init 之后)如果我使用Chrome或Firefox中的OAuth认证FB授予。然而,它不似乎IE或在Android浏览器工作。当我说这并不在IE和Android浏览器的工作,我的意思是,调用 FB.logout 后续重定向到 www.facebook后。 COM /对话框/ OAuth的.. 载入我的回调页而不提示用户重新输入凭据。在Chrome和Firefox,它们是正确的提示在这一点这样做。

Specifically, calling FB.logout (after loading the FB JDK and calling FB.init) successfully revokes the FB authentication granted during oauth if I'm using Chrome or Firefox. However, it does not seems to work in IE or in the Android browser. When I say it doesn't work in IE and Android browser, what I mean is that after calling FB.logout subsequent redirects to www.facebook.com/dialog/oauth.. load my callback page without prompting the user to enter credentials again. In Chrome and Firefox, they are 'correctly' prompted to do so at that point.

我的各种尝试调试使我认识到,甚至要求在 FB.logout FB.getLoginStatus ( C>)将通过一个有效的response.session对象,其在每一个浏览器的回调。因此,根据FB.getLoginStatus,会话仍然即使FB.logout后,每一个浏览器活跃。这使我想知道我的工作FB.logout在所有。

My various attempts to debug has led me to realize that calls to FB.getLoginStatus (even after calling FB.logout) will pass a valid response.session object to its callback in every browser. So, according to FB.getLoginStatus, the session is still active in every browser even after FB.logout. This makes me wonder my FB.logout works at all.

我知道的OAuth和FB JDK是两回事,并不必然意味着很好地一起玩,但我还没有看到任何其他办法,以结束一个FB OAuth的会议上,除了调用FB.logout。

I know that oauth and the FB JDK are two different things and are not necessarily meant to play together nicely but I haven't seen any other alternatives to ending an FB oauth session, aside from calling FB.logout.

别人看到了这些违规行为或有一个解决方案吗?谢谢。

Anybody else seen these irregularities or have a solution? Thanks.

推荐答案

我发现这个答案我张贴后,上面的:

I found this answer after I posted the above:

FB.logout不是在IE8工作

它建议把重定向在setTimeout函数调用FB.logout后。基本上,给约2000毫秒完成FB.logout功能。

It recommends putting the redirect after calling FB.logout in a setTimeout function. Basically, give the FB.logout function about 2000 ms to finish.

我试了一下,它在IE和Android浏览器修复了这个问题。基本上,Chrome和Firefox有FB.logout将完成在浏览器中新的页面加载之前执行一个足够快的JavaScript引擎,而IE浏览器和Android浏览器则没有。

I tried it, and it fixed the problem in both IE and the Android browser. Basically, Chrome and Firefox have a fast enough JavaScript engine that FB.logout will finish executing before the new page loads in the browser, while IE and Android browser do not.

此之后的逻辑,我意识到是有原因的FB.logout有一个回调函数,它可能是更安全的使用做任何重定向(而不是使用的setTimeout延时播放)。

Following that logic, I realized that there is a reason FB.logout has a callback function and it is probably safer to use that to do any redirects (as opposed to playing with a setTimeout delay).

function mysignout()
{
    FB.logout(function()
    {
        top.location.href = '../mobile.php'
    });
}

出于好奇,我测试,看看什么是Chrome中执行回调与IE浏览器的时间差。镀铬花2511毫秒即可完成注销IE了3517毫秒。我觉得困惑我的是,我想通FB.logout刚刚删除的cookie的地方,并会采取任何时候都。相反,它看起来就像是某种Ajax调用撤销服务器上进行验证,它需要相当大的时间位。

Out of curiosity, I tested to see what is the timing difference on executing the callback in Chrome vs. IE. Chrome took 2511 ms to complete the logout IE took 3517 ms. I think what confused me is that I figured FB.logout just deleted the cookie locally and would take no time at all. Instead, it looks like it is some kind of ajax call to revoke authentication on the server and it takes a considerable bit of time.

这篇关于Facebook的OAuth的,FB.getLoginStatus&安培; FB.logout在IE浏览器,Chrome浏览器,Firefox和放大器; Android的浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆