Connect widget — a single script, no framework required.
This is a widget SDK — it renders Dojah’s UI with your widget_id and public_key. The Options below are the reference for every web widget; response events and the API-client alternative are covered in Choosing an SDK.
Install
Add the widget script to your page. Don’t useasync/defer — the inline code may run before the library loads.
index.html
Initialize
Create aConnect instance with your credentials and callbacks, then open it on a click:
app.js
type can be custom, vouch, register, or authenticate. Use custom for the EasyOnboard KYC widget, vouch for a Vouch flow, and register or authenticate for EasyAuthentication.
That is everything a flow needs — the widget collects the user’s details itself. To skip screens for data you already hold, add the prefill options below.
Prefill known data
user_data, gov_data, and gov_id exist purely to skip screens: user_data for name and date of birth, gov_data for BVN/NIN numbers, gov_id for ID images by URL. Add a key only when you already have a real value for it.
app.js
gov_id also accepts national, dl, permit, voter, and custom. The values above are the sandbox test BVN and a placeholder host — see Sandbox & test data for the full set of test values.
Options
See Handling the response for the callback model shared by every web widget.
Embed inline
By default the widget opens as a modal overlay. Setembed: true with a container selector to render it inside an element on your page instead:
app.js
TypeScript
Connect is attached to window at runtime, so declare it to keep TypeScript happy. Add a types/index.d.ts file and point compilerOptions.typeRoots at that folder:
types/index.d.ts
window:
app.ts
Resources
Camera permission denied on Android
Camera permission denied on Android
Loading the hosted flow in an iframe can fail in Chrome on Android with Camera permission denied or unavailable, even after the user allows the camera. The flow runs on Nginx:Apache:Iframe
The element that embeds the hosted flow must declare the same features:You can still prefill the flow with query parameters such as
identity.dojah.io, so the browser only grants the camera and location when your page delegates those permissions.Apply both changes below, deploy, then retry verification in an Android mobile browser.Permissions-Policy header
On the server or CDN that serves your site, allowhttps://identity.dojah.io to use the camera and geolocation:nginx.conf
httpd.conf
Iframe allow attribute
The element that embeds the hosted flow must declare the same features:index.html
user_data[first_name], user_data[last_name], user_data[dob], gov_data[bvn], gov_data[nin], and metadata[user_id]. Send a value only when you already have one — an empty parameter prefills the screen with a blank.- Widget script — widget.dojah.io/widget.js
- Hosted flow — identity.dojah.io · EasyOnboard
- Framework wrappers: React · React Native · Flutter