F
Filamentβ€’7mo ago
Rolin

Login not working it's refreshing the page

I have installed Filament in a Laravel application but when I want to log in and enter the correct credentials the page is refershing. The input fields are cleared but I'm not logged in. When I enter the wrong credentials I get an error message. So I assume that everything works for login only the last step to actually login is not working. Has someone any idea how to debug it more? Or even how to fix this?
20 Replies
toeknee
toekneeβ€’7mo ago
Check your error logs
Rolin
Rolinβ€’7mo ago
I don't get anything in my error logs
toeknee
toekneeβ€’7mo ago
inspect the browser console, on logging in do you see any issues?
Rolin
Rolinβ€’7mo ago
Console log also nothing
toeknee
toekneeβ€’7mo ago
And then result of the network request from clicking login?
Rolin
Rolinβ€’7mo ago
I've opened the Authenticate class from Filament it looks like something is going wrong here:
protected function authenticate($request, array $guards): void
{
$guard = Filament::auth();

if (! $guard->check()) {
$this->unauthenticated($request, $guards);

return;
}
protected function authenticate($request, array $guards): void
{
$guard = Filament::auth();

if (! $guard->check()) {
$this->unauthenticated($request, $guards);

return;
}
The guard is false so it will go in to the if statement. But the credentials are correct that's the strange part. When I enter not the correct credentials then it will show a message with credentials wrong
awcodes
awcodesβ€’7mo ago
Make sure your AdminPanelPrivider has ->default() on it.
Rolin
Rolinβ€’7mo ago
It have the ->default() on it.
class AdminPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
->default()
->id('admin')
->path('admin')
->login()
->colors([
'primary' => Color::Amber,
])
->discoverResources(in: app_path('Filament/Resources'), for: 'App\\Filament\\Resources')
->discoverPages(in: app_path('Filament/Pages'), for: 'App\\Filament\\Pages')
->pages([
Pages\Dashboard::class,
])
->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\\Filament\\Widgets')
->widgets([
Widgets\AccountWidget::class,
Widgets\FilamentInfoWidget::class,
])
->middleware([
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
AuthenticateSession::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
SubstituteBindings::class,
DisableBladeIconComponents::class,
DispatchServingFilamentEvent::class,
])
->authMiddleware([
Authenticate::class,
]);
}
}
class AdminPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
->default()
->id('admin')
->path('admin')
->login()
->colors([
'primary' => Color::Amber,
])
->discoverResources(in: app_path('Filament/Resources'), for: 'App\\Filament\\Resources')
->discoverPages(in: app_path('Filament/Pages'), for: 'App\\Filament\\Pages')
->pages([
Pages\Dashboard::class,
])
->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\\Filament\\Widgets')
->widgets([
Widgets\AccountWidget::class,
Widgets\FilamentInfoWidget::class,
])
->middleware([
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
AuthenticateSession::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
SubstituteBindings::class,
DisableBladeIconComponents::class,
DispatchServingFilamentEvent::class,
])
->authMiddleware([
Authenticate::class,
]);
}
}
LeandroFerreira
LeandroFerreiraβ€’7mo ago
Is it a Laravel/Filament fresh install?
Rolin
Rolinβ€’7mo ago
It's in a Laravel 11 application that I've created couple weeks ago with only some API endpoints I've added a fresh Filament install to it.
LeandroFerreira
LeandroFerreiraβ€’7mo ago
You should create another fresh install and check if it works..
Rolin
Rolinβ€’7mo ago
I've created another fresh install with Laravel 11 with Filament that works but I've checked all the things and everything is the same. So I don't get it why it's not working in an existing Laravel project?
LeandroFerreira
LeandroFerreiraβ€’7mo ago
so, they are different πŸ€·β€β™‚οΈ
Rolin
Rolinβ€’7mo ago
But where πŸ€” It is something with the guard I think. The hole login process is working for checking etc. but when it comes to the guard in authenticate then the guard->checks() is false. So something is going wrong with the guard but I've no idea what when I dump both the guards (existing laravel and the fresh one) both are the same also the request are the same. The only thing is that the fresh install is $guard->checks() is true and in the existing one is it false.
LeandroFerreira
LeandroFerreiraβ€’7mo ago
something is wrong in your project, not in Filament I guess
Rolin
Rolinβ€’7mo ago
Do you have any idea what is maybe wrong? Or a direction in where I can search?
LeandroFerreira
LeandroFerreiraβ€’7mo ago
hum.. no
Rolin
Rolinβ€’7mo ago
It's something with the session/cookie. I've installed breeze also and that's also not working.
LeandroFerreira
LeandroFerreiraβ€’7mo ago
Moving all models and migrations to the new app would be more efficient than spending time with this issue πŸ˜…
Rolin
Rolinβ€’7mo ago
I've found the issue. The session table want to have a integer as user_id but I'm using a uuid as id for the user so the session is not linked to the user.
Want results from more Discord servers?
Add your server