Usage
Learn how to use the Azakaw Liveness Web SDK in your application.
Authentication
The SDK does not accept app-secret. Authentication is performed via a session-id issued by your backend through the Standalone Session flow:
- Your backend calls
POST /AppSessionManager/GetStandaloneSessionand receives asessionId. - Your backend hands the
sessionIdto the browser. - You pass that
sessionIdinto the<azakaw-liveness>element as thesession-idattribute. The SDK exchanges it for a JWT internally.
See Treat sessionId as a secret for the security guidance that applies to any page that holds a session-id.
Basic Implementation
The simplest way to implement the Web SDK is:
<azakaw-liveness
id="azakaw-liveness"
session-id="YOUR_SESSION_ID"
environment="Sandbox"
>
</azakaw-liveness>
Event Handling
You can listen for liveness events:
const azakawLivenessElement = document.getElementById('azakaw-liveness');
azakawLivenessElement.addEventListener('success', (result: CustomEvent<AzakawLivenessResult>) => {
console.log('Your liveness success', result.detail);
});
Full Implementation Example
Here's a complete example showing how to integrate the SDK:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Azakaw KYC Integration</title>
<script src="index.js" type="module"></script>
</head>
<body>
<div class="container">
<azakaw-liveness
id="azakaw-liveness"
session-id="YOUR_SESSION_ID"
host-origin="YOUR_HOST_ORIGIN"
environment="Sandbox"
></azakaw-liveness>
</div>
<script>
// Initialize the SDK
import '@azakawcompliance/azakaw-liveness-sdk';
// Get reference to the element
const azakawLivenessElement = document.getElementById('azakaw-liveness');
// Handle completion
azakawLivenessElement.addEventListener('success', (result) => {
console.log('Your liveness success', result);
});
</script>
</body>
</html>
Next Steps
See the API Reference for detailed information about all available options and events.