Support the ongoing development of →
Authentication Security Session
Last updated 2 years ago.

#push to top :)


Hi Deazl,

Same problem , after logout browser error to many redirect

push to top


You are watching videos that don't match the current version.

The guest middleware is applied to the AuthController methods except for logout. You are using getLogout. So the above posted answer (from adhadimas91) should fix that for you.


Hey adhadimas91 and lagbox. Thanks!

In the meanwhile I changed alot. For example I use my "own" AuthController wich is very close to the AuthController delivered with Laravel. Even I found, that I have to use the "web" middleware to get the $errors variable in Blade.

But now I have another problem I don't understand: The prefix in my Route-Group will be ignored.


Route::get('/', 'HomeController@getIndex');

Route::get('/test', function (Request $request) {

// Plugin Stuff
Route::group(['prefix' => 'plugins', 'middleware' => 'web'], function() {

	Route::get('/', 'PluginController@getList');
	Route::get('featured', 'PluginController@getFeatured');

// Authentication Stuff
Route::group(['prefix' => 'auth'], function() {

	Route::get('login', 'Auth\AuthController@login');
	Route::post('login', 'Auth\AuthController@authenticate');
	Route::get('logout', 'Auth\AuthController@logout');

	Route::get('register', 'Auth\AuthController@register');
	Route::post('register', 'Auth\AuthController@store');


All links generated with URL::action('Controller@Method') are correct. Even for the AuthController. But when I open eg. "/auth/login" it redirects me to "/login". Even "/auth/register" will be redirected to "/login". After I took a look at the auth-Middleware I think that its his fault.

Now I think that I have to assign the guest-Middleware to "register()" and "login()". In the auth-Middleware I changed the redirect path from "login" to "auth/login". But now I get a Too-Many-Redirects error because I haven't assigned the guest-Middleware to it.

I know how to assign multiple middlewares, but how to do it with options like "only" and "exclude"? I have this:

$this->middleware('auth', ['except' => 'logout']); // After copied it, I recognized that it makes no sense.

I tried something like that but (I think) thats not working:

$this->middleware('guest', ['except' => 'logout']);

But now I get a TokenMismatchException :(

Here are my files:

Best regards, Deazl

Last updated 8 years ago.

You may not be passing a csrf token. If you have a form make sure it is adding the token field.

If you are doing the same things as the AuthController you would want the guest middleware applied to it except for the logout method.

Last updated 8 years ago.

Sign in to participate in this thread!


Your banner here too?

Deazl deazl Joined 5 Jan 2016


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

Your logo here?

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

© 2024 - All rights reserved.