SDK

SDK Usage

Currently we provide SDK for JavaScript. More SDKs will be available soon.
Follow below steps to get started with JavaScript SDK.

Installation

Our JavaScript SDK is available via URL. You can include it in your HTML file as below.

<script src="https://dev-api.skortorent.com/sdk/skor.js"></script>

Intialize

After including the SDK, you need to initialize it with your public key as below.

const sdk = Skor({
  publicKey: 'YOUR_PUBLIC_KEY'
});

Start Profile Session

To start a profile session, you need to call the startProfileSession method with a unique user token, generated via API.

To Generate token, you need to first create a tenant using Create Tenant API. After creating a tenant, you can generate a token via Generate Onboarding token API.

profileSessionInstance = sdk.startProfileSession({
    token,
    containerId: "skor-container"
});

Callbacks

You can also provide callback functions to handle various events during the profile session. Detail about callbacks are as below.

1. onLoad: This callback is triggered when the profile session is successfully loaded.
onLoad: () => {
    console.log("Profile Session loaded");
}

2. onSkorAnalysisRunning: This callback is triggered when profile registration is completed, and skor analysis is running. During this time, you might want to show a loader to the user. As you can't show the profile session UI until skor analysis is complete.
onSkorAnalysisRunning: () => {
    console.log("Skor Analysis is currently running");
}

3. onCancel: This callback is triggered when the user cancels the profile session or method cancel is called.
onCancel: () => {
    console.log("Profile Session Cancelled");
}

4. onError: This callback is triggered when an error occurs during the profile session.
onError: (error) => {
    console.log("Profile Session error");
}

5. onProfileReady: This callback is triggered when the profile session is ready to be used.
onProfileReady: () => {
    console.log("Profile Session ready");
}}