4
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CodeIgniter2.1.4でFacebook認証をしたときのログアウトバグ

Posted at

Faecbook認証でログインしていて、ログアウトしようとした際にauth/logoutを呼び出してログアウト処理をしたところ、
上手くSessionの情報が消えてくれず焦ったのでメモ

Auth.php
//ログアウト
function logout() {
	$this->session->sess_destroy(); //セッション削除
	redirect('index/', 'location'); //ログアウト後にトップページへ
}

facebookSDKの中身を確認したところ、destroySession()というメソッドが含まれていたのでこれを使ったらうまくいきました

Auth.php
//ログアウト
function logout() {
	$this->session->sess_destroy(); //セッション削除
	$this->facebook->destroySession(); //Facebook認証のセッションを削除
	redirect('index/', 'location'); //ログアウト後にトップページへ
}
4
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?