Hi Deazl,
Same problem , after logout browser error to many redirect
push to top
hi deazl,
try this solution http://laravel.io/forum/12-27-2015-laravel-52-authlogout-is-not-working?page=1#reply-29616
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.
<?php
Route::get('/', 'HomeController@getIndex');
Route::get('/test', function (Request $request) {
dd(Auth::check());
});
// Plugin Stuff
Route::group(['prefix' => 'plugins', 'middleware' => 'web'], function() {
Route::auth();
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('web');
$this->middleware('guest', ['except' => 'logout']);
But now I get a TokenMismatchException :(
Here are my files:
Best regards, Deazl
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.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community