DOM events overview
This section documents DOM events emitted by k-ID widgets and flows. Use these events to react to user actions in your application. Event payload schemas are listed under Event structures.
Event structures
| Event Type | Description |
|---|---|
Verification.Error | Emitted when a verification operation encounters an error |
Verification.Result | Emitted with the result of a verification attempt |
Widget.AgeGate.Challenge | Emitted when the Age Gate flow triggers a challenge |
Widget.AgeGate.Result | Emitted when the Age Gate flow completes with a result |
Widget.DataNotices.ConsentApproved | Emitted when a user approves data notices consent |
Widget.ExitReview | Emitted when a widget exits a review flow by clicking on the 'Done' button |
Domain validation
When listening for DOM events, always validate the message origin to ensure events are coming from k-ID:
window.addEventListener('message', (event) => {
// Validate origin for security
if (!event.origin.endsWith('.k-id.com')) {
return;
}
// Handle the event
console.log('Event:', event.data);
});