简体   繁体   中英

Facebook PHP SDK logout

I've implemented in my facebook app logout option, but unfortunately, it errors on rediredt loop..Does anyone know if the facebook sdk, redirects me back to the original page, or to the main page whicj is set in the applications settings in developers.facebook.com administration?? Anyway, is there any possibility how to logout from my app without redirecting?For example with cUrl request to the logout url, is that possible?

You could consider using the FB javascript SDK for doing the logout and then you do not need to redirect (it is also possible to register a javascript callback and use window.location to do that):

FB.logout(function(response) { // user is now logged out window.location = "xxxx"; });

If you want to use the php sdk, you can pass in a "next" parameter, with the page you want to direcrect to: $location = (string) html_entity_decode($facebook->getLogoutUrl(array('next' => 'mysite.com')));

I just destroy the php session when I want to do a logout. Facebook-php-sdk uses sessions to store persistent data which keeps track of login details.

This doesn't logout from facebook but will make your facebook-php-sdk think you have logged out.

I also use just $facebook->destroySession()

Logout just didn't work for me because i was redirecting to login page and that keeps me logged in. ending session was the quickest solution, and I wanted to logout user from FB also for security reasons, just if they are accessing my app from someone else's computer

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM