Admin panel 403 in production

May 30, 2022
Dan Harrin
Admin panel, FAQ

If you've deployed your Filament admin panel to a non-local environment and you're receiving 403 Forbidden errors when trying to access it, it's likely that you've forgotten to set up your User model to access Filament.

You must implement the FilamentUser contract:

namespace App\Models;
use Filament\Models\Contracts\FilamentUser;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable implements FilamentUser
// ...
public function canAccessFilament(): bool
return str_ends_with($this->email, '') && $this->hasVerifiedEmail();

The canAccessFilament() method returns true or false depending on whether the user is allowed to access Filament. In this example, we check if the user's email ends with and if they have verified their email address.

You can find this information in our documentation.

Julio Cesar Daza Urbina

I have tried this a thousand times, and no matter what I do, I still get the same 403 forbidden error on DigitalOcean Apps. I need help because I need to go into production and I can't figure it out.

👍 1

Hi, This maybe unrelated but I got this to work ok on digital ocean droplets using the devdojo laravel 10 marketplace offering. Not sure about the apps...

When adding filament, did you create a filament user? :)


public function hasVerifiedEmail() { return ! is_null($this->email_verified_at); }


Don't forget to add class User extends Authenticatable implements FilamentUser