Javascript Library

The Dojah platform has a smooth widget that enables your users to authorize access to their accounts. This widget works effortlessly across various browsers and devices of all sizes.

How to Generate Widget

Using the Dojah CDN-hosted Javascript client library, you can install the Dojah widget into your application by simply adding a script tag to your HTML document and insert basic configuration parameters.

Step 1: Add the Client Javascript Library

Add the script tag before the end of the closing body tag of your desired HTML page where you desire to give users the ability to authorize access to a financial institution.

<script src=""></script>


Adding the async attribute can cause the inline code to return undefined because the library may not be available at that moment. So avoid the use of async and defer for now.

Step 2: Configure the Javascript Client Library

At this stage, you can now create a Dojah widget object by passing in your public key in javascript object representing your preferred configuration options.

const options = {
  app_id: app_id, //your app_id here
  p_key: p_key, //your production public key here
  type: 'custom',
  user_data: {
    first_name: {$first_name}, //optional
    last_name: {$last_name}, //optional
    dob: {$dob}, //YYYY-MM-DD Optional
    residence_country: 'NG', //optional
    email: {$email}//optional
  metadata: {
    user_id: '12xxxxsxsxsxssx1',
  config: {
    widget_id: "91281818181919191" //this is generated from easyonboard 
  onSuccess: function (response) {
    console.log('Success', response);
  onError: function (err) {
    console.log('Error', err);
  onClose: function () {
    console.log('Widget closed');

const connect = new Connect(options);
const button = document.querySelector('#button-connect');
button.addEventListener('click', function () {


On ID page of the widget, To accept other Identity type asides International Passport and Driver's License.

In Pages [ ] array, Kindly Set custom : true inside β€œconfig” object on ID page.

By Setting the user-data and country page config enable object to false, The user-data and country page will be removed. Kindly note that this customisation can be implemented only in custom widget type.

Example :

{ page: β€˜id’, config: { passport: true, dl: true, custom: true }

To Verify Email OTP, Set verification to true on email page

Example :
{ page: 'email', config: { verification: true }},

To Verify Phone OTP, Set verification to true on phone-number page

Example :

{ page: 'phone-number', config: { verification: true } },

typestringWidget Type : Values are 'custom', 'verification', 'identification', 'verification', 'liveness'
app_idstringApplication Id, Get it from your dojah application dashboard here
p_keystringPublic Key, Get it from your dojah application dashboard here
reference_idstringReference ID, It can be passed to keep track of the verification steps (Started, Ongoing, Successful)

NB : reference_id character length must be greater than 10
widget_idstringWidget ID, Get it from your Easy Onboard application dashboard here
user_dataobjectAutomatically update the user data page, and thus skip the page.
user_data: {
first_name: 'John',
last_name: 'Doe',
dob: '2022-03-12',
email: β€˜[email protected]’
gov_dataobjectAutomatically update the goverment data page, and thus skip the page. gov_data: {
bvn: "456789654323",
nin: "234567543233",
dl: "3243546768767453423",
mobile: "08034456679"
metadataobjectYour application's metadata to be passed back to you via, webhook, onSuccess, or onError
onSuccessfunctionThis is called when your user has successfully completed enrollment with their preferred institution.
The sample response data below is passed to the widget
onErrorfunctionThis is called when your user was unable to successfully complete enrollment.
onClosefunctionThis is called when the widget is closed.

Step 3: Handle a Successful Verification

On successful enrollment, the _onSuccess _callback function that you supplied is called by the client library. We then return the connected account code to your server.

Kindly use the overall status (response.status (Boolean, i.e true or false)) to ascertain if the request failed or succeeded.


Webhook Notifications

You can receive the same data below (also passed to onSuccess and onError) via a webhook call.

Register your url for webhook calls here and ensure kyc.widget is the service you are subscribed to.

In Config object Kindly set webhook object value to true (Boolean)

Example : webhook : true

  "metadata": {
    // Any other metadata you pass to the widget will also be listed here
    "user_id": '12xxxxsxsxsxssx1',
    "deviceInfo": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:98.0) Gecko/20100101 Firefox/98.0",
    "ipInfo": {
      "status": "success",
      "country": "Nigeria",
      "countryCode": "NG",
      "region": "LA",
      "regionName": "Lagos",
      "city": "Lagos",
      "zip": "",
      "lat": 6.4474,
      "lon": 3.3903,
      "timezone": "Africa/Lagos",
      "isp": "MTN NIGERIA Communication limited",
      "org": "MTN Nigeria",
      "as": "AS29465 MTN NIGERIA Communication limited",
      "query": "102.89.33.XX"
  "data": {
    "index": {
      "data": {},
      "status": true,
      "message": "Successfully continued to the main checks."
    "countries": {
      "data": {
        "country": "Nigeria"
      "status": true,
      "message": "Successfully continued to the next step."
    "phonenumber": {
      "data": {
        "mobile": "+234819999999999"
      "status": true,
      "message": "Successfully continued to the next step."
    "user-data": {
      "status": true,
      "data": {
        "firstName": "JOHN",
        "lastName": "DOE",
        "dob": "1997-12-10"
      "message": ""
    "government-data": {
      "data": {
        "entity": {
          "nin": "12334567899",
          "firstname": "JOHN",
          "middlename": "DOJAH",
          "surname": "DOE",
          "maidenname": "",
          "telephoneno": "0809999999999",
          "state": "Imo",
          "place": "MBUTU",
          "profession": "STUDENT",
          "title": "mr",
          "height": "****",
          "email": "",
          "birthdate": "1997-12-10",
          "birthstate": "Lagos",
          "birthcountry": "nigeria",
          "centralID": "8051646",
          "documentno": "",
          "educationallevel": "",
          "employmentstatus": "",
          "othername": "",
          "pfirstname": "",
          "pmiddlename": "",
          "psurname": "",
          "nspokenlang": "IGBO",
          "ospokenlang": "ENGLISH",
          "religion": "christianity",
          "residence_Town": "OJO",
          "residence_lga": "Ojo",
          "residence_state": "Lagos",
          "residencestatus": "birth",
          "residence_AddressLine1": "CAMP 5 BLOCK 8 ROOM 7 NIGERIAN ARMY CANTONMENT",
          "residence_AddressLine2": "CAMP 5 BLOCK 8 ROOM 7 NIGERIAN ARMY CANTONMENT",
          "self_origin_lga": "Ojo",
          "self_origin_place": "",
          "self_origin_state": "Lagos",
          "nationality": "",
          "gender": "m",
          "trackingId": "S7Y0NYFM1000468",
          "customer": "365eb08f-6a1d-46bc-9aa0-XXXXXXXX"
      "message": "",
      "status": true
  "selfieUrl": "",
  "verificationId": 29928,
  "verificationUrl": "",
  "referenceId": "DJ-78BD664121",
  "verificationType": "nin",
  "verificationValue": "12334567899",
  "verificationMode": "selfie",