Add FaceID and TouchID Login to Your Laravel Apps

Packages

July 1st, 2021

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:

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.

Filed in:

Paul Redmond

Full stack web developer. Author of Lumen Programming Guide and Docker for PHP Developers.