adriaanzon/filament-passkeys
Add passkey/WebAuthn authentication to Filament v5 panels. Use passkeys as a passwordless sign-in option with browser autofill, a second factor, or both. Users register and manage fingerprints, face ID, device PINs, and security keys from their profile page. Built on laravel/passkeys.
A Filament v5 panel plugin for passkey/WebAuthn authentication. Use passkeys as a second factor, as a passwordless sign-in option on the login page, or both. Users register passkeys (fingerprint, face, device PIN, security key) from their profile page. Built on top of laravel/passkeys.
Install the package via Composer:
composer require adriaanzon/filament-passkeys
Publish and run the laravel/passkeys migration:
php artisan vendor:publish --tag="passkeys-migrations"
php artisan migrate
Add the PasskeyUser contract and PasskeyAuthenticatable trait to your user model:
use Filament\Models\Contracts\FilamentUser;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Laravel\Passkeys\Contracts\PasskeyUser;
use Laravel\Passkeys\PasskeyAuthenticatable;
class User extends Authenticatable implements FilamentUser, PasskeyUser
{
use PasskeyAuthenticatable;
// ...
}
Register the plugin on your panel. See Configuration for all available modes.
use AdriaanZon\FilamentPasskeys\FilamentPasskeysPlugin;
use AdriaanZon\FilamentPasskeys\PasskeyAuthentication;
public function panel(Panel $panel): Panel
{
return $panel
->login()
->profile()
// ...
->plugins([
FilamentPasskeysPlugin::make()->passwordlessLogin(),
])
->multiFactorAuthentication([
PasskeyAuthentication::make()->managementOnly(),
]);
}
This plugin supports the following setups:
A "Sign in with passkey" button + browser autofill on the login page, with passkeys excluded from Filament's MFA challenge. The login form's "Remember me" checkbox is honored when signing in with a passkey.
Users can register and manage passkeys from their profile page. The ->managementOnly() setting keeps that UI intact while skipping the MFA challenge step.
->plugins([
FilamentPasskeysPlugin::make()->passwordlessLogin(),
])
->multiFactorAuthentication([
PasskeyAuthentication::make()->managementOnly(),
]);
If you'd rather use passkeys as a second factor on top of password login (and not enable passwordless sign-in), drop both ->passwordlessLogin() and ->managementOnly():
->plugins([
FilamentPasskeysPlugin::make(),
])
->multiFactorAuthentication([
PasskeyAuthentication::make(),
])
Filament's isRequired argument works with passkeys too. Users without a passkey are prompted to set one up before they can use the panel:
->multiFactorAuthentication([
PasskeyAuthentication::make(),
], isRequired: true)
[!WARNING] This doesn't work with
->managementOnly(): it excludes passkeys from MFA entirely, so users would get stuck on the set-up page even after registering one.
When a user is unable to access their passkey, they cannot get past the MFA challenge and would be locked out. Pair PasskeyAuthentication with one of Filament's built-in providers like EmailAuthentication so they can still sign in:
use Filament\Auth\MultiFactor\Email\EmailAuthentication;
->multiFactorAuthentication([
PasskeyAuthentication::make(),
EmailAuthentication::make(),
])
To use passkeys as both a login option and an MFA factor for password sign-ins, enable passwordless sign-in without ->managementOnly():
->plugins([
FilamentPasskeysPlugin::make()->passwordlessLogin(),
])
->multiFactorAuthentication([
PasskeyAuthentication::make(),
])
WebAuthn settings (relying party ID, allowed origins, user handle secret, timeout, throttling) live in laravel/passkeys's config/passkeys.php.
[!IMPORTANT] If you use Laravel Fortify, configure these settings in the
passkeysarray inconfig/fortify.phpinstead and skip the rest of this section. Fortify wrapslaravel/passkeysand ignores any values inconfig/passkeys.php.
Publish the config with:
php artisan vendor:publish --tag="passkeys-config"
The passkeys.throttle value is applied to every passkey endpoint this plugin registers (defaults to throttle:6,1).
Please see the releases for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.
How can I help you explore Laravel packages today?