I am using the Facebook PHP sdk, and after the user logs in, I show a link for the logout URL using $facebook->getLogoutUrl().
But when the user clicks on that link, it seems to go to Facebook and redirect right back to my main index.php at which point the user still seems to have been logged in, because $facebook->getUser(); returns a valid user.
How do I actually fully log the user out?
getLogoutUrl method returns a URL that, when clicked by the user, will log them out of their Facebook session and then redirect them back to your application.
Ideally after logging the user out, user will be redirected back to the application but $facebook->getUser();
returns 0.
This should help you.
EDIT:
Best way is to use something like below
$logoutParams = array(
'next' => 'http://your-site/your-application/after_logout.php'
);
and also destroy sessions session_destroy();