
Add FaceID and TouchID Login to Your Laravel Apps
Fast Login for Laravel is a plugin to allow your users to login with FaceID/TouchID:
🚀 Introducing Laravel FastLogin
Add “Sign in with FaceID/TouchID” to your web apps, in less than a minute!https://t.co/Z9gEdzeHeN
— Miguel Piedrafita is taking a break (@m1guelpf) January 25, 2021
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:
1import Cookies from 'js-cookie'
2import { useLogin } from '@web-auth/webauthn-helper'
3
4const onClick = () => {
5 const token = Cookies.get('XSRF-TOKEN')
6
7 useLogin({
8 actionUrl: route('fastlogin.login'),
9 optionsUrl: route('fastlogin.login.details'),
10 actionHeader: {
11 'x-xsrf-token': token
12 },
13 }, {
14 'x-xsrf-token': token
15 })().then(() => {
16 // the user has been logged in
17
18 window.location.reload()
19 })
20}
You can learn more about this package, get full installation instructions, and view the source code on GitHub.
Credit: Source link