Vue

Accura Face Plugin — Vue 3 Integration Guide

This guide walks you through integrating the Accura Face Plugin into a Vue 3 project built with Vite.


Prerequisites

Before proceeding, ensure the following requirement is met:

  • accura.xml — Place your accura.xml license file in the public/ folder of your project as public/accura.xml. This file is required by the plugin to initialize the face detection engine. You can download it from here.

941KB
Open

Step 1: Initialize Project

If you do not have an existing Vue 3 project, scaffold one using Vite:

npm create vite@latest my-face-app -- --template vue
cd my-face-app
npm install

Step 2: Install Plugin

Install the Accura Face Plugin package from the npm registry:


Step 3: Implementation

Create a dedicated scanner component at components/FaceScanner.vue. The following snippet shows only the plugin import and initialization logic:


Step 4: Response Handling

When the plugin captures a valid face, it invokes the base64Handler callback with an object containing a base64 property — a Data URL string representing the captured face image encoded in Base64 format (e.g., data:image/jpeg;base64,/9j/...).

What is Base64? Base64 is a binary-to-text encoding scheme that converts raw binary image data into a sequence of printable ASCII characters. The prefix segment (e.g., data:image/jpeg;base64,) conveys the MIME type, while the remainder is the encoded image payload. This format enables safe and seamless transmission over text-based HTTP protocols without requiring binary transfer mechanisms.

The following handler demonstrates forwarding the image to a remote verification endpoint:


Step 5: Demo Implementation

The following is the complete, production-ready component. Copy and paste it directly into components/FaceScanner.vue. The original logic is preserved exactly as-is.


Step 6: Usage

Import and use the component in App.vue:


Step 7: Running the Project

Last updated