Pages

Monday, July 9, 2012

Facebook PHP SDK logout : resolved

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');
  }