<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: John Thiong'o</title>
    <description>The latest articles on DEV Community by John Thiong'o (@tqariuqij).</description>
    <link>https://dev.to/tqariuqij</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F909306%2F95a38e13-bdc0-41aa-b884-a0e182a6ae35.png</url>
      <title>DEV Community: John Thiong'o</title>
      <link>https://dev.to/tqariuqij</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tqariuqij"/>
    <language>en</language>
    <item>
      <title>React Context API login example using FaceIO for face authentication.</title>
      <dc:creator>John Thiong'o</dc:creator>
      <pubDate>Fri, 30 Sep 2022 05:29:18 +0000</pubDate>
      <link>https://dev.to/tqariuqij/react-context-api-login-example-using-faceio-for-face-authentication-4nn0</link>
      <guid>https://dev.to/tqariuqij/react-context-api-login-example-using-faceio-for-face-authentication-4nn0</guid>
      <description>&lt;p&gt;Hi there,&lt;/p&gt;

&lt;p&gt;In this build I am going to show the use of the React Context API and the useReduce hook to manage state in a react application. To demonstrate this we will build a user authentication react component, taking advantage of the simple FaceIO face authentication system to authenticate our users. Once they are authenticated we will then pass the user data to the state and be able to consume it in other components.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why we will use FaceIO.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://faceio.net/" rel="noopener noreferrer"&gt;FaceIO &lt;/a&gt;is a facial authentication system for websites and web based applications.&lt;/p&gt;

&lt;p&gt;FaceIO is,&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Very easy to implement. It takes less than 3 lines of code and basically entails adding a script like the google gtag. For more you can check &lt;a href="https://faceio.net/getting-started" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Seamless and does not entail the user getting FIDO keys, OTP codes and security questions thereby enhancing user experience in our site.&lt;/li&gt;
&lt;li&gt;Very secure. First it provides a defense level facial recognition accuracy ensuring that we accurately authenticate each and every user using their &lt;a href="https://faceio.net/facialid#facial-recognition-engine" rel="noopener noreferrer"&gt;facial recognition engine&lt;/a&gt;. Secondly it guarantees the privacy of the user by ensuring that there data is safe and also that they don’t actually store the face of the user but rather a &lt;a href="https://faceio.net/facialid#facial-recognition-engine" rel="noopener noreferrer"&gt;facial vector&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is part two of a two part series if you would like to follow along part one is &lt;a href="https://medium.com/@tqrqj/react-typescript-user-sign-up-form-using-faceio-for-face-authentication-652bee54c4cc" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;We are going to pick up from where we left last time. Firstly we are going to arrange our content appropriately&lt;/p&gt;

&lt;p&gt;In the src folder let us create a folder pages and in it create two files named Home.tsx and SignUp.tsx&lt;/p&gt;

&lt;p&gt;Next we are going to add react router dom&lt;/p&gt;

&lt;p&gt;So that your build should now look like this,&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F509rws8r7l64d9bqox81.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F509rws8r7l64d9bqox81.png" alt="fileStructure"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We are going to transfer all the contents of App.tsx to the home page except the SignUpForm.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const Home = () =&amp;gt; {
  return (
    &amp;lt;div className='min-h-screen flex flex-col '&amp;gt;
      &amp;lt;h1 className='text-3xl font-bold text-yellow-600 flex justify-center items-center'&amp;gt;
        FaceIO authentication using react and typescript
      &amp;lt;/h1&amp;gt;

    &amp;lt;/div&amp;gt;
  );
};

export default Home
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Import the signup component to the sign up page.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import SignupForm from '../components/SignupForm';

const SignUp = () =&amp;gt; {
  return (
    &amp;lt;div&amp;gt;
      &amp;lt;SignupForm /&amp;gt;
    &amp;lt;/div&amp;gt;
  );
};

export default SignUp;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let us now bring the react route dom into the App.tsx so that we are able to route to different pages of our app.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { BrowserRouter, Route, Routes } from 'react-router-dom';
import Home from './pages/Home';
import SignUp from './pages/SignUp';

function App() {
  return (
    &amp;lt;div className='min-h-screen flex flex-col justify-center items-center'&amp;gt;
      &amp;lt;BrowserRouter&amp;gt;
        &amp;lt;Routes&amp;gt;
          &amp;lt;Route path='/' element={&amp;lt;Home /&amp;gt;} /&amp;gt;
          &amp;lt;Route path='signup' element={&amp;lt;SignUp /&amp;gt;} /&amp;gt;
        &amp;lt;/Routes&amp;gt;
      &amp;lt;/BrowserRouter&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}

export default App;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Since now we have finished the arrangement of our site let us get into the gist of our build.&lt;/p&gt;

&lt;p&gt;We are going to create a login function to login through FaceIO (remember we had created a signup function in the &lt;a href="https://medium.com/@tqrqj/react-typescript-user-sign-up-form-using-faceio-for-face-authentication-652bee54c4cc" rel="noopener noreferrer"&gt;previous part&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Then we are going to take the user data we get from FaceIO response and pass it into the state using useContext and useReducer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Setting up useContext in React and Typescript.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let us create a new folder in src folder named context and in there a file named StateProvider.tsx, in there we will make userContext provider.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, {createContext, ReactNode} from 'react';


export const userContext = createContext()


const StateProvider: React.FC&amp;lt;{ children: ReactNode }&amp;gt; = ({ children }) =&amp;gt; {
  return(
    &amp;lt;userContext.Provider value={}&amp;gt;
    {children}
  &amp;lt;/userContext.Provider&amp;gt;
  )
};

export default StateProvider;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because we are using typescript we will need to provide types for our build,&lt;/p&gt;

&lt;p&gt;in src/@types/user.d.ts we will create the userContext type.&lt;/p&gt;

&lt;p&gt;So our createContext will be of type userContextType since when there will be no user the user will be null.&lt;/p&gt;

&lt;p&gt;Now let create a folder helpers in src and in it a file named Reducers.ts&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/** src/helpers/Reducer.ts */

import { userContextType, Action } from '../@types/user';


//the initial state of the user
export const initialState = {
  user: null,
};


//the action we are going to take when we login that is set the user
export const actionTypes = {
  SET_USER: 'SET_USER',
};


//the reducer function note the parameter type annotations
export const reducer = (state: userContextType, action: Action) =&amp;gt; {
  console.log(action);
  switch (action.type) {
    case actionTypes.SET_USER:
      return {
        ...state,
        user: action.user,
      };
    default:
      return state;
  }
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There is one type we did not define that is the action type let us update it accordingly&lt;/p&gt;

&lt;p&gt;Go to src/@types/user.d.ts and add,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;type Action = {
  type: 'SET_USER';
  user: Iuser;
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now once we are done with this we can update StateProvider as this,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { createContext, ReactNode, useReducer } from 'react';
import { userContextType } from '../@types/user';
import { initialState, reducer } from '../helpers/Reducers';

export const userContext = createContext&amp;lt;{
  state: userContextType;
  dispatch: React.Dispatch&amp;lt;any&amp;gt;;
}&amp;gt;({
  state: initialState,
  dispatch: () =&amp;gt; null,
});

const StateProvider: React.FC&amp;lt;{ children: ReactNode }&amp;gt; = ({ children }) =&amp;gt; {

//bring the useReducer hook and feed it with the reducer function and the initial state 

  const [state, dispatch] = useReducer(reducer, initialState);
return (

//update the value with the state and dispatch thus you are able to access this values in any component or page

    &amp;lt;userContext.Provider value={{ state, dispatch }}&amp;gt;
      {children}
    &amp;lt;/userContext.Provider&amp;gt;
  );
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Go to App.tsx import the StateProvider and wrap the entire build with it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;StateProvider&amp;gt;
      &amp;lt;div className='min-h-screen flex flex-col justify-center items-center'&amp;gt;
        &amp;lt;BrowserRouter&amp;gt;
          &amp;lt;Routes&amp;gt;
            &amp;lt;Route path='/' element={&amp;lt;Home /&amp;gt;} /&amp;gt;
            &amp;lt;Route path='signup' element={&amp;lt;SignUp /&amp;gt;} /&amp;gt;
          &amp;lt;/Routes&amp;gt;
        &amp;lt;/BrowserRouter&amp;gt;
      &amp;lt;/div&amp;gt;
&amp;lt;/StateProvider&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let us now create a login component to be able to feed user data to the state.&lt;/p&gt;

&lt;p&gt;In the folder componets create a file Login.tsx and in it create a login,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Link } from 'react-router-dom';
const Login = () =&amp;gt; {
  return (
    &amp;lt;div&amp;gt;
      &amp;lt;h1 className='text-3xl font-bold text-blue-600 mb-4'&amp;gt;
        Welcome, please login
      &amp;lt;/h1&amp;gt;
      &amp;lt;button className='w-full p-3  bg-blue-700 rounded-md text-white text-sm mb-4'&amp;gt;
        Login
      &amp;lt;/button&amp;gt;
&amp;lt;div&amp;gt;
        &amp;lt;p&amp;gt;You don't have an account? Please sign-up.&amp;lt;/p&amp;gt;
        &amp;lt;Link to='/signup'&amp;gt;
          &amp;lt;button className='w-full p-3 bg-white outline-blue-800 rounded-md text-blue-800 text-sm mb-4'&amp;gt;
            Sign Up
          &amp;lt;/button&amp;gt;
        &amp;lt;/Link&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  );
};
export default Login;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This component will be our gate guard that will refuse anyone admittance to our site unless they have loged in&lt;/p&gt;

&lt;p&gt;So in our home component we will need to make some few changes.&lt;/p&gt;

&lt;p&gt;We will query whether there is a user in the state that is if user is not null then we will show the home otherwise we will show&lt;br&gt;
the login component&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;..... return (
    &amp;lt;div className='min-h-screen flex flex-col '&amp;gt;
      {!state?.user ? (
        &amp;lt;Login /&amp;gt;
      ) : (
        &amp;lt;div&amp;gt;
          &amp;lt;h1 className='text-3xl font-bold text-yellow-600 flex justify-center items-center'&amp;gt;
            FaceIO authentication using react and typescript
          &amp;lt;/h1&amp;gt;
        &amp;lt;/div&amp;gt;
      )}
    &amp;lt;/div&amp;gt;
  );
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is how your page should look like by now,&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhbe9y5igrmaesb3qcykp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhbe9y5igrmaesb3qcykp.png" alt="login component"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let us now go back to the login component and update the logic, that is call FaceIO and dispatch user data.&lt;/p&gt;

&lt;p&gt;When we call FaceIO to authenticate (FaceIO authentication is documented here), and the authentication is successful we will receive a payload with the data the user provided when they signed up. That payload is what we are going to dispatch to the state.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { useContext, useEffect } from 'react';
import { Link } from 'react-router-dom';
import { userContext } from '../context/StateProvider';
import { actionTypes } from '../helpers/Reducers';
const Login = () =&amp;gt; {
  //we load faceIO using a useEffect hook
let faceio: any;
  useEffect(() =&amp;gt; {
    faceio = new faceIO('fioa48b7');
  }, []);
//we use a useContext hook dispatch to be able to dispatch our user to the state
  const { dispatch } = useContext(userContext);
//we set up the handle login function
  const handleLogin = async () =&amp;gt; {
    try {
      let response = await faceio.authenticate({
        locale: 'auto',
      });
      alert(`
        You have been identified successfully
        Unique Facial ID: ${response.facialId}
          PayLoad: ${JSON.stringify(response.payload)}
          `);
dispatch({ type: actionTypes.SET_USER, user: response.payload });
alert('You have successfully logged in');
    } catch (error) {
      console.log(error);
      alert('Failed to login, please refresh and try again');
    }
  };
return (
    &amp;lt;div className='flex flex-col justify-center items-center'&amp;gt;
      &amp;lt;h1 className='text-3xl font-bold text-blue-600 mb-4'&amp;gt;
        Welcome, please login
      &amp;lt;/h1&amp;gt;
      &amp;lt;button onClick={handleLogin} className='w-full p-3  bg-blue-700 rounded-md text-white text-sm mb-4'&amp;gt;
        Login
      &amp;lt;/button&amp;gt;
&amp;lt;div&amp;gt;
        &amp;lt;p&amp;gt;You don't have an account? Please sign-up.&amp;lt;/p&amp;gt;
        &amp;lt;Link to='/signup'&amp;gt;
          &amp;lt;button

            className='w-full p-3 bg-white outline-blue-800 rounded-md text-blue-800 text-sm mb-4'
          &amp;gt;
            Sign Up
          &amp;lt;/button&amp;gt;
        &amp;lt;/Link&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  );
};
export default Login;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once we are done with that our application is good and ready but let us add a welcome user statement in the home page.&lt;br&gt;
Under the h1 tags add.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;h2 className='text-blue-900 pt-28 font-bold'&amp;gt;
   Welcome {state.user.name} Email:{state.user.email}
&amp;lt;/h2&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We are now done, if you were successful, and you try loging in you will see,&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffjgww3cyk7f9lpispt59.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffjgww3cyk7f9lpispt59.png" alt="finished build"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The whole of this build can be found in Git&lt;a href="https://github.com/tqariuqij/react-typescript-faceio-authentication" rel="noopener noreferrer"&gt;&lt;/a&gt;hub, while you are there please add a star to it.&lt;/p&gt;

&lt;p&gt;For more on FaceIO&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://faceio.net/getting-started" rel="noopener noreferrer"&gt;The getting started guide.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://faceio.net/integration-guide" rel="noopener noreferrer"&gt;The integration guide.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://faceio.net/dev-guides" rel="noopener noreferrer"&gt;The Developer center.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://faceio.net/faq" rel="noopener noreferrer"&gt;The frequently asked questions section.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://faceio.net/trust-center" rel="noopener noreferrer"&gt;The trust center.&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;There are also some very interesting articles to get you on your way.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://medium.com/@tqrqj/ng-log-in-sign-up-form-using-faceio-next-js-and-tailwind-css-e463a56aa814" rel="noopener noreferrer"&gt;Login/Sign up form using FaceIO, Next.js and Tailwind CSS.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://medium.com/@ariankooshesh/face-it-faceio-just-makes-it-easy-7f975875030" rel="noopener noreferrer"&gt;Implementing facial authentication on a Vue.js app.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.freecodecamp.org/news/authenticate-with-face-recognition-reactjs" rel="noopener noreferrer"&gt;How to Authenticate a User with Face Recognition in React.js.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That is the conclusion for now but always check back for more content like this.&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>react</category>
      <category>webdev</category>
    </item>
    <item>
      <title>React-Typescript user sign-up form using FaceIO for face authentication.</title>
      <dc:creator>John Thiong'o</dc:creator>
      <pubDate>Thu, 29 Sep 2022 11:23:52 +0000</pubDate>
      <link>https://dev.to/tqariuqij/react-typescript-user-sign-up-form-using-faceio-for-face-authentication-4eki</link>
      <guid>https://dev.to/tqariuqij/react-typescript-user-sign-up-form-using-faceio-for-face-authentication-4eki</guid>
      <description>&lt;p&gt;Hi there,&lt;/p&gt;

&lt;p&gt;This is part of a two part series, where I am going to show you how to use React and Typescript coupled with &lt;a href="https://faceio.net/" rel="noopener noreferrer"&gt;FaceIO &lt;/a&gt;to sign-up, authenticate a user and consume user data in your website.&lt;/p&gt;

&lt;p&gt;What is FaceIO.&lt;/p&gt;

&lt;p&gt;FaceIO is a facial authentication framework to authenticate users via face recognition instead of the traditional login/password. It is implemented via a simple JavaScript snippet (like google tag). More &lt;a href="https://faceio.net/getting-started" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Why use FaceIO.&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;The simplicity. We all know the complexity and work that goes into creating a way to authenticate users to your website yet all we want to do is to register a user and be able to login the user every time they came back.&lt;br&gt;
In comes FaceIO with the easiest way to add passwordless authentication to your web based application. As we go on you will see how easy it is leaving us with more time to create amazing user experiences.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;FaceIO does not add to the bundle size of your project. As we will see we just add a script to the index.html and you are done.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It is compatible with pretty much every browser out there (Chrome, Firefox, Safari, Edge &amp;amp; Chromium derivatives).&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Let me now demonstrate the simplicity of FaceIO by building this sign-up form.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Initializing React, Typescript and Tailwind CSS in our project using Vite.&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Fire up you favorite code editor and open the bash terminal.&lt;/p&gt;

&lt;p&gt;I am going to use yarn so,&lt;/p&gt;

&lt;p&gt;&lt;code&gt;yarn create vite&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwvub07omg8lbrgm85df1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwvub07omg8lbrgm85df1.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can use &lt;code&gt;yarn dev — host&lt;/code&gt; to host your project and be able to access it via multiple devices.&lt;/p&gt;

&lt;p&gt;Let us add Tailwind CSS to our project.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;yarn add -D tailwindcss postcss autoprefixer&lt;br&gt;
npx tailwindcss init -p&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Go into src/tailwind.config.cjs and replace the contents with.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/** @type {import('tailwindcss').Config} */
module.exports = {
  content: [
    "./src/**/*.{js,jsx,ts,tsx}",
  ],
  theme: {
    extend: {},
  },
  plugins: [],
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you now run &lt;code&gt;yarn dev&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgnzeg3gl3kos7fvfdhfy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgnzeg3gl3kos7fvfdhfy.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now let me show you how easy it is to add FaceIO to your project.&lt;/p&gt;

&lt;p&gt;Go to index.html , note the contents and then replace them with&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;meta charset="UTF-8" /&amp;gt;
    &amp;lt;link rel="icon" type="image/svg+xml" href="/vite.svg" /&amp;gt;
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0" /&amp;gt;
    &amp;lt;title&amp;gt;FaceIO authentication using react + ts&amp;lt;/title&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;script src="https://cdn.faceio.net/fio.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;div id="root"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;script type="module" src="/src/main.tsx"&amp;gt;&amp;lt;/script&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see the only thing we have added is&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;script src=”https://cdn.faceio.net/fio.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;above the &lt;code&gt;&amp;lt;div id=”root”&amp;gt;&amp;lt;/div&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;It is as simple as that. More on the integration &lt;a href="https://faceio.net/integration-guide#fiojs-integration" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Before we begin implementing FaceIO in our project you will need to sign up on &lt;a href="https://console.faceio.net/" rel="noopener noreferrer"&gt;FaceIO console&lt;/a&gt;. Once you have signed up you will come to this page.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fctk1i0mip0gufxgm0bf3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fctk1i0mip0gufxgm0bf3.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select NEW FACEIO APPLICATION and follow the prompts.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2snxj0h9rw2sauousc3s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2snxj0h9rw2sauousc3s.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once done note the public Id.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fifs9m3qplrizbwu5gq2p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fifs9m3qplrizbwu5gq2p.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Before we continue to creating our sign-up form component let us also bring in tailwind css.&lt;/p&gt;

&lt;p&gt;Go to index.css and replace the contents with,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@tailwind base;
@tailwind components;
@tailwind utilities;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Go to app.tsx and replace its contents with this,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function App() {

  return (
    &amp;lt;div className='min-h-screen flex justify-center'&amp;gt;
      &amp;lt;h1 className='text-3xl font-bold text-yellow-600'&amp;gt;
        FaceIO authentication using react and typescript
      &amp;lt;/h1&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}

export default App;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your application should now look like this,&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fblf8jcyeg15etflo3kdz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fblf8jcyeg15etflo3kdz.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let us now create a new folder named components and in it a file named SignupForm.tsx&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fre9mtkf03l35ntweigt0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fre9mtkf03l35ntweigt0.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We will use react hook form to create our form let us add it to our project.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;yarn add react-hook-form @hookform/resolvers yup&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Make the necessary imports in the SignupForm.tsx.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { useForm } from 'react-hook-form';
import { yupResolver } from '@hookform/resolvers/yup';
import * as yup from 'yup';


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Import the form into app.tsx file and make necessary changes,&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz7b96ucwojqjb2j49y6b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz7b96ucwojqjb2j49y6b.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let us create the ui for form.&lt;/p&gt;

&lt;p&gt;Under the h1 tags in SignupForm.tsx,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;form className='space-y-6'&amp;gt;
        &amp;lt;div&amp;gt;
          &amp;lt;label
            htmlFor=''
            className='text-sm font-bold backdrop:bold text-gray-600 block'
          &amp;gt;
            Name
          &amp;lt;/label&amp;gt;
          &amp;lt;input
            type='text'
            placeholder='name'
            className='w-full p-2 border border-blue-900 rounded mt-1'
          /&amp;gt;
        &amp;lt;/div&amp;gt;
        &amp;lt;div&amp;gt;
          &amp;lt;label
            htmlFor=''
            className='text-sm font-bold backdrop:bold text-gray-600 block'
          &amp;gt;
            Email
          &amp;lt;/label&amp;gt;
          &amp;lt;input
            type='text'
            placeholder='email@mail.com'
            className='w-full p-2 border border-blue-900 rounded mt-1'
          /&amp;gt;
        &amp;lt;/div&amp;gt;
        &amp;lt;div&amp;gt;
          &amp;lt;button className='w-full py-2 px-4 bg-blue-700 rounded-md text-white text-sm'&amp;gt;
            Sign Up
          &amp;lt;/button&amp;gt;
        &amp;lt;/div&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now for the fun part of adding the logic, first let us create a new folder in the folder src with a file to store our types which we are going to use through out our build let us call it ,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/** src/@types/user.d.ts */

interface Iuser {
  name: string;
  email: string;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Back to our form let us define the data that we are going to take from the user and submit to faceIO to register the said user using yup. This should be done above the SignupForm declaration. This will also enable us to alert the user if any errors occur.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const SignupSchema = yup
  .object({
    name: yup.string().required(),
    email: yup.string().required(),
  })
  .required();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Inside the SignupForm function let us use the useForm from react-hook-form. It provides us with some handy functions that will help us to take input from the user and deliver it where we need like, register, handleSubmit and errors, as shown below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const {
    register,
    handleSubmit,
    formState: { errors },
  } = useForm&amp;lt;Iuser&amp;gt;({
    resolver: yupResolver(SignupSchema),
  });
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let us also create a onSubmit function that will enable us to submit the data we take from the user to FaceIO.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const onSubmit = (data: Iuser) =&amp;gt; {
    alert(JSON.stringify(data));
handleSignUp(data);
  };
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see inside there is a handleSignUp function let us define it but before we do that let us load FaceIO into our page using a useEffect hook, make the necessary import of useEffect then,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let faceio: any;
  useEffect(() =&amp;gt; {
    faceio = new faceIO('fioxxxxxx');
  }, []);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note the ‘fioxxxxx’ you should ensure that you have replaced it with your FaceIO public id.&lt;/p&gt;

&lt;p&gt;Let us now create the handleSignUp function&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const handleSignUp = async (user: Iuser): Promise&amp;lt;any&amp;gt; =&amp;gt; {
    try {
      let response: any = await faceio.enroll({
        locale: 'auto',
        payload: {
          name: `${user.name}`,
          email: `${user.email}`,
        },
      });
      alert(
        ` Unique Facial ID: ${response.facialId}
      Enrollment Date: ${response.timestamp}
      Gender: ${response.details.gender}
      Age Approximation: ${response.details.age}
      payload: ${JSON.stringify(response.details)}`
      );
    } catch (error) {
      alert('Unable to register you please refresh page and try again');
    }
  };
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see in it we have a try-catch block where in the try block we call a FaceIO function called enroll which takes a payload containing the name of the user and email which we will attain from the form. For more of the enroll function, check this &lt;a href="https://faceio.net/integration-guide#enroll" rel="noopener noreferrer"&gt;documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Let us now update the form tags to now be able to take in the user data and submit it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;form className='space-y-6' onSubmit={handleSubmit(onSubmit)}&amp;gt;
//....
&amp;lt;form/&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And the input fields,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;input 
            type='text'
            placeholder='name'
            {...register('name')}
            className='w-full p-2 border border-blue-900 rounded mt-1'
          /&amp;gt;
          {errors.name &amp;amp;&amp;amp; &amp;lt;p className='text-red-900'&amp;gt;{errors.name.message}&amp;lt;/p&amp;gt;}
//email input
&amp;lt;input
            type='text'
            placeholder='email@mail.com'
            {...register('email')}
            className='w-full p-2 border border-blue-900 rounded mt-1'
          /&amp;gt;
          {errors.email &amp;amp;&amp;amp; (
            &amp;lt;p className='text-red-900'&amp;gt;{errors.email.message}&amp;lt;/p&amp;gt;
          )}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And with that we are done the whole sign up form looks like,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { useEffect } from 'react';
import { useForm } from 'react-hook-form';
import { yupResolver } from '@hookform/resolvers/yup';
import * as yup from 'yup';
const SignupSchema = yup
  .object({
    name: yup.string().required(),
    email: yup.string().required(),
  })
  .required();
const SignupForm = () =&amp;gt; {
  let faceio: any;
  useEffect(() =&amp;gt; {
    faceio = new faceIO('fioa48b7');
  }, []);
const {
    register,
    handleSubmit,
    formState: { errors },
  } = useForm&amp;lt;Iuser&amp;gt;({
    resolver: yupResolver(SignupSchema),
  });
//create  a submit function that will submit the data
  const onSubmit = (data: Iuser) =&amp;gt; {
    alert(JSON.stringify(data));
handleSignUp(data);
  };
//create a signup function that will submit the data to faceIO by calling the function faceIO enroll
  const handleSignUp = async (user: Iuser): Promise&amp;lt;any&amp;gt; =&amp;gt; {
    try {
      let response: any = await faceio.enroll({
        locale: 'auto',
        payload: {
          name: `${user.name}`,
          email: `${user.email}`,
        },
      });
      alert(
        ` Unique Facial ID: ${response.facialId}
      Enrollment Date: ${response.timestamp}
      Gender: ${response.details.gender}
      Age Approximation: ${response.details.age}
      payload: ${JSON.stringify(response.details)}`
      );
    } catch (error) {
      alert('Unable to register you please refresh page and try again');
    }
  };
return (
    &amp;lt;div className='max-w-md mx-auto mt-4 bg-yellow-100 p-8 border border-gray-3000'&amp;gt;
      &amp;lt;h1 className='text-3xl font-bold text-blue-600 pb-5'&amp;gt;
        Sign-up form using FaceIO
      &amp;lt;/h1&amp;gt;
&amp;lt;form className='space-y-6' onSubmit={handleSubmit(onSubmit)}&amp;gt;
        &amp;lt;div&amp;gt;
          &amp;lt;label
            htmlFor=''
            className='text-sm font-bold backdrop:bold text-gray-600 block'
          &amp;gt;
            Name
          &amp;lt;/label&amp;gt;
          &amp;lt;input
            type='text'
            placeholder='name'
            {...register('name')}
            className='w-full p-2 border border-blue-900 rounded mt-1'
          /&amp;gt;
          {errors.name &amp;amp;&amp;amp; &amp;lt;p className='text-red-900'&amp;gt;{errors.name.message}&amp;lt;/p&amp;gt;}
        &amp;lt;/div&amp;gt;
        &amp;lt;div&amp;gt;
          &amp;lt;label
            htmlFor=''
            className='text-sm font-bold backdrop:bold text-gray-600 block'
          &amp;gt;
            Email
          &amp;lt;/label&amp;gt;
          &amp;lt;input
            type='text'
            placeholder='email@mail.com'
            {...register('email')}
            className='w-full p-2 border border-blue-900 rounded mt-1'
          /&amp;gt;
          {errors.email &amp;amp;&amp;amp; (
            &amp;lt;p className='text-red-900'&amp;gt;{errors.email.message}&amp;lt;/p&amp;gt;
          )}
        &amp;lt;/div&amp;gt;
        &amp;lt;div&amp;gt;
          &amp;lt;button className='w-full py-2 px-4 bg-blue-700 rounded-md text-white text-sm'&amp;gt;
            Sign Up
          &amp;lt;/button&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/form&amp;gt;
    &amp;lt;/div&amp;gt;
  );
};
export default SignupForm;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This should be the finished product.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnypgfnzujzc2udg9a7ge.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnypgfnzujzc2udg9a7ge.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In case of errors while inputting the form data.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3t0d4vg1b9f871fivji1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3t0d4vg1b9f871fivji1.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If everything is ok.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftasqzfqvypzqrr20s48h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftasqzfqvypzqrr20s48h.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you have loved this add a star to it over in &lt;a href="https://github.com/tqariuqij/react-typescript-faceio-authentication" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For more on FaceIO.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://faceio.net/getting-started" rel="noopener noreferrer"&gt;The getting started guide&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://faceio.net/integration-guide" rel="noopener noreferrer"&gt;The integration guide.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://faceio.net/dev-guides" rel="noopener noreferrer"&gt;The Developer center.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://faceio.net/faq" rel="noopener noreferrer"&gt;The frequently asked questions section.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://faceio.net/trust-center" rel="noopener noreferrer"&gt;The trust center.&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;There are also some very interesting articles to get you on your way.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://medium.com/@tqrqj/ng-log-in-sign-up-form-using-faceio-next-js-and-tailwind-css-e463a56aa814" rel="noopener noreferrer"&gt;Login/Sign up form using FaceIO, Next.js and Tailwind CSS&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://medium.com/@ariankooshesh/face-it-faceio-just-makes-it-easy-7f975875030" rel="noopener noreferrer"&gt;Implementing facial authentication on a Vue.js app.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.freecodecamp.org/news/authenticate-with-face-recognition-reactjs" rel="noopener noreferrer"&gt;How to Authenticate a User with Face Recognition in React.js.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That is the conclusion for now but part two is &lt;a href="https://medium.com/@tqrqj/react-state-management-using-usecontext-and-usereduce-hooks-with-faceio-face-authentication-addf05d3752" rel="noopener noreferrer"&gt;here&lt;/a&gt;, but always check in this space for more.&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>react</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Log in/Sign up form using FaceIO, Next.js and Tailwind CSS.</title>
      <dc:creator>John Thiong'o</dc:creator>
      <pubDate>Wed, 17 Aug 2022 05:28:00 +0000</pubDate>
      <link>https://dev.to/tqariuqij/log-insign-up-form-using-faceio-nextjs-and-tailwind-css-5bho</link>
      <guid>https://dev.to/tqariuqij/log-insign-up-form-using-faceio-nextjs-and-tailwind-css-5bho</guid>
      <description>&lt;p&gt;Hi there,&lt;/p&gt;

&lt;p&gt;I am going to show you an exciting new way to authenticate your users using facial recognition by &lt;a href="https://faceio.net/" rel="noopener noreferrer"&gt;faceIO&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is FaceIO?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is a facial authentication framework that can easily be integrated to any website or web app using a simple javaScript snippet.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why use facial integration and faceIO?&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Since the number of websites asking for passwords is constantly growing and the complexity of passwords needing to increase beyond that which the human brain can remember, facial recognition authentication is able to step in and provide a method of authentication that is simple and secure.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In cases where the website moderators want to substantially reduce the ability of a user to open multiple accounts or where the user identity needs to be verified, for example when using financial service provider's websites, facial recognition is able to provide authentication that is incomparable to other traditional forms of authentication. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In cases where the website moderators want to substantially reduce the ability of a user to open multiple accounts or where the user identity needs to be verified, for example when using financial service provider's websites, facial recognition is able to provide authentication that is incomparable to other traditional forms of authentication.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you want to know more you can read the &lt;a href="https://faceio.net/getting-started" rel="noopener noreferrer"&gt;faceIO starting guide&lt;/a&gt;, or &lt;a href="https://dev.to/unqlite_db/introducing-faceio-facial-authentication-for-the-web-3i71"&gt;this wonderful introduction&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Now let us get to the heart of the matter and integrate faceIO into a next.js login/signup form and you will experience the simplicity of faceIO.&lt;/p&gt;

&lt;p&gt;First we begin by initializing next.js in a new folder&lt;/p&gt;

&lt;p&gt;I will use yarn.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;yarn create next-app faceionextjsform&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Let us cd into the folder then add tailwind css to the project&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd faceionextjsform

yarn add -D tailwindcss postcss autoprefixer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create tailwind CSS configuration files that is tailwind.config.js and postcss.config.js by running this yarn command.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;yarn tailwindcss init -p&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Open tailwind.config.js and replace the contents with this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;module.exports = {
  content: [
    // add this lines
    "./pages/**/*.{js,ts,jsx,tsx}",

    "./components/**/*.{js,ts,jsx,tsx}",
  ],
  theme: {
    extend: {},
  },
  plugins: [],
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Update ./styles/globals.css. you may delete any other files.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/* ./styles/globals.css */
@tailwind base;
@tailwind components;
@tailwind utilities;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Go to pages/index.js and delete all the html and replace it with.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div className='bg-green-300 text-center text-white h-screen'&amp;gt;
      &amp;lt;Head&amp;gt;
        &amp;lt;title&amp;gt;face.IO login/signup form&amp;lt;/title&amp;gt;
        &amp;lt;meta name='description' content='a face.IO login form' /&amp;gt;
        &amp;lt;link rel='icon' href='/favicon.ico' /&amp;gt;
      &amp;lt;/Head&amp;gt;

      &amp;lt;main&amp;gt;
        &amp;lt;h1 className='text-xl font-bold'&amp;gt;home&amp;lt;/h1&amp;gt;
      &amp;lt;/main&amp;gt;
&amp;lt;/div&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Before we run our application add a new file _document.js to the pages folder. ( pages/_document.js )this is used to override the default &lt;code&gt;Document&lt;/code&gt; because we want to add a custom script tag to our site. This script tag will enable us to integrate the faceIO into our project by adding their CDN to the html. If you want to know more you can visit &lt;a href="https://faceio.net/integration-guide" rel="noopener noreferrer"&gt;faceIO integration guide&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The contents of _document.js will be&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import Document, { Html, Head, Main, NextScript } from 'next/document';
class MyDocument extends Document {
  static async getInitialProps(ctx) {
    const initialProps = await Document.getInitialProps(ctx);
    return { ...initialProps };
  }
render() {
    return (
      &amp;lt;Html&amp;gt;
        &amp;lt;Head&amp;gt;&amp;lt;/Head&amp;gt;
        &amp;lt;body&amp;gt;
          //note this script tag
          &amp;lt;script src='https://cdn.faceio.net/fio.js'&amp;gt;&amp;lt;/script&amp;gt;
          &amp;lt;Main /&amp;gt;
          &amp;lt;NextScript /&amp;gt;
        &amp;lt;/body&amp;gt;
      &amp;lt;/Html&amp;gt;
    );
  }
}
export default MyDocument;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run yarn dev and confirm that your application looks like this&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe7kbfo8i17bs5sw6dt20.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe7kbfo8i17bs5sw6dt20.png" alt="start page"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Inspect your site and confirm whether the faceIO CDN script is located inside the body tag&lt;/p&gt;

&lt;p&gt;Create a new root folder components and add a file SignUpForm.js (components/SignUpForm.js) Since I want to summarise this as much as possible I have taken the liberty of creating a form feel free to copy the code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from 'react';
const SignUpForm = () =&amp;gt; {
  return (
    &amp;lt;section className='h-full gradient-form bg-gray-200 md:h-screen'&amp;gt;
      &amp;lt;div className='container py-12 px-6 h-full'&amp;gt;
        &amp;lt;div className=' flex justify-center items-center flex-wrap h-full g-6 text-gray-800'&amp;gt;
          &amp;lt;div className=''&amp;gt;
            &amp;lt;div className='block bg-white shadow-lg rounded-lg'&amp;gt;
              &amp;lt;div className='lg:flex lg:flex-wrap g-0'&amp;gt;
                &amp;lt;div className='px-4 md:px-0'&amp;gt;
                  &amp;lt;div className='md:p-12 md:mx-6'&amp;gt;
                    &amp;lt;div className='text-center'&amp;gt;
                      &amp;lt;h4 className='text-xl font-semibold mt-1 mb-12 pb-1'&amp;gt;
                        Face Authentication by FaceIO
                      &amp;lt;/h4&amp;gt;
                    &amp;lt;/div&amp;gt;
                    &amp;lt;form&amp;gt;
                      &amp;lt;p className='mb-4'&amp;gt;
                        Please Sign Up if you do not have an account
                      &amp;lt;/p&amp;gt;
                      &amp;lt;div className='mb-4'&amp;gt;
                        &amp;lt;input
                          type='email'
                          className='form-control block w-full px-3 py-1.5 text-base font-normal text-gray-700 bg-white bg-clip-padding border border-solid border-gray-300 rounded transition ease-in-out m-0 focus:text-gray-700 focus:bg-white focus:border-blue-600 focus:outline-none'
                          placeholder='Your Email'
                          name='userEmail'
                        /&amp;gt;
                      &amp;lt;/div&amp;gt;
                      &amp;lt;div className='mb-4'&amp;gt;
                        &amp;lt;input
                          type='password'
                          className='form-control block w-full px-3 py-1.5 text-base font-normal text-gray-700 bg-white bg-clip-padding border border-solid border-gray-300 rounded transition ease-in-out m-0 focus:text-gray-700 focus:bg-white focus:border-blue-600 focus:outline-none'
                          placeholder='Password'
                          name='pin'
                        /&amp;gt;
                      &amp;lt;/div&amp;gt;
                      &amp;lt;div className='text-center pt-1 mb-12 pb-1'&amp;gt;
                        &amp;lt;button
                          className='bg-green inline-block px-6 py-2.5 text-black font-medium text-xs leading-tight uppercase rounded shadow-md hover:bg-blue-700 hover:shadow-lg focus:shadow-lg focus:outline-none focus:ring-0 active:shadow-lg transition duration-150 ease-in-out w-full mb-3'
                          type='button'
                          onClick={handleSubmit}
                        &amp;gt;
                          Sign Up
                        &amp;lt;/button&amp;gt;
                      &amp;lt;/div&amp;gt;
                      &amp;lt;div className='flex items-center justify-between pb-6'&amp;gt;
                        &amp;lt;p className='mb-0 mr-2'&amp;gt;Do you have an account?&amp;lt;/p&amp;gt;
                        &amp;lt;button
                          type='button'
                          className='inline-block px-6 py-2 border-2 border-green-600 text-green-600 font-medium text-xs leading-tight uppercase rounded hover:bg-black hover:bg-opacity-5 focus:outline-none focus:ring-0 transition duration-150 ease-in-out'
                          onClick={handleLogIn}
                        &amp;gt;
                          Log In
                        &amp;lt;/button&amp;gt;
                      &amp;lt;/div&amp;gt;
                    &amp;lt;/form&amp;gt;
                  &amp;lt;/div&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/section&amp;gt;
  );
};
export default SignUpForm;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Go to pages/index.js and replace the h1 tags in the main tag with.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;SignUpForm /&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Do not forget to import it&lt;/p&gt;

&lt;p&gt;Your form now should look like this&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl2k7ywp0ac7cfsgzflsq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl2k7ywp0ac7cfsgzflsq.png" alt="faceIO login form"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now go to &lt;a href="https://console.faceio.net/" rel="noopener noreferrer"&gt;faceIO console&lt;/a&gt; sign up then create a new project by following the steps once you are done you will get a public ID. Note it because we will use it here.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsy2a3erupzk60i3m5a4n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsy2a3erupzk60i3m5a4n.png" alt="setting up faceIO"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We are going to register a user. In order to do this we must first initialize faceIO object. We will do this inside a useEffect so that even if the state changes it will not reinitialize faceIO object, remember to import the useEffect.&lt;/p&gt;

&lt;p&gt;Go to signUpForm.js and add the useEffect.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//first import useEffect and useState
import React, { useEffect, useState } from 'react';
// initialize faceIO object
let faceio;
useEffect(() =&amp;gt; {
    faceio = new faceIO('xxxxxxxxx');
  }, []);
//replace xxxx.. with your project id

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In order to register a user we must have user registration logic (just the usual username and password) that will be stored together with the user facial authentication data for future reference ( faceIO does not store actual picture of the user but rather a vector which is hashed and cannot be reverse engineered ). You can read more about this &lt;a href="https://faceio.net/integration-guide#enroll" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let us collect the user data, we are going to use a useState hook (hooks are react.js superpower).&lt;/p&gt;

&lt;p&gt;We are going to map the values of the username and password into a payload variable object.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const [payload, setPayload] = useState({
    userEmail: '',
    pin: '',
  });
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Go to the input field of name userEmail and update it so that its value is mapped to the userEmail, do the same also to the input field with name pin&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;input type='email' className='form-control...' placeholder='Your Email'name='userEmail' defaultValue={payload.userEmail} /&amp;gt;
//and also
&amp;lt;input type='password' className='form-control...' placeholder='Your Email'name='pin' defaultValue={payload.userEmail} /&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We need to create an onchange function so that when the user types the info it can be stored in the payload object.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const onChange = (e) =&amp;gt; {
    setPayload({
      ...payload,
      [e.target.name]: e.target.value,
    });
  };

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Again do not forget to update the input fields by adding.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;onChange = {onChange}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;We will create a sign up function that takes in the payload and enrolls the user to faceIO. Note that &lt;a href="https://faceio.net/integration-guide" rel="noopener noreferrer"&gt;enroll&lt;/a&gt; is a method of the faceIO object.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const handleSignUp = async (payload) =&amp;gt; {
    try {
      let response = await faceio.enroll({
        "locale": "auto",
        "payload": { "email": `${payload.userEmail}`, "pin":  `${payload.pin}` }
});
console.log(` Unique Facial ID: ${response.facialId}
    Enrollment Date: ${response.timestamp}
    Gender: ${response.details.gender}
    Age Approximation: ${response.details.age}`);
    } catch (error) {
      console.log(error);
    }
  };

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let us now create a handleSubmit function that will submit all this info.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const handleSubmit = (e) =&amp;gt; {
    // prevents the submit button from refreshing the page
    e.preventDefault();
//just to confirm that payload has the info you may delete it after
    console.log(payload);
   handleSignUp(payload);
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let us update the sign up button with an onClick.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;onClick={handleSubmit}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;And as simply as that we have enrolled the user try it and you will see.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frhyznf1ad8cpzsvjaums.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frhyznf1ad8cpzsvjaums.png" alt="faceIO enrollment"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When that user comes in next time and wants to login he/she will only need to be authenticated.&lt;/p&gt;

&lt;p&gt;Let us make the handleLogIn function and update the log in button.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const handleLogIn = async () =&amp;gt; {
    try {
      let response = await faceio.authenticate({
        locale: 'auto',
      });
console.log(` Unique Facial ID: ${response.facialId}
        PayLoad: ${response.payload}
        `);
    } catch (error) {
      console.log(error);
    }
  };

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And with that we are done, see how simple it is.&lt;/p&gt;

&lt;p&gt;If you want to see the whole code you may access it in &lt;a href="https://github.com/tqariuqij/faceIOloginForm" rel="noopener noreferrer"&gt;github&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Since this is quite a summary let me provide you with some few links and more reading material so that you may be on your way to integrating faceIO into your favorite framework.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://faceio.net/getting-started" rel="noopener noreferrer"&gt;The getting started guide&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://faceio.net/integration-guide" rel="noopener noreferrer"&gt;The integration guide&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://faceio.net/dev-guides" rel="noopener noreferrer"&gt;The Developer center&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://faceio.net/faq" rel="noopener noreferrer"&gt;The frequently asked questions section&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://faceio.net/trust-center" rel="noopener noreferrer"&gt;The trust center&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;There are also some very interesting articles to get you on your way.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://medium.com/@ariankooshesh/face-it-faceio-just-makes-it-easy-7f975875030" rel="noopener noreferrer"&gt;Implementing facial authentication on a Vue.js app.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.freecodecamp.org/news/authenticate-with-face-recognition-reactjs" rel="noopener noreferrer"&gt;How to Authenticate a User with Face Recognition in React.js.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That is the conclusion for now but always check in this space for more.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>nextjs</category>
      <category>tailwindcss</category>
      <category>faceio</category>
    </item>
  </channel>
</rss>
