How to find out if a user has logged out of Facebook, FB.Event.Subscribe does not work

In my application, I need to catch a case where a user logs out of their Facebook using my application to log in again. I am looking at getLoginStatus JS API and FB.Event.subscribe . The getLoginStatus function works, and I can do a poll, but I want to have a callback function (as well as a deauthorization callback function).

I think that FB.Event.subscribe is what you need to do, but the event fires only when the page is refreshed, which I did not expect.

Is there any other way to determine if the FB user is still registered, or is it absolutely necessary to poll over time?

CLARIFICATION . I want to receive an event that a user exits from their FB account in order to register this user from my application. My application is an iframe on a Facebook page, it is not an application for connecting to the community.

+1
source share
2 answers

In the end, I have to use an intermediate solution: instead of polling Facebook, I repeatedly call FB.init () and FB.getLoginStatus () every time the user tries to access the function.

0
source

I'm not sure, but maybe the following code will help you.

At boot time, the application will simply execute this script or js function as:

// FB logout
  logout: function() {
    FB.getLoginStatus(function(response) {
    if(response.session) {
        FB.logout(function(response) {
            return;
        });
    }
  });
  }

Facebook, . , FB.logout(), Facebook. , , , .

0

All Articles