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, register, or authenticate. Use custom for the EasyOnboard KYC widget; use 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
- Widget script — widget.dojah.io/widget.js
- Hosted flow — identity.dojah.io · EasyOnboard
- Framework wrappers: React · React Native · Flutter