Facebook API - Oturum hala kullanıcı logout sonra var

0 Cevap php

I am using Facebook php-sdk in my iframe facebook app to get user login status. Right after I sign out using facebook Account > Log out link, the session is not destroyed yet. I must wait a few minutes before old session expires, then my app will again get the correct login status.

Ben kullanıcı dışarı imzaladığında facebook kendisini ve oturumu öldürmek için bekliyoruz. Nasıl el oturumu öldürüyorsunuz?

İşte benim kod:

$initParams = array(
  'appId'  => $conf['app_id'], 
  'secret' => $conf['secret_api_key'],
  'cookie' => TRUE,
);

$fb = new Facebook($initParams);
$fb->getSession();  // will return a session object eventhough user signed out!

SOLVED:

calling $fb->api('/me') will destroy the session if user has previously logged out. I've changed my code as following:

if ($session)
{
    try
    {
        $fbuid = $fb->getUser();
        $me = $fb->api('/me');
    }
    catch(FacebookApiException $e){}
}

API çağrısı başarısız olursa, $session NULL olarak ayarlanır. Çok garip bir davranış, ben burada oluyor her şeyi açıklamak yok ama artık oturum nesnesi getSession() metodu ile güncellenmektedir değil olan benim sorun çözüldü.

0 Cevap