0
  • Laravel
  • JavaScript
  • PHP
  • Linux
  • Linux Commands
  • Servers
  • Vue
  • WordPress
Laramatic Laramatic
Laramatic Laramatic
Laramatic Laramatic
  • Laravel
  • JavaScript
  • PHP
  • Linux
  • Linux Commands
  • Servers
  • Vue
  • WordPress
0
Laramatic Laramatic
  • Laravel
  • JavaScript
  • PHP
  • Linux
  • Linux Commands
  • Servers
  • Vue
  • WordPress
0
face detection 4760361 1280
Laramatic > PHP > Laravel – Add FaceID And TouchID Login Apps
PHPLaravel

Laravel – Add FaceID And TouchID Login Apps

July 2, 2021 2 Min Read

There is a new and existing package which allows users to register physical authentication devices (FaceID or TouchID on iPhones and Macs, Fingerprints on Android, Hello on Windows and USB keys). This will save their time and effort to enter credentials. Because, no one wants to enter credentials anymore, I mean are we living in caves?

So after installing Laravel we have to run this composer command.

composer require m1guelpf/laravel-fastlogin

Then add \M1guelpf\FastLogin\Models\Concerns\HasFastLogin trait into you User Model like this.

class User extends Authenticatable
{
    use CanFastLogin;
}

Now after taking care of everything on backend, lets talk about front end. We need to run this command in terminal.

yarn add @web-auth/webauthn-helper js-cookie

This will add packages like @web-auth/webauthn-helper and js-cookie in your app. Now you need this code to make things work.

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()
    })
}

So after having done that, we hope the users of your Laravel app will never require to enter credentials like ancient web culture days.

Note: Due to Apple’s restrictions, you can only call the creation function after a user gesture, that is, the function needs to be invoked in the user-generated event (like a “click” event).

Tags: faceId laravel login touchId

What’s your reaction?

Love
0
Sad
0
Happy
1
Sleepy
0
Angry
0
Dead
1
Wink
0
0 Shares
Share on Facebook Share on Twitter Share on Pinterest Share on WhatsApp Share on WhatsApp Share on Reddit Share on Email
Previous Article mkc install How To Install Mkc_install In Debian, Ubuntu, Kali, Raspbian And MacOS?
Next Article valac 0 14 How To Install Valac-0.14 On Debian, Ubuntu And Raspbian?

Leave a Review

Cancel reply

Your email address will not be published. Required fields are marked *

Please select a rating

Popular Posts

firewall applet

Firewall-applet Installation On A Debian, Ubuntu, Arch, Kali, CentOS, Fedora And Raspbian

linguist

How To Install Linguist.exe In Fedora?

amk hy int64

How To Install Amk_hy-int64 On Debian, Ubuntu, Kali, Fedora And Raspbian?

sogo tool

Sogo-tool Installation On A Debian, Ubuntu, Kali And Raspbian

You Might also Enjoy

Untitled 21 1
Laravel

How to Install Bootstrap 5 in Laravel 9

May 16, 2022
How to upload image by drag and drop using Dropzone JS in Laravel 9
Laravel

How to Upload Image by Drag and Drop Using Dropzone JS in Laravel 9?

March 7, 2022
Laravel 9 7
Laravel

How to Print or Get Last Database Executed Query in Laravel 9?

March 5, 2022
7 New programming languages for developers to learn in 2020
PHP

What is Null Safety Operator in PHP8?

November 2, 2021
Load More

© Copyright 2021 Laramatic.

We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
Cookie SettingsAccept All
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT

Our website uses cookies to improve your experience. Learn more about: cookie policy

Accept