I have been trying for hours now to log a user out of Facebook.com using the official php sdk V2.4 (https://github.com/facebook/facebook-php-sdk-v4/) and api endpoint version V2.5.
What I found until now is that I should use
$facebook->destroySession();
However this function is not available if I use
$facebook = new Facebook\Facebook([
'app_id' => $app_id,
'app_secret' => $app_secret,
'default_graph_version' => 'v2.5',
]);
So instead I used
$helper = $facebook ->getRedirectLoginHelper();
$logoutUrl = $helper->getLogoutUrl($user['facebookAccessToken'], 'www.mypage.com');
This returns
$logoutUrl = https://www.facebook.com/logout.php?next=www.mypage.com&access_token=facebookToken
I checked the token and it is correct. However when I redirect to $logoutUrl then facebook does not logout the user but instead redirects to https://www.facebook.com/home.php while the user is still logged in.
I guess that this is due to the new version V2.5? Is there any way to accomplish this task with the new version?
Thanks a lot in advance!
www.mypage.commust be a registered domain with this app; - Mukesh Yadav