Route [filament.auth.login] not defined

I'm getting this error when I sign out. How do I define a custom login route for this? I just want to log out and then the user be redirected to /login but instead, I get this error (Route [filament.auth.login] not defined) 'auth' => [ 'guard' => env('FILAMENT_AUTH_GUARD', 'web'), 'pages' => [ 'login' => \Filament\Http\Livewire\Auth\Login::class, ], ], In Web.php: Route::middleware([ 'auth:sanctum', config('jetstream.auth_session'), 'verified' ])->group(function () { // }); I'm using Jetstream for authentication. If I add this: Route::redirect('/', '/login')->name('filament.auth.login'); It works until I try and log in again, then it errors with too many redirects. I notice the browser trying to go to: /filament/logout
11 Replies
awcodes
awcodes2y ago
Route::redirect('/login', '/admin/login') ->name('login'); Probably should use a route helper for ‘/admin/login’ if you’ve changed the filament path, but that’s what you need.
benshawuk
benshawukOP2y ago
That doesn't work. I don't have anything at /admin/login so that just gives me a 404.. I kind of need: Route::redirect('/', '/login') ->name('login'); But only if not logged in..? How do I use a "route helper"?
awcodes
awcodes2y ago
What is the route you use to login to filament? I think you’re just doing it backwards.
benshawuk
benshawukOP2y ago
Maybe! 😄 I'm using /login to log into Filament, but it's just using the Jetstream login page. I chose to do it this way, because then I get 'register', 'forgot password' etc. that Jetstream provides.
awcodes
awcodes2y ago
The important part is ->name(‘login’). Laravel specifically redirects log outs to that route name. So you need to assign it as the name so it properly redirects back to filament’s login.
benshawuk
benshawukOP2y ago
How do I do that without defining the route? (which is presumably already defined by Jetstream)?
awcodes
awcodes2y ago
But if you’re using jetstream for all the auth functionality, you shouldn’t even be using Filaments login. So just set it to null in the config.
benshawuk
benshawukOP2y ago
It was all working fine when I had my "home" set to '/admin'. But I wanted to change it to '/'. Setting Filament's 'pages' => [ 'login' => NULL ] does nothing. I still get: Route [filament.auth.login] not defined when logging out. Also, when logged out, '/' gives that same error. So to summarise, '/' works for Filament when logged in. '/login' works when logged out, but '/' when logged out gives me Route [filament.auth.login] not defined.
awcodes
awcodes2y ago
Maybe change the Authentication middleware in the filament config to use jetstreams’s. Some how you’re creating a loop. Also, do you need the sanctum middleware for non api routes? There’s also the #breezy plugin that will give you all the functionality without needing to do all this yourself. And in v3 it will be out of the box.
benshawuk
benshawukOP2y ago
Good to know! I’ll check out the plug-in and carry on messing with it. I didn’t realise sanctum was just for API routes. Eagerly awaiting v3! 😁. Thanks for your help.
.
.17mo ago
How did you solve the problem ? I need help please this

Did you find this page helpful?