Skip to main content

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 TypeDescription
Verification.ErrorEmitted when a verification operation encounters an error
Verification.ResultEmitted with the result of a verification attempt
Widget.AgeGate.ChallengeEmitted when the Age Gate flow triggers a challenge
Widget.AgeGate.ResultEmitted when the Age Gate flow completes with a result
Widget.DataNotices.ConsentApprovedEmitted when a user approves data notices consent
Widget.ExitReviewEmitted 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);
});