You can try the session flush as shown below
Session::flush(); //clears out all the exisiting sessions
Set debug
to true
in config/app.php
when you're developing so you can see what error you get instead of Whoops, an error...
.
Did you do the upgrade steps for 4.1.26? http://laravel.com/docs/upgrade#upgrade-4.1.26
I'm just trying a basic sample with 'auth.basic' filter with "User.php" class that I found as default. If I try to execute "Auth::logout();" it seems to works (no errors) but user still logged in.
The "users" table have "remember_token" column (varchar 100) and User class contains public function getRememberToken() { return $this->remember_token; }
public function setRememberToken($value)
{
$this->remember_token = $value;
}
public function getRememberTokenName()
{
return 'remember_token';
}
itsaafrin said:
You can try the session flush as shown below
Session::flush(); //clears out all the exisiting sessions
This doesn't work. Same issue here!
I have the same problem too. Right after Auth::logout(), I found that the value of Auth::check() is false. But, after redirect, Auth::check() is true again. It's so funny. Even, after doing Session::flush();
I created a fresh project for Laravel 4.2. The only changes are:
from:
Route::filter('auth.basic', function()
{
return Auth::basic();
});
to:
Route::filter('auth.basic', function()
{
return Auth::basic('username');
});
Route::get('/', function()
{
return View::make('hello');
});
Route::get('/logout', function()
{
Auth::logout();
Session::flush();
return Redirect::to('/');
})->before('auth.basic');
Route::get('/admin', array('before' => 'auth.basic', function()
{
if (Auth::check()) {
return "Hello Admin!";
} else {
return "Hello guest!";
}
}));
Basic auth don't support logout. From a StackOverflow topic:
"This is not a limitation to Laravel, HTTP Basic Authorization is not designed to handle logging out. The client will remain logged in until the browser is closed."
Session::flush(); working for me ..
I think this is an issue for L4.2
Just replace Auth::logout() with Session::flush();
public function logout() {
Session::flush();
return Redirect::to('/');
}
You have to specify which guard you are working with like
ope this helps someone.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community