How it works
The user onboarding flow works as follows:- User navigates to your registration page.
- Before serving the front-end, your server communicates with Frankie’s server to create a temporary session.
- Your server passes the session object to your front-end for it to initialize OneSDK using the session object.
- OneSDK modules are activated to handle the collection and processing of identity verification data.
- You verify the individual using OneSDK’s
submit()method.
1
Create a session and forward it to your front-end
Construct the API credentials
- Serialize your FrankieOne API credentials to a string using the ’:’ separator.
- Encode the resulting string using Base64 encoding.
Shell
JavaScript
Obtain a temporary session token
Send aPOST request to the /machine-session endpoint of our Backend for Frontend server (BFF). The appropriate URL for BFF depends on the environment you’re integrating with:| Environment | URL |
|---|---|
| Demo | <https://backend.demo.frankiefinancial.io/auth/v1/machine-session> |
| UAT | <https://backend.kycaml.uat.frankiefinancial.io/auth/v1/machine-session> |
| Production | <https://backend.kycaml.frankiefinancial.io/auth/v1/machine-session> |
Different Base URL”>
The base URL for the/machine-session endpoint is different to the server
API.Authorization request header using machine as the scheme:Authorization: machine YOUR_ENCODED_CREDENTIALInclude the following parameters in the body of the request:| Parameter name | Required | Description || Parameter | Required | Description |
|---|---|---|
permissions | Required | A hash containing preset and either entityId or reference. |
permissions.preset | Required | The string 'one-sdk'. |
permissions.reference | Required* | A string containing a unique customer reference for the individual being verified. If a new reference is used, once the individual completes verification this value can be used to retrieve the details via the API or the Portal. If an existing reference is used, the existing data will be retrieved and the new information captured by users will be attached to the same entity. |
permissions.entityId | Required* | A string containing the entity ID for the individual being verified. |
entityId or reference is required, but not both.The following example creates a session object for a user using a unique customer reference:Shell
JavaScript
Don’t publish your credentials to your front-end. They should remain accessible only from your server.
JSON
Pre-fill applicant data
If you use an existing reference orentityId when creating a session object, OneSDK will retrieve the existing data and pre-fill the applicant, and new information captured by the user will be updated to the same entity:JavaScript
2
Set up OneSDK
Use OneSDK to onboard an individual into your application.Import the SDK into your application:If you install OneSDK as an npm package, you are responsible for updating the version in your
Sample configuration:Pass the entire object returned from the response of the Otherwise, you can use Javascript’s Promise API.
Install the SDK
We recommend installing OneSDK via a<script> tag so that your webpage always receives the latest, most up-to-date version.Embed script
The URL below will point to the latest stable v1 version. Alternatively, you can point to a specific version by swapping out thev1 URL parameter with a specific major and minor version (i.e. v1.6.1-beta).JavaScript
NPM Module
We’re working on enabling other frameworks such as Next.js, Vue, and React + Webpack.
Shell
package.json file to ensure you always have the most up-to-date version.Create a configuration object
Create an object for the global configuration of your SDK integration. This section shows the required and recommended parameters.| Parameter name | Required | Description |
|---|---|---|
session | Required, unless mode is specified as "dummy". | The session object from your call to /machine-session. |
mode | Optional | One of "production" or "dummy". If this is set as "dummy", then session doesn’t need to be specified. The default value is "production". |
/machine-session endpoint as the value for the session parameter. Don’t extract the token or any other field from the response.For example, your code may look like this:JavaScript
JavaScript
Initialize the OneSDK object
Create an instance of OneSDK using the configuration object you created.TheOneSDK function returns a promise, which can be await-ed in JavaScript ES2017’s await.3
Verify document details via OCR
Use the OCR Component provided by OneSDK to verify document details.
Create the OCR Component
Create an instance of the OCR Component by passing'ocr' in component(type).JavaScript
Obtain results
Listen to theresults event to get notified when the OCR extracted results are available.Handle errors
Listen to theerror event to handle any errors from the OCR component. For example, the supplied image may not be processable.Start the document capture flow
Finally, start the document capture flow by mounting the OCR component.4
Verify biometrics
Use the Biometrics Component provided by OneSDK to verify the user’s facial image/video.You may skip this step if biometrics isn’t required in your onboarding flow.If you are using JavaScript frameworks such as Vue or React, make sure that you use references instead of selectors and that you don’t re-render the DOM element.Listen to the
Create the container element for the Biometrics component
Create a DOM container element on your onboarding web page where you want the component to be rendered. Make sure to give the container element a descriptive ID. The container element for Biometrics and OCR components can be the same.For example:Create the Biometrics component
Create an instance of the Biometrics component by passing'biometrics' in component(type, options?).JavaScript
Obtain results
Listen to theresults event to get notified when biometrics results are available.JavaScript
Handle errors
Handle detection failed events
When the biometrics component fails to detect the user, it will emit adetection_failed event.You can re-attempt another capture by mounting the component again upon receiving the detection_failed event.error event to handle any other errors.Start the biometrics flow
Mount the component
Finally, start the facial capture flow by mounting the component in your container element.Get notified when the capture feed is ready
The component may take a moment to initialize and display the image/video capture feed. During this time you can optionally display your own loading state. Listen to theready event to know when the biometrics capture feed is ready to use.5
Submit information
Access the Individual object to represent the person being onboarded.Make sure that the user consent has been added and then submit the information to verify the individual according to your recipe.