开发者

Detect whether user is logged in to Facebook

开发者 https://www.devze.com 2023-04-07 07:31 出处:网络
I want to show Login button and Login st开发者_JAVA百科atus as \"LOGGED IN\" if the user has Facebook open in any other tab of their browser, and otherwise show \"NOT LOGGED IN\".To use the Facebook t

I want to show Login button and Login st开发者_JAVA百科atus as "LOGGED IN" if the user has Facebook open in any other tab of their browser, and otherwise show "NOT LOGGED IN".


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.


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/

0

精彩评论

暂无评论...
验证码 换一张
取 消