Install the package
composer require statview/filament-passkeys
Run the migrations
php artisan migrate
Run the assets command of Filament
php artisan filament:assets
Add the HasPasskeys
trait to the user mode
<?php
use Statview\Passkeys\Concerns\HasPasskeys;
class User extends Model {
use HasPasskeys;
...
Exclude the passkeys
routes from the CSRF check
<?php
class VerifyCsrfToken extends Middleware
{
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array<int, string>
*/
protected $except = [
'passkeys/*',
];
}
Add our plugin to your Filament context(s)
<?php
use Statview\Passkeys\PasskeysPlugin;
class AdminPanel extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
// ...
->plugin(PasskeysPlugin::make())
// ...
}
}
Inspired and created by following the following article: https://blog.joe.codes/implementing-passkey-authentication-in-your-laravel-app