如何知道用户是否退出Facebook,FB.Event.Subscribe不起作用 [英] How to know if a user log out of Facebook, FB.Event.Subscribe not work

查看:299
本文介绍了如何知道用户是否退出Facebook,FB.Event.Subscribe不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我需要在使用我的应用程序时捕获用户登录Facebook的事件,强制他们再次登录。我查看了 getLoginStatus JS API和 FB.Event.subscribe 。函数getLoginStatus工作,我可以进行轮询,但我想要一个回调函数(就像去授权回调函数一样)。

In my application, I need to catch the event of user log out of their Facebook while using my application, to force they login again. I have look through getLoginStatus JS API and FB.Event.subscribe . Function getLoginStatus works and I can make a polling, but I want to have a callback function (just like deauthorization callback function).

我认为FB.Event.subscribe是什么要做,但事件只有在刷新页面时才被触发,这不是我的预期。

I think FB.Event.subscribe is what to do, but the event only gets fired when I refresh the page, which is not what I expected.

还有其他方法可以确定FB用户是否还在登录,或者是否绝对需要随时间轮询?

Is there any other way to identify that a FB user is still logged in, or is it absolutely needed to poll over time ?

清除:我想获取用户退出他/的事件她的FB帐户,以便将该用户从我的应用程序中记录下来。我的应用程序是Facebook页面上的iframe,它不是社交连接应用程序。

CLARIFICATION: I want to get the event that user log out of his/her FB account, in order to log that user out of my application. My application is an iframe on Facebook page, it's not a social connect application.

推荐答案

最后,我必须使用中间件解决方案:每次用户尝试访问函数时,我都会重新调用FB.init()和FB.getLoginStatus(),而不是轮询Facebook。

In the end, I must use an intermediate solution: instead of polling Facebook, I re-call FB.init() and FB.getLoginStatus() every time user try to access a function.

这篇关于如何知道用户是否退出Facebook,FB.Event.Subscribe不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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