Facebook sdk is creating one cookie in browser.
Which has to be cleared on logout.
Here is my Codeigniter code to do that.
Logout URL
$this->facebook->getLogoutUrl(array('next' => site_url('user/logout'));
Logout Function
public function logout() {
setcookie('PHPSESSID', '', time()-3600, "/");
$this->session->sess_destroy();
redirect('/user', 'refresh');
}
Which has to be cleared on logout.
Here is my Codeigniter code to do that.
Logout URL
$this->facebook->getLogoutUrl(array('next' => site_url('user/logout'));
Logout Function
public function logout() {
setcookie('PHPSESSID', '', time()-3600, "/");
$this->session->sess_destroy();
redirect('/user', 'refresh');
}
4 comments:
Hi there,
Thanks for the code, it works great, thumbs up !!
Cheers!
Hi,
I am using php-sdk and all things working except "logout". I have tried your code in my core php code but working.and i am not using code igniter or any other framework.
any suggestion?
you should check the cookie name.
By default the name is PHPSESSID.
If it is different for you, change in the code.
Added the session_destroy() in getLogoutUrl function.
Post a Comment