Question

I want to show Login button and Login status as "LOGGED IN" if the user has Facebook open in any other tab of their browser, and otherwise show "NOT LOGGED IN".

Was it helpful?

Solution

The Facebook Javascript SDK supports checking if your site's user is logged into Facebook, see here: https://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus/

OTHER TIPS

To use the Facebook to determine, the user would have had to first approve your application. This can be checked with the javascript sdk:

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

If you just want to know if they are logged into Facebook (not your application), someone has found a loophole to detect.

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