hoang79 / passkeyauth
Passkey for Laravel 11
Requires
- php: ^7.3|^8.0
- illuminate/support: ^8.0|^9.0|^10.0|^11.0
- laragear/webauthn: ^2.0
- nyholm/psr7: ^1.8
- phpdocumentor/reflection-docblock: ^5.4
- spomky-labs/cbor-php: ^3.0
- symfony/property-access: ^7.1
- symfony/psr-http-message-bridge: ^7.1
- symfony/serializer: ^7.1
- web-auth/webauthn-lib: ^4.8
README
English version below.
Voraussetzungen
- PHP [8.2]
- Laravel [11]
- Livewire [3.0]
- Jetstream [5.1]
- Datenbank (erste Migration bereits ausgeführt)
Einführung
Dieses Paket ermöglicht die Verwendung von Passkeys zur Authentifizierung in Laravel 11 Anwendungen. Passkeys sind eine benutzerfreundliche und sichere Alternative zu herkömmlichen Passwörtern. Sie können auf Mobilgeräten und in Passwortmanagern gespeichert werden und ermöglichen eine bequeme und sichere Anmeldung ohne Passwort.
Vorteile von Passkeys
- Benutzerfreundlichkeit: Kein Bedarf mehr, sich komplexe Passwörter zu merken.
- Sicherheit: Verhindert Phishing-Angriffe und Passwortdiebstahl.
- Kompatibilität: Funktioniert mit gängigen Passwortmanagern und mobilen Geräten.
Installationsanleitung
Paket installieren
-
Fügen Sie das Paket zu Ihrem Laravel-Projekt hinzu:
composer require hoang79/passkeyauth
-
Führen Sie den Passkey-Installer aus, um die notwendigen Anpassungen vorzunehmen:
php artisan passkey:install
Manuelle Anpassungen
-
Bearbeiten Sie die
.env
Datei:- Stellen Sie sicher, dass bei der
APP_URL
keinhttp(s)://
steht, sondern nur die Domain. Zum Beispiel:
APP_URL=laravel-passkey3.test
- Stellen Sie sicher, dass bei der
-
Passen Sie den Redirect bei der folgenden Zeile in
config/fortify.php
an:'home' => '/dashboard',
-
Passen Sie die Mail-Einstellungen in der
.env
Datei an, damit der OTP-Code versendet werden kann:MAIL_MAILER=smtp MAIL_HOST=127.0.0.1 MAIL_PORT=2525 MAIL_USERNAME="${APP_NAME}" MAIL_PASSWORD=null MAIL_ENCRYPTION=null MAIL_FROM_ADDRESS="hello@example.com" MAIL_FROM_NAME="${APP_NAME}"
-
Stellen Sie sicher, dass die notwendigen Migrationen ausgeführt wurden:
php artisan migrate
Nutzung
Nach der Installation und den notwendigen Anpassungen können Benutzer sich mit Passkeys registrieren und anmelden. Die Registrierung erfolgt über die Eingabe einer E-Mail-Adresse und das Erhalten eines OTP (One Time Password), gefolgt von der Speicherung des Passkeys.
Die Anmeldung erfolgt ebenfalls über die Eingabe der E-Mail-Adresse und das Verwenden des gespeicherten Passkeys.
Zukünftige Features
- OTP nochmals versenden
- Mit Mobilnummer und SMS anmelden
Weitere Informationen
Weitere Informationen zu Passkeys und deren Verwendung finden Sie in der offiziellen Dokumentation zu WebAuthn und den Passkey-Standards.
Laravel 11 Passkey Authentication
Requirements
- PHP [8.2]
- Laravel [11]
- Livewire [3.0]
- Jetstream [5.1]
- Database (initial migration already run)
Introduction
This package enables the use of passkeys for authentication in Laravel 11 applications. Passkeys are a user-friendly and secure alternative to traditional passwords. They can be stored on mobile devices and password managers, allowing for convenient and secure passwordless login.
Benefits of Passkeys
- User-Friendly: No need to remember complex passwords.
- Security: Prevents phishing attacks and password theft.
- Compatibility: Works with popular password managers and mobile devices.
Installation Guide
Install the Package
-
Add the package to your Laravel project:
composer require hoang79/passkeyauth
-
Run the Passkey installer to make the necessary adjustments:
php artisan passkey:install
Manual Adjustments
-
Edit the
.env
file:- Ensure that the
APP_URL
does not containhttp(s)://
, only the domain. For example:
APP_URL=laravel-passkey3.test
- Ensure that the
-
Adjust the redirect in
config/fortify.php
:'home' => '/dashboard',
-
Update the mail settings in the
.env
file to enable OTP code sending:MAIL_MAILER=smtp MAIL_HOST=127.0.0.1 MAIL_PORT=2525 MAIL_USERNAME="${APP_NAME}" MAIL_PASSWORD=null MAIL_ENCRYPTION=null MAIL_FROM_ADDRESS="hello@example.com" MAIL_FROM_NAME="${APP_NAME}"
-
Ensure the necessary migrations have been executed:
php artisan migrate
Usage
After installation and necessary adjustments, users can register and log in using passkeys. Registration involves entering an email address, receiving a One Time Password (OTP), and saving the passkey.
Logging in involves entering the email address and using the saved passkey.
Future Features
- Resend OTP
- Sign in with mobile number and SMS
Further Information
For more information on passkeys and their use, refer to the official WebAuthn documentation and passkey standards.
License
This package is licensed under the MIT License. For more details, see the LICENSE file.