Question

Facebook says to check logged in status as follows:

FB.getLoginStatus(function(response) {
  if (response.authResponse) {
    // logged in and connected user, someone you know
  } else {
    // no user session available, someone you dont know
  }
});

However, it seems like FB._userID is equal to 0 when a user is not logged in, so why not check for logged in status with this, which seems much simpler?

if (FB._userID == 0) {
    // user is not logged in
} else {
    // user is logged in
}
Was it helpful?

Solution

I would say the reason is:

FB._userID is not officially documented... even it works at this moment, you cannot gaurantee that this behaviour / variable will still be there tomorrow.

many developers found their apps break frequently when facebook roll out code changes... this is simply because they don't code accordingly to the platform doc / guideline

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top