Integrating with OneSDK

Learn how to integrate FrankieOne’s IDV and Biometrics services using the FrankieOne SDK (OneSDK) for a streamlined and efficient implementation.

Introduction to OneSDK

The FrankieOne SDK (OneSDK) is the recommended solution for integrating IDV and Biometrics services into your web and mobile applications. It is designed to simplify the implementation process by abstracting the complexities of direct API interactions and providing pre-built UI components to guide your users through the verification process.

Why Use the OneSDK?

  • Simplified Integration: The SDK reduces development time by handling the low-level API calls for session creation, data submission, and result polling.
  • Seamless User Experience: Pre-built UI components ensure a consistent and intuitive user journey for document capture and biometric authentication.
  • Enhanced Data Accuracy: The SDK includes optimized workflows for capturing high-quality document images and biometric data, which improves verification success rates.
  • Robust Error Management: Built-in error handling and reporting mechanisms simplify troubleshooting and enhance the reliability of your integration.
  • Continuous Updates and Support: The SDK is actively maintained by FrankieOne, ensuring compatibility with the latest features, security standards, and provider updates.

Implementation Steps

Integrating the OneSDK involves a four-step process: obtaining a session token from your backend, initializing the SDK on your frontend, presenting the UI to the user, and handling the results.

1

1. Obtain a Session Token

Before initializing the OneSDK on your client-side application, you must securely fetch a session token from your backend. This requires a server-to-server call to the FrankieOne authentication endpoint. Never expose your API Key in frontend code.

1// Example: Server-side code (Node.js) to fetch a session token
2import fetch from 'node-fetch';
3
4const CUSTOMER_ID = 'YOUR_CUSTOMER_ID';
5const API_KEY = 'YOUR_API_KEY';
6const AUTH_ENDPOINT = '[https://backend.kycaml.uat.frankiefinancial.io/auth/v2/machine-session](https://backend.kycaml.uat.frankiefinancial.io/auth/v2/machine-session)';
7
8async function fetchSessionToken() {
9 try {
10 const response = await fetch(AUTH_ENDPOINT, {
11 method: 'POST',
12 headers: {
13 'authorization': 'machine ' + Buffer.from(`${CUSTOMER_ID}:${API_KEY}`).toString('base64'),
14 'Content-Type': 'application/json',
15 },
16 body: JSON.stringify({
17 permissions: {
18 preset: 'one-sdk',
19 reference: "your-unique-customer-reference", // A unique reference for the user session
20 },
21 }),
22 });
23
24 if (!response.ok) {
25 console.error('Failed to fetch session token:', response.status);
26 return null;
27 }
28
29 return await response.json();
30 } catch (error) {
31 console.error('Error fetching session token:', error);
32 return null;
33 }
34}
2

2. Initialize OneSDK

In your frontend application, use the session token obtained in the previous step to initialize the OneSDK. You can also configure the SDK with a “recipe” to define the specifics of the verification flow, such as the number of documents to capture.

1// Example: Client-side code to initialize OneSDK
2import OneSDK from '@frankieone/one-sdk';
3
4async function initializeOneSdk() {
5 // This function should call your backend to get the session token
6 const sessionTokenResult = await yourBackend.fetchSessionToken();
7
8 if (sessionTokenResult && sessionTokenResult.session) {
9 const oneSdk = await OneSDK({
10 session: sessionTokenResult,
11 mode: "production", // or "sandbox"
12 recipe: {
13 ocr: {
14 maxDocumentCount: 3,
15 },
16 },
17 });
18 return oneSdk;
19 } else {
20 console.error('Failed to initialize OneSDK due to missing session token.');
21 return null;
22 }
23}
3

3. Present the Verification UI

Once the SDK is initialized, you can call its methods to launch the pre-built user interface. This UI will guide the user through all the necessary steps, such as selecting their document type, taking photos, and completing the selfie/liveness check.

4

4. Handle Verification Events and Results

The SDK emits events throughout the verification process. Your application should listen for these events to track the user’s progress and handle the final outcome. Implement callbacks to manage success, error, or user cancellation scenarios. Please refer to the detailed OneSDK documentation for a complete list of events and how to handle them.


Service Flows Handled by the SDK

By using the OneSDK, you abstract away the complexity of the underlying service flows. The SDK seamlessly manages:

  • Document Capture and Validation: Ensures high-quality images are captured and submitted for analysis.
  • Selfie Capture and Facial Comparison: Guides the user through the selfie process and matches it against the document photo.
  • Liveness Detection: Verifies that the user is physically present, preventing spoofing attempts.
  • Integration with IDV Providers: Manages all communication with the underlying IDV and Biometrics vendors.