Skip to main content
The Urtentic Web SDK provides a simple way to integrate identity verification into your web application. It offers pre-built UI components and a JavaScript API to guide users through the verification process.

Installation

npm install @urtentic/web-sdk

Integration Options

The Urtentic Web SDK offers two main integration options:

Web Components

Pre-built UI components for quick integration with the <urtentic-button> element

JavaScript API

Direct SDK initialization for custom UI implementations with full control

Using Web Components

The SDK provides the <urtentic-button> web component which creates a customizable verification button.

Add the Button to Your HTML

<!DOCTYPE html>
<html>
<head>
    <title>Urtentic Verification Example</title>
    <script src="https://cdn.urtentic.com/sdk/latest/urtentic.js"></script>
</head>
<body>
    <h1>User Verification</h1>

    <urtentic-button
        clientId="YOUR_CLIENT_ID"
        flowId="YOUR_FLOW_ID"
        metadata='{"userId": "123", "customField": "value"}'>
    </urtentic-button>
</body>
</html>

Handling Verification Events

const verificationButton = document.querySelector('urtentic-button');

// SDK loaded and ready
verificationButton.addEventListener('urtentic:loaded', (event) => {
    console.log('SDK loaded and ready');
});

// User started the verification process
verificationButton.addEventListener('urtentic:userStartedSdk', (event) => {
    console.log('User started verification', event.detail);
});

// Verification complete
verificationButton.addEventListener('urtentic:userFinishedSdk', (event) => {
    console.log('Verification complete', event.detail);
});

// User exited the verification flow
verificationButton.addEventListener('urtentic:exitedSdk', (event) => {
    console.log('User exited verification', event.detail);
});

Using the JavaScript API

For more control over the verification flow, use the JavaScript API directly:
Urtentic.init({
    flowId: 'YOUR_FLOW_ID',
    clientId: 'YOUR_CLIENT_ID',
    metadata: '{"userId": "123", "customField": "value"}',
    redirect: 'https://yoursite.com/success',

    userStartedSdk: (detail) => {
        console.log('User started verification', detail);
    },
    userFinishedSdk: (detail) => {
        console.log('Verification complete', detail);
    },
    exitedSdk: (detail) => {
        console.log('User exited verification', detail);
    }
});

Configuration Parameters

ParameterTypeRequiredDescription
clientIdStringYesYour Urtentic client ID
flowIdStringYesThe ID of the verification flow
metadataStringNoJSON string with additional data
redirectStringNoRedirect URL after completion
userStartedSdkFunctionNoCallback when user starts verification
userFinishedSdkFunctionNoCallback when verification is complete
exitedSdkFunctionNoCallback when user exits the flow

Customizing the Button

urtentic-button::part(button) {
    background-color: #ff5722;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 18px;
}

Browser Compatibility

The Urtentic Web SDK is compatible with all modern browsers:
BrowserSupport
ChromeLatest 2 versions
FirefoxLatest 2 versions
SafariLatest 2 versions
EdgeLatest 2 versions
For older browsers, the SDK automatically includes polyfills for Web Components.