Web Integration

Documentation for Integrating with Smile ID on the Web

The web Integration Widget is a client-side component that your web site or web application can use to have your users verify their identity with Smile ID. The web integration widget is a hosted solution and handles the image capture, user consent, job submission and error handling for the product you are want to run.

Guide

  • Set up a callback endpoint

  • Choose a Server to Server Library

  • Create an endpoint for the web token

  • Install the Web Integration

  • Use the Web Integration

Set Up a Callback Endpoint

All jobs using the Web Integration are asynchronous. As such, having a Callback Endpoint in your Server is important.

Here's our guide on how to set up a callback endpoint.

Choose a Server to Server Library

We currently have Server to Server Libraries in the following languages / run-times.

In this documentation, our code samples will use the NodeJS Server to Server library.

Create an EndPoint for the Web Token

Using your chosen Server to Server library, create an endpoint for fetching a token.

This is our sample NodeJS script that uses our NodeJS Server-to-Server library.

const express = require('express');
const { v4: UUID } = require('uuid');
const cors = require('cors');

if (process.env.NODE_ENV === 'development') {
  const dotenv = require('dotenv');

  dotenv.config();
}

const SIDCore = require('smile-identity-core');
const SIDWebAPI = SIDCore.WebApi;

const app = express();

app.use(cors());
app.use(express.json({ limit: '500kb' }));

// NOTE: you can make this endpoint use the `POST` method,
// and pass a User ID, Job ID, or Product Type from your system.
app.get('/token', async (req, res, next) => {
  try {
    const { PARTNER_ID, CALLBACK_URL, API_KEY, SID_SERVER } = process.env;
    const connection = new SIDWebAPI(
      PARTNER_ID,
      CALLBACK_URL,
      API_KEY,
      SID_SERVER
    );

    const request_params = {
      user_id: `user-${UUID()}`,
      job_id: `job-${UUID()}`,
      product: 'biometric_kyc', // Choose one of 'authentication', 'basic_kyc', 'smartselfie', 'biometric_kyc', 'enhanced_kyc', 'doc_verification'
      callback_url: CALLBACK_URL
    };

    const result = await connection.get_web_token(
      request_params
    );

    res.json(result);
  } catch (e) {
    // handle error
    console.error(e);
  }

This is all the Server-Side configuration needed for the Web Integration.

Install the Web Integration

Read more in the Installation page

Use the Web Integration

Read more in the Usage page

Last updated