Web Portal Integration

Integrate SmartID into your web-based applications. Embed a JavaScript snippet to collect browser and device fingerprint data.

Overview

The web integration uses a JavaScript library that runs in the user's browser to collect device and session data. This data is encrypted and sent with the user's login credentials to your backend, which then forwards it to the SmartID API.

Installation

Include the SmartID Web SDK script in your login page:

HTML
<script src="https://cdn.smartidsuite.ai/sdk/smartid-web-v5.1.min.js"></script>
Note

The script URL will be provided by your SmartID account manager. The URL above is an example.

Integration

The web integration follows the same two-step process as mobile:

1. Collect Device Data

Initialize the SmartID SDK and collect encrypted device data:

JavaScript
// Initialize SmartID Web SDK
const smartId = SmartId.getInstance();

smartId
  .getRawData(/* optional */ 'backend_url')
  .onSuccess(function(time, response) {
    // response = encrypted device data string
    // Attach it to the login form submission
    document.getElementById('smartid-data').value = response;
  })
  .onFailure(function(time, message, errorCode) {
    // Log error, send empty data field
    console.error('SmartID error:', message, errorCode);
    document.getElementById('smartid-data').value = '';
  })
  .start();

2. Include in Login Form

Add a hidden input to your login form to carry the encrypted data:

HTML
<form action="/api/login" method="POST">
  <input type="text" name="username" placeholder="Username" />
  <input type="password" name="password" placeholder="Password" />
  <input type="hidden" name="smartid_data" id="smartid-data" />
  <button type="submit">Login</button>
</form>
Important

If the SDK returns a Failure callback, you must still send the login request to your backend, but with an empty data field.

3. Backend Processing

Your backend receives the form data including <code>smartid_data</code> and forwards it to the SmartID API. See the API Reference for complete endpoint details, request attributes, and examples.