Is it possible to know if my visitor is logged into facebook?

775 Views Asked by At

I want to know if a visitor to my website is logged into facebook or not? And what information will I be able to fetch from the user's fb profile, so that to login user on my website if user had already synced his fb account?

2

There are 2 best solutions below

0
andyrandy On BEST ANSWER

You can only create an App and check if the User is authorized - without authorization, he is completely anonymous. What information you can fetch is explained in the API reference: https://developers.facebook.com/docs/graph-api

For example, you can check if the user is logged in with FB.getLoginStatus: https://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus

More information:

1
joepio On

Facebook's API has a function FB.getLoginStatus() that returns either a connected, not_authorized or unknown string depending on if the visitor has authorized your application, has logged in to facebook or neither.

If you want user data, like a picture or a name, you're gonna need to authenticate your application.