Laravel-WebAuthn example application

This is an example use of asbiin/laravel-webauthn package.

Demo

Try this application on this live demo app.

  • Just register with any email
  • Then add a WebAuthn key
  • Next login will ask to confirm the key

Accounts are automatically deleted after 24h on this demo instance.

Installation

In order to test the application, you need to:

  • Clone this repository

  • Install packages and configuration:

    composer install
    yarn install
    yarn run build
    cp .env.example .env
    php artisan key:generate
  • Configure database. You can use an sqlite database, just put DB_CONNECTION=sqlite in the .env file:

    sed -i 's/\(DB_CONNECTION\)=.*/\1=sqlite/' .env
    touch database/database.sqlite
  • Migrate database and setup the environment.

    php artisan setup
  • Run a webserver

    • You'll need to point you webserver to the public directory. Follow instructions on the Laravel documentation.

    • WebAuthn protocol requires HTTPS mode, and forbid the localhost url.

    • Use laravel serve command, and a tool like ngrok:

      1. php artisan serve
      2. ngrok http http://127.0.0.1:8000
      3. you can use the https version of the ngrok output

Usage

Got to https://url.test/webauthn/register to register a new key.

License

Author: Alexis Saettler

Copyright © 2019–2024.

Licensed under the MIT License. View license.