Filament Shield: 403 Forbidden on Production but Works Fine Locally

Hi everyone, I need some help regarding an issue I’ve been facing with Filament Shield in a Laravel project. We’re using Filament Shield to handle permissions for our admin panel. On local development, everything works perfectly. After migrating the database, I run:
php artisan shield:install
php artisan shield:install
It prompts me to input name, email, and password for a super admin user. Once that's done, I can log in and access all admin resources via /admin as expected. However, in production, I followed the exact same steps:
Run php artisan migrate

Run php artisan shield:install (filled in user details)
Run php artisan migrate

Run php artisan shield:install (filled in user details)
Login using the generated user But when I try to access /admin, I get a 403 Forbidden error. I'm guessing it has something to do with the role/permission assignment or caching, but I’m not sure.
8 Replies
Matthew
Matthew4d ago
Things changed with the new version of filament shield (^v3.3) Which version are you on?
Mohamed Ayaou
Mohamed Ayaou4d ago
Did you setup the canAccessPanel method on the user Model?
Illizian
Illizian4d ago
Yeah, I had this issue. Filament auth isn't checked whilst APP_ENV is set to local IIRC
Matthew
Matthew4d ago
In the new version of shield, you need to run shield:setup
Arlyzatun
ArlyzatunOP3d ago
i am using
"php": "^8.2",
"bezhansalleh/filament-shield": "3.2.6",
"filament/filament": "^3.2",
"laravel/framework": "^11.31",
"php": "^8.2",
"bezhansalleh/filament-shield": "3.2.6",
"filament/filament": "^3.2",
"laravel/framework": "^11.31",
thanks guys, solved using canAccessPanel, thanks
Illizian
Illizian2d ago
Yeah---! Really, really need to change that feature

Did you find this page helpful?