Overview
UniLink Iframe (No Backend Required)
The fastest way to get started – just copy and paste your UniLink URL.What You Need
- A Didit workflow (created in the Didit Console)
- 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_dataormetadataper 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 namedurl — use that as the iframe src.
Listening for Events (postMessage)
The verification page posts events to the parent window. Every message has this envelope:event.data.data.sessionId, not event.data.sessionId:
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.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.
Modal Implementation
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 yourframe-src directive:
Cross-Device Verification
The InContext iframe automatically supports cross-device verification:- User starts verification on desktop
- If camera is unavailable, a QR code is shown
- User scans QR code on mobile
- User completes verification on mobile
- Desktop iframe automatically updates with result
Troubleshooting
Camera Not Working
- Ensure the iframe includes the full permission list
- Check that your site is served over HTTPS
- Verify the user has granted camera permissions to your domain
- Try the Redirect method if iframe camera access fails
Iframe Not Loading
- Check for Content Security Policy (CSP) issues
- Add
https://verify.didit.meto yourframe-srcdirective - Check browser console for errors
postMessage Not Received
- Verify you’re listening for the correct origin (
https://verify.didit.me, or your white-label domain) - Check that the event listener is added before opening the iframe
- Check the event name and shape: types are prefixed (
didit:completed, notverification_complete) and the payload is nested underevent.data.data
Example Repository
GitHub Repository
View source code and examples on GitHub