I am trying to build a Connect app using PHP and the Zend Framework. I also have a Zend_Auth based user authentication system. Now, I am able to log in using Facebook but log out is not working.
I need to clear the Zend_Auth identity as well as remove all Facebook login info. What would be the best way to do this?
I tried facebook_client->expire_session()
and facebook_client->clear_cookie_state();
together and also facebook_client->logout($next)
after calling Zend_Auth::getInstance()->clearIdentity()
None of them seem to work.
You have to call the javascript client logout first, then send them to your php logout script. So, call .js:
You'll see a modal popup that says "you are logging out of this site and facebook* You'll be redirected to wherever your logout script is:
I usually also call this function in the PHP logout script, just to be safe:
(NEW FACEBOOK SDK) For me the getconfig() wouldn't work.So I had to find the new functions from the base_facebook.php file and add this bit of code in it. Then call it in your calling file. Before you do , call $facebook->destroySession();
You can logout the facebook user and redirect the user to your website page with PHP code like this :
header("Location: " . $facebook->getLogoutUrl(array('next'=>"http://yourwebsite.com/redirectAfterFacebookLogout.php")));