statview/filament-passkeys

0.1.11 2024-05-23 08:45 UTC

This package is auto-updated.

Last update: 2024-11-23 09:56:02 UTC


README

Installation

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())
            // ...
    }    
}

Credits

Inspired and created by following the following article: https://blog.joe.codes/implementing-passkey-authentication-in-your-laravel-app