Reputation: 387
I downloaded the Facebook-sdk for php and played around with it for a while. So they have this example file, where user info is showed: facebook-facebook-php-sdk-98f2be1/examples/example.php It only shows user info after accepting the app.
Maybe that's not even possible/allowed... But I what to know if a user is logged into facebook, not into my app. I don't need his name, id, etc, nothing... Just want to know IF he there is a Facebook session in the background. Reason: I want to redirect users who are not logged in to Facebook elsewhere, because maybe they don't even have a facebook account.
Upvotes: 1
Views: 108
Reputation: 96323
But I w[an]t to know if a user is logged into facebook, not into my app. […] Just want to know IF he there is a Facebook session in the background.
That’s not possible.
Without having a user connect to our app first, you get virtually nothing, no info whatsoever.
Update:
The PHP SDK now has a method getLoginStatusUrl
that can provide that info.
It can determine three different states – a user logged into Facebook, logged out of Facebook, or unknown. It works by redirecting the user’s browser to Facebook to make the check, and then redirecting to three different URLs of your app that you can specify.
(Of course this’ll work without using the PHP SDK as well – you will just have to look into it’s source to see what the exact URL it creates is, then you can redirect the user there yourself.)
Upvotes: 1