Add FaceID and TouchID Login to Your Laravel Apps
Published on by Paul Redmond
Fast Login for Laravel is a plugin to allow your users to login with FaceID/TouchID:
🚀 Introducing Laravel FastLogin
— Miguel Piedrafita is taking a break (@m1guelpf) January 25, 2021
Add "Sign in with FaceID/TouchID" to your web apps, in less than a minute!https://t.co/Z9gEdzeHeN
This package supports various physical authentication devices:
Allow your users to register physical authentication devices (FaceID or TouchID on iPhones & Macs, fingerprint on Android, Hello on Windows and USB keys) to skip entering their login credentials.
The package takes care of (almost) everything you'll need to get this working in your app quickly. The server-side involves updating the User
model with a CanFastLogin
trait, and the document outlines the frontend usage you'll need to implement FaceID/TouchID logins.
Here's an example of the frontend code used to login a user with Touch/FaceID from the project's readme:
import Cookies from 'js-cookie'import { useLogin } from '@web-auth/webauthn-helper' const onClick = () => { const token = Cookies.get('XSRF-TOKEN') useLogin({ actionUrl: route('fastlogin.login'), optionsUrl: route('fastlogin.login.details'), actionHeader: { 'x-xsrf-token': token }, }, { 'x-xsrf-token': token })().then(() => { // the user has been logged in window.location.reload() })}
You can learn more about this package, get full installation instructions, and view the source code on GitHub.