What is FACEIO?
FACEIO is a facial authentication platform from PixLab ↗ that lets a web application enroll and authenticate users by face without requiring passwords, OTPs, or dedicated biometric sensors in the FACEIO flow. It uses a standard webcam or smartphone camera in supported modern browsers.
The client-side library is fio.js. It exposes two primary methods: enroll() for registration and authenticate() for sign-in, plus a restartSession() utility for multi-operation flows. FACEIO coordinates the authentication flow while the facial recognition engine selected by the application owner performs facial matching and manages biometric hashes. Your application receives a resolved Promise with the user's Facial ID and any payload
data you attached at enrollment.
New to FACEIO?
Start with the 5-Minute Setup Guide to create your first application and get your Public ID from the FACEIO Console ↗.
fio.js Library Integration
fio.js works in supported modern browsers with a standard webcam or smartphone camera, with no dedicated biometric sensor required. The JavaScript library is framework-agnostic and can be used with React, Vue, Angular, Next.js, or plain JavaScript.
1
Import fio.js to Your Site
Paste the following snippet before the closing </body> tag on any page where you want facial authentication. The library is loaded from FACEIO's
CDN ↗
. Self-hosting is not supported, so integrations receive supported fio.js updates from the FACEIO CDN.
-
Always load
fio.jsfrom cdn.faceio.net ↗. Self-hosting is not supported. - Prefer a build tool? Install via the official NPM package ↗.
- Framework-specific guides (React, Vue, Angular, Next.js) are in the Community Tutorials section.
2
Instantiate a faceIO Object
Instantiate faceIO() with your application's Public ID. This ID is available in the Application Manager on the FACEIO Console ↗.
Before you continue, make sure you have:
- Created a FACEIO application and selected a Facial Recognition Engine via the FACEIO Console ↗.
- Reviewed Security Options (PIN policy, domain restrictions) in the Security Best Practices guide.
- Reviewed Privacy Recommendations including how Facial IDs are handled, per the Privacy Best Practices guide.
3 Invoke the Widget
With fio.js loaded and your faceIO() instance ready, start the facial recognition process by calling either method exposed by the class:
Registers a new user via face recognition. The passwordless equivalent of a traditional sign-up.
Authenticates a previously enrolled user. The passwordless equivalent of a traditional sign-in.
Reference Template
The HTML Boilerplate section provides a complete reference implementation with both methods and full error handling wired up.
enroll() - Enroll New User
Triggers the FACEIO Widget to register a new user with face recognition. This is the passwordless equivalent of a traditional sign-up flow. On success, returns a Promise resolving with a
userInfo object containing the user's unique Facial ID, enrollment timestamp, and demographic estimates including gender and age.
Syntax
promise = faceio.enroll({ parameters })
enrol()
register()
record()
userInfo object on success, or rejects with a fioErrCode on failure.
Description
When called, the FACEIO Widget requests user consent when required, asks for camera access, and submits the capture to the facial recognition engine selected by the application owner using only two frames, making it extremely bandwidth-efficient.
FACEIO does not store, handle, or access biometric hashes. The selected facial recognition engine creates and manages the biometric hashes used for matching, while your integration receives the resulting Facial ID and enrollment data.
payload parameter attaches arbitrary data (email, userId, name, etc.) to the enrolled user. This data is returned upon every successful authentication
of that user. Max size: 16 KB; Base64-encode any non-ASCII or binary content.
Parameters
Accepts a single optional object. All properties are optional:
Return Value
A Promise resolving with a userInfo object on success, or rejecting with an error code on failure:
Example
- Store the returned
facialIdin your database as the user's unique authentication key. - The
payloadis echoed back verbatim on every futureauthenticate()call for this user. - See the HTML Boilerplate for a full working reference.
authenticate() - Authenticate User
Triggers the FACEIO Widget to verify a previously enrolled user. This is the passwordless equivalent of a traditional sign-in flow. On success, returns a Promise resolving with a
userData object containing the user's Facial ID, authentication timestamp, and the payload attached at enrollment.
Syntax
promise = faceio.authenticate({ parameters })
auth()
recognize()
identify()
userData object on success, or rejects with a fioErrCode on failure.
Description
When called, the FACEIO Widget prompts for camera access and compares the capture with the enrolled face index for your application. Capture length depends on camera permission, image quality, liveness checks, network conditions, and the configured flow.
Facial matching is performed by the selected facial recognition engine. FACEIO does not store, handle, or access biometric hashes, and your client-side integration works with the returned authentication result.
payload data attached during enroll() is returned verbatim inside the resolved userData
object. Validate the returned facialId and apply your own server-side authorization rules before creating an application session.
Parameters
Accepts a single optional object. All properties are optional:
Return Value
A Promise resolving with a userData object on success, or rejecting with an error code on failure:
Example
- Compare the returned
facialIdagainst your database to authorize the session. - The enrollment
payload(e.g. email, userId) is available inuserData.payload- no extra DB lookup needed. - See the HTML Boilerplate for a complete wired-up reference.
restartSession() - Restart Session
Resets the current FACEIO session so that a new
enroll() or
authenticate()
call can be made on the same page without a full page reload. Useful for multi-user flows such as kiosk terminals, event check-in stations, or any scenario where multiple people use the same browser session sequentially.
Syntax
boolean = faceio.restartSession()
true when the session is successfully reset and ready for a new operation; otherwise false.Description
Once enroll() or authenticate() resolves (or rejects), the internal FACEIO session is marked as consumed. Any subsequent call to either method on the same faceIO instance without resetting will reject immediately with fioErrCode.SESSION_IN_PROGRESS.
Calling restartSession() clears this state, making the instance ready for another recognition operation.
- Kiosk / shared terminal - Let multiple users authenticate sequentially on the same device without a page reload.
- Enroll-then-authenticate flow - Enroll a new user, then immediately authenticate them on the same page to confirm successful enrollment.
- Retry after error - Reset after a failed operation so the user can try again without refreshing.
faceIO instance. If you have instantiated multiple faceIO objects (not recommended), each has its own independent session state.Premium Feature
Dynamic session generation is available to Premium Plans only. Upgrade your application from the FACEIO Console ↗ to use this feature.
Return Value
true - session was successfully cleared and the instance is ready for a new enroll() or authenticate() call.false when a new session could not be created.Error Codes - fioErrCode
When enroll() or authenticate() fail, the Promise rejects with a numeric fioErrCode value. Handle errors by switching on this value inside your .catch() handler. For restartSession(), check the returned boolean (true or false).
Error Handling Best Practice
Always implement comprehensive error handling with user-friendly messages. Use a switch statement or if-else chain to handle specific error codes and guide users appropriately (e.g. prompt enrollment when fioErrCode.UNRECOGNIZED_FACE is returned).
HTML Boilerplate
A complete reference implementation with both
enroll() and
authenticate()
fully wired with error handling. Use it as a starting point for your integration.
Important
Replace app-public-id with your real application Public ID from the FACEIO Console ↗.
Reference Template
Implementation Notes
-
The
enroll()call (line 31) includes apayloadwith sample user data. Customize this to match your application's needs. -
Store the returned
facialIdin your database and link it to the user's account for future authentication lookups. - The error handler (line 60) covers all common error codes. Customize the messages to match your application's tone.
-
This boilerplate requires a running HTTP server.
fio.jscannot be loaded directly from the local file system due to browser security restrictions. - Review our Security Best Practices and Privacy Best Practices guides before deploying to production.
Community Tutorials
Use these community-contributed guides to implement fio.js with React, Vue, Angular, Next.js, or plain JavaScript, and to review community examples for React Native and Flutter projects.
Official package for JavaScript build tools and framework-based projects.
View on NPMGet answers, share experiences, and connect with other FACEIO developers.
Join ForumComprehensive guide covering passwordless login, age verification, and liveness detection in one stack.
View TutorialBuild an attendance flow using FACEIO and plain JavaScript without a framework.
View TutorialBuild an AI vacation planner chatbot with secure facial authentication using Next.js.
View TutorialReplace traditional authentication with facial recognition in a React + Tailwind CSS application.
View TutorialComplete tutorial on implementing FACEIO facial authentication in a Vue.js application.
View TutorialStep-by-step freeCodeCamp guide to adding face recognition authentication to a React app.
View TutorialExplore modern authentication patterns for web apps using facial recognition technology.
View TutorialA comprehensive deep-dive covering all aspects of FACEIO implementation and best practices.
View TutorialBuild a face recognition login flow with plain JavaScript and no framework.
View TutorialBuild an efficient attendance monitoring system powered by FACEIO's facial recognition.
View TutorialShare a FACEIO implementation tutorial with the developer community.
Contact Us