StudioTime
StudioTime

Reputation: 23979

php destroy Facebook previous user inside app

I have a facebook app and a user logs in and uses it. Simple.

Problem: If the user logs out then another user logs in on same pc, the previous users details are loaded.

I cannot log them out of facebook as the user is in my canvas app.

I use:

require_once '/home/public_html/pages/social_login/fb_lib/facebook.php';

    $facebook = new Facebook(array(
      'appId'  => '__app_ID__',
      'secret' => '__secret__',
      'cookie' => true
    ));


    $fb_user = $facebook->api('/me');
    print_r($fb_user); die;

This will show the person who is actually logged in at the top in Facebooks header - but the array shows the previous user.

How can I destroy the previous user details without having the user log in and out again?

Upvotes: 0

Views: 100

Answers (2)

Sudhir Bastakoti
Sudhir Bastakoti

Reputation: 100175

You could try deleting FB cookies when user logs out, like:

 $facebook->destroySession();
    $fb_key = 'fbs_'.FACEBOOK_APP_ID_HERE;
    setcookie($fb_key, '', time() - 3600, '', '/', '');
    //clear session and 
    //rest of you logout code

Do you mean something like this

Upvotes: 1

Ryan
Ryan

Reputation: 2815

Try within the facebook sdk:

$facebook->destroySession(); - on user logout :)

let me know if that works :)

Upvotes: 1

Related Questions