Skip to main content
Embed the Didit verification flow directly within your application using an iframe. This provides a seamless experience without redirecting users away from your site.

Overview


The fastest way to get started – just copy and paste your UniLink URL.

What You Need

  1. A Didit workflow (created in the Didit Console)
  2. Your UniLink URL (click Copy Link on your workflow)

Implementation

⚠️ Required: The allow attribute is mandatory for camera access during liveness detection.

Key Benefits

  • Less than 1 minute setup — No backend, no API keys
  • Zero configuration — Callback URL set in workflow settings
  • Ideal for MVPs — Get started immediately

API Session Iframe (With Backend)

For advanced integrations that need per-session customization.

When to Use

  • Pass custom vendor_data or metadata per session
  • Set different callback URLs per session
  • Track sessions server-side before verification starts
  • Associate sessions with your user IDs

Implementation

Step 1: Create a session (backend) The session-create response uses a field named url — use that as the iframe src.
Step 2: Embed in iframe (frontend)

Listening for Events (postMessage)

The verification page posts events to the parent window. Every message has this envelope:
The payload is nested — read event.data.data.sessionId, not event.data.sessionId:
Key events: didit:ready ({ sessionId }), didit:started, didit:step_started / didit:step_completed / didit:step_changed ({ step, ... }), didit:status_updated ({ status }), didit:completed ({ sessionId, status }), didit:cancelled, didit:error ({ error, step? }), didit:close_request, and didit:layout ({ contentHeight, colorScheme, dir }, see below). The JavaScript SDK event reference lists the verification events available as typed callbacks. From version 0.5.0, the SDK handles layout messages internally rather than forwarding them to onEvent.

Size the iframe from didit:layout

The verification page tells you how much room it needs with a didit:layout message. It sends one when it loads and another whenever its content height, theme or text direction changes:
To receive didit:layout in your own iframe, add sdk_presentation=embedded to its verification URL. From version 0.5.0, the JavaScript SDK sets the presentation for you. Without a presentation parameter, the page uses its standalone layout and does not send layout messages.
This host follows the recommended sizes: a fixed card from 1024px wide, full screen at 540px and below, and in between an iframe 500px wide that takes the height the page reports:
Between 541px and 1023px, this example uses a 700px starting height until a layout message arrives, capped at 90% of the visible window height. The computer and phone sizes apply immediately. On phones the iframe covers the window, so provide a way to leave verification in your host. Use colorScheme and dir to match any controls you draw around the iframe to the page’s theme and text direction. If the user’s connection drops, the page shows a “No internet connection” screen that closes by itself once the connection is back. If the user chooses Exit Verification there, the page sends didit:error with error: "network_error", then didit:cancelled: close the iframe on didit:cancelled.
For a polished modal experience that overlays your page:

HTML/CSS/JS


React Component

A reusable React component for modal-based verification:

Usage


Vue Component


Configuration

Required Permissions

Use this full permission list for capture, location, copying and media compatibility:
The allow attribute delegates permissions; it does not override the user’s choice or a stricter Permissions-Policy header on your host page.

Iframe size

The verification flow lays itself out for the size of its iframe. Size the iframe for the window it is shown in: For the middle range, start at 500px by 700px until the first didit:layout message arrives, with the same height cap. The didit:layout example applies all three sizes, including the computer and phone sizes before any message arrives.

Content Security Policy (CSP)

If you use CSP, add Didit to your frame-src directive:

Cross-Device Verification

The InContext iframe automatically supports cross-device verification:
  1. User starts verification on desktop
  2. If camera is unavailable, a QR code is shown
  3. User scans QR code on mobile
  4. User completes verification on mobile
  5. Desktop iframe automatically updates with result
This happens automatically – no additional configuration needed.

Troubleshooting

Camera Not Working

  1. Ensure the iframe includes the full permission list
  2. Check that your site is served over HTTPS
  3. Verify the user has granted camera permissions to your domain
  4. Try the Redirect method if iframe camera access fails

Iframe Not Loading

  1. Check for Content Security Policy (CSP) issues
  2. Add https://verify.didit.me to your frame-src directive
  3. Check browser console for errors

postMessage Not Received

  1. Verify you’re listening for the correct origin (https://verify.didit.me, or your white-label domain)
  2. Check that the event listener is added before opening the iframe
  3. Check the event name and shape: types are prefixed (didit:completed, not verification_complete) and the payload is nested under event.data.data

Example Repository

GitHub Repository

View source code and examples on GitHub

Last modified on October 31, 2026