F
Filament3d ago
Luiz

Problem with Admin Panel Authentication - 403 Forbidden on Production

I'm having an issue with my Filament admin panel. On localhost, everything works fine, but on production, after logging in, I get a 403 Forbidden error. Here’s my setup: - I created a custom Admin model and set up a new guard admin in config/auth.php:
'guards' => [
'admin' => [
'driver' => 'session',
'provider' => 'admins',
],
],

'providers' => [
'admins' => [
'driver' => 'eloquent',
'model' => App\Models\Admin::class,
],
],
'guards' => [
'admin' => [
'driver' => 'session',
'provider' => 'admins',
],
],

'providers' => [
'admins' => [
'driver' => 'eloquent',
'model' => App\Models\Admin::class,
],
],
- I have two panels: - UserPanel using the User model and the default web guard. - AdminPanel using the Admin model and the admin guard. - My AdminPanelProvider.php config:
public function panel(Panel $panel): Panel
{
return $panel
->id('admin')
->path('admin')
->login()
->authGuard('admin')
...
;
}
public function panel(Panel $panel): Panel
{
return $panel
->id('admin')
->path('admin')
->login()
->authGuard('admin')
...
;
}
What I’ve done so far: - Tested locally: Works fine. - On production: The login page loads, but after logging in, it redirects and gives a 403 Forbidden. What I’ve checked: 1. The guard setup in auth.php is correct. 2. The Admin model is set up and has users in production. 3. The session domain and cookies in .env seem correct. 4. Cleared all caches (config:clear, route:clear, cache:clear, etc.). What could I be missing? Any help would be greatly appreciated!
2 Replies
Luiz
LuizOP3d ago
I had actually included the canAccessPanel function, but I had forgotten to also include the FilamentUser. Thank you

Did you find this page helpful?