简体   繁体   中英

logout using facebook php sdk

i have created a forum using php/mysql and users login through facebook using php sdk. the login works perfectly. the logout however does not. I have not tried the javascript sdk and it is supposted to work . but i need a solution in PHP.

Here are the two things that i have tried.

//this is signout .php

$logoutURL=$facebook->getLogoutURL(array('next'='http://localhost/php_lessons/forum_facebook/logout_page.php'));

header('Location:'.$logoutURL);

//this is signout.php

$ACCESS_TOKEN=$facebook->getAccessToken(); $REDIRECT='http://localhost/php_lessons/forum_facebook/logout_page.php';

"https://www.facebook.com/logout.php?access_token=ACCESS_TOKEN&confirm=1&next=REDIRECT"

both the solutions take me to facebook/home.php of the user that is trying to logout. (me for test purposes).

$past = time() - 3600;
foreach ( $_COOKIE as $key => $value )
{
    setcookie( $key, $value, $past, '/' );
}

you can try this code. It will just destroy all cookies saved from your site. Its working for me..!

The logout problem is because of a recent Facebook API change – 'offline_access Permission Removal'.

Disable the 'Deprecate offline access' setting from Edit App > Advanced > Migrations tab

You can read more about it at: http://developers.facebook.com/roadmap/offline-access-removal/

使用没有数组的getLogoutUrl

$facebook->getLogoutUrl();

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