Reputation: 630
I have a fairly basic problem using the facebook php SDK in conjunction with the JS SDK. I have the login button which works fine but once the user is logged in and presses the logout button, I retrieve the logout URL as follows:
$logoutUrl = $facebook->getLogoutUrl(array('next' => 'http://mysite.com/'));
The user is then logged out of my site but facebook as well. How can I prevent the user from being logged out of facebook? I only want him/her to be logged out of my site.
Any help is greatly appreciated :) Merry Christmas everyone!
Upvotes: 1
Views: 1775
Reputation: 25918
If you rely on Facebook for authentication of users, will need to implement your own "logout" mechanism to do this, which is actually only way to do it without logout your users from Facebook since Facebook doesn't provide functionality for this.
Since you are not responsible on the auth here, you may place some cookie that indicated user is logged out of your site (which is only mocking things, you still know who he is) and prevent him from interaction with your site/app or display content for unauthorized users. If user is doing login with FB.login
you can subscribe
for auth.login
, auth.authResponseChange
and auth.statusChange
to check his status and remove cookie placed before to allow him log-in.
Upvotes: 4
Reputation: 6882
Haven't used the Facebook SDK too much, but IIRC, either you are logged in to Facebook or not. Logging out from your site will result in logging out on Facebook, and the other way around.
Upvotes: 1