Support the ongoing development of Laravel.io →
Authentication
Last updated 1 year ago.
0

You can try the session flush as shown below

Session::flush(); //clears out all the exisiting sessions
Last updated 1 year ago.
0

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....

Last updated 1 year ago.
0

Did you do the upgrade steps for 4.1.26? http://laravel.com/docs/upgrade#upgrade-4.1.26

Last updated 1 year ago.
0

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';
}
Last updated 1 year ago.
0

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!

Last updated 1 year ago.
0

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:

  • app/config/database.php
  • app/filters.php

from:

	Route::filter('auth.basic', function()
	{
		return Auth::basic();
	});

to:

	Route::filter('auth.basic', function()
	{
		return Auth::basic('username');
	});
  • app/routes.php like this:
	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!";
		}
  
	}));
Last updated 1 year ago.
0

I'm seeing the same problem with 4.2.

0

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."

0

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('/');
    }
Last updated 7 years ago.
0

You have to specify which guard you are working with like

Auth::guard("admin")->logout();

ope this helps someone.

Last updated 7 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

aboogie aboogie Joined 20 Apr 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.