0

Is there a way, using the new Facebook API, to detect whether a user is logged in or not on facebook, without any relation to the facebook app? This should be all done in client-side javascript on a page on a website.

In more detail: According to the facebook documentation, getLoginStatus will detect a user is logged in if "the user is logged in and connected to your application." On the other hand, it will report the user is logged out if "the user is either not logged into Facebook, or has not authorized your application."

To me, this implies that getLoginStatus will never work the first time a user uses your application, because the first time any user is using your application, he/she has not granted any permissions to your application.

Moreover, what specific permissions does the user have to grant the app for getLoginStatus to work if the user is logged in? I have checked this list of permissions (on the Facebook API documentation):

http://developers.facebook.com/docs/authentication/permissions/

and have seen no mention of any permission that relates to this sort of detection.

This my first time using the Facebook API and it is very frustrating. I have scoured the internet and it seems like the general consensus is that you simply cannot detect whether a user is logged in or out.

Sam
  • 417
  • 1
  • 6
  • 13
  • You mean to say that you need to check the online status of a user without the person's permissions for your app? – Sujit Agarwal May 27 '11 at 01:25
  • Yes. When you make it sound like that, it sounds ridiculous :). So if we can't check the user's online status without permission, which permission do we need to do so? – Sam May 27 '11 at 16:23
  • weired as the facebook box is an iframe, couldn't access it's content to know such information. because they are not having the same domain – Mbarry Jun 08 '11 at 14:51

1 Answers1

0

I have found that when a non facebook user accesses the page you can check the persons [age] from the signedRequest (this information does not need permission as far as I've tested) and it will have both a max and min property.

A logged in facebook user will only have a min property as that is their actual age. I believe this information is given in order to deliver content restricted by age limits.

A logged in facebook user who then gives access permissions to connect with your app will have a user id so you can detect that seperately too.

This gives 3 user states by taking information from the signed request:

  • Anonymous: Has max and min age properties
  • Facebook User: Has only a min age property
  • Facebook User (who gave permission): Has a user id

Remember that facebook could revoke this functionality at any time and I've really only tested this a little. Good luck.