Can't login with the custom guard

Laravel v10.23.0 Filament v3.0.48 Caches cleared, cookies cleared. Session driver is file, I've also tried redis but no luck. When I try to login I'm being kicked back to the login page. There are no errors in the log or browser console, no flash messages. In the debugger I see that the login is successful (Pages\Auth\Login::authenticate logs in the user), but the user is not persisted in the session. How do I troubleshoot? The setup:
// auth.php
'defaults' => [
'guard' => 'web',
'passwords' => 'users',
],
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'admin' => [
'driver' => 'session',
'provider' => 'admins',
],
],
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\Models\User::class,
],
'admins' => [
'driver' => 'eloquent',
'model' => App\Models\Admin::class,
],
]
// AdminPanelProvider.php
public function panel(Panel $panel): Panel
{
return $panel->
// ...
authGuard('admin')->
// everything else including the middleware is default
}
// auth.php
'defaults' => [
'guard' => 'web',
'passwords' => 'users',
],
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'admin' => [
'driver' => 'session',
'provider' => 'admins',
],
],
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\Models\User::class,
],
'admins' => [
'driver' => 'eloquent',
'model' => App\Models\Admin::class,
],
]
// AdminPanelProvider.php
public function panel(Panel $panel): Panel
{
return $panel->
// ...
authGuard('admin')->
// everything else including the middleware is default
}
2 Replies
alexanderkroneis
alexanderkroneis15mo ago
Not sure tho, but try setting the password broker as well. I don't think that's related, but I have the same config + password broker and it's working
thenaquad
thenaquadOP15mo ago
password broker is set, here it is:
'passwords' => [
'users' => [
'provider' => 'users',
'table' => 'password_reset_tokens',
'expire' => 60,
'throttle' => 60,
],
'admins' => [
'provider' => 'admins',
'table' => 'password_reset_tokens',
'expire' => 60,
'throttle' => 60,
]
],
'passwords' => [
'users' => [
'provider' => 'users',
'table' => 'password_reset_tokens',
'expire' => 60,
'throttle' => 60,
],
'admins' => [
'provider' => 'admins',
'table' => 'password_reset_tokens',
'expire' => 60,
'throttle' => 60,
]
],
and the corresponding authPasswordBroker call for the panel i've managed to request the password reset successfully @alexandergaal could you please show your middleware configurations? both the admin panel provide and the kernel? damn... it was the livewire missing the StartSession middleware. when explicitly adding StartSession to the global middleware it works. when adding the StartSession to either of panel's middleware/authMiddleware it doesn't after rearranging my middleware groups and copy-pasting the middleware from the demo it worked
Want results from more Discord servers?
Add your server