I am using Facebook php-sdk in my facebook iframe application to get login status. Immediately after I log out of my facebook account> Logout, the session has not yet been destroyed. I have to wait a few minutes before the expiration of the old session, after which my application will again receive the correct login status.
I expect facebook to kill itself and the session when the user selects. How to manually kill a session?
Here is my code:
$initParams = array( 'appId' => $conf['app_id'], 'secret' => $conf['secret_api_key'], 'cookie' => TRUE, ); $fb = new Facebook($initParams); $fb->getSession();
SOLVE:
calling $fb->api('/me') destroy the session if the user has previously logged out. I changed my code as follows:
if ($session) { try { $fbuid = $fb->getUser(); $me = $fb->api('/me'); } catch(FacebookApiException $e){} }
If the API call is unsuccessful, $session will be set to NULL. Very strange behavior, I do not explain everything that happens here, but it solved my problem with the fact that the residual session object is not updated using the getSession() method.
flochtililoch
source share