statview/filament-passkeys

0.1.10 2023-11-30 13:06 UTC

This package is auto-updated.

Last update: 2024-04-30 00:40:06 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