F
Filamentβ€’2mo 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β€’2mo ago
Check your error logs
Rolin
Rolinβ€’2mo ago
I don't get anything in my error logs
toeknee
toekneeβ€’2mo ago
inspect the browser console, on logging in do you see any issues?
Rolin
Rolinβ€’2mo ago
Console log also nothing
toeknee
toekneeβ€’2mo ago
And then result of the network request from clicking login?
Rolin
Rolinβ€’2mo 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β€’2mo ago
Make sure your AdminPanelPrivider has ->default() on it.
Rolin
Rolinβ€’2mo 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β€’2mo ago
Is it a Laravel/Filament fresh install?
Rolin
Rolinβ€’2mo 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β€’2mo ago
You should create another fresh install and check if it works..
Rolin
Rolinβ€’2mo 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β€’2mo ago
so, they are different πŸ€·β€β™‚οΈ
Rolin
Rolinβ€’2mo 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β€’2mo ago
something is wrong in your project, not in Filament I guess
Rolin
Rolinβ€’2mo ago
Do you have any idea what is maybe wrong? Or a direction in where I can search?
LeandroFerreira
LeandroFerreiraβ€’2mo ago
hum.. no
Rolin
Rolinβ€’2mo ago
It's something with the session/cookie. I've installed breeze also and that's also not working.
LeandroFerreira
LeandroFerreiraβ€’2mo ago
Moving all models and migrations to the new app would be more efficient than spending time with this issue πŸ˜…
Rolin
Rolinβ€’2mo 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
More Posts
Grouping Filters using Section or Fieldset returns an error, please help 😭I get `Method Filament\Forms\Components\Fieldset::table does not exist.` I do import (or at least I How-to create table filter from model accessorHello, I have an app that uses Laravel batches and I have a field on my "batched" model to track theselect 'default' not working in filter action/formsI am trying to filter dashboard widget using filter action/forms, I provide months options and try tHow to get team_id when creating new record from Relation ManagerI have a Relation Manager `ConversionsRelationManager` I'm trying to create new record from there buCurator Image Not Found (Production)I am using curator but I am getting Not Found for image url in production, note that I am passing itBug with File Upload in RepeaterHi, i have a problem with file uploader (You can see my screenshot) in repeater. So i can't uploadAuto scroll to selected navigation not implement in spa() mode?Today I am just checking out `spa()` mode and everything seems working so far in resources, pages etIs there a way to have both Split and ->label?Want: Labels displayed as labels in a Split layout (or switch to default layout with proper labels (TextColumn action not working as expected```php Tables\Columns\TextColumn::make('title') ->action(function (Tables\Columns\TextColumn $colMultiple Unexpected Fetch Requests Triggered When Closing Modal After Create Action### Package Actions ### Package Version v3.2 ### How can we help you? **Problem:** I have a sim