Technical reference

Web SDK
  • Web SDK
  • Android SDK
  • iOS SDK
  • API Reference
6.7.1
  • SDK 6
  • - 6.7.1
  • - 6.7.0
  • - 6.6.0
  • - 6.5.0
  • - 6.4.0
  • - 6.3.0
  • - 6.2.1
  • - 6.2.0
  • - 6.1.0
  • - 6.0.1
  • - 6.0.0
  • SDK 5
  • - 5.13.0
  • - 5.11.3
We've scheduled essential maintenance on the Onfido platform, affecting all regions. Read more.

Onfido SDK UI Layer

npm version

Overview

This SDK provides a set of components for JavaScript applications to allow capturing of identity documents and face photos/videos for the purpose of identity verification. The SDK offers a number of benefits to help you create the best onboarding / identity verification experience for your customers:

  • Carefully designed UI to guide your customers through the entire photo/video-capturing process
  • Modular design to help you seamlessly integrate the photo/video-capturing process into your application flow
  • Advanced image quality detection technology to ensure the quality of the captured images meets the requirement of the Onfido identity verification process, guaranteeing the best success rate
  • Direct image upload to the Onfido service, to simplify integration*

Note: the SDK is only responsible for capturing photos/videos. You still need to access the Onfido API to manage applicants and checks.

Users will be prompted to upload a file containing an image of their document. On handheld devices they can also use the native camera to take a photo of their document.

Face step allows users to use their device cameras to capture their face using photos or videos.

Various views from the SDK

Getting started

1. Obtaining an API token

In order to start integration, you will need the API token. You can use our sandbox environment to test your integration, and you will find the sandbox token inside your Onfido Dashboard.

1.1 Regions

Onfido offers region-specific environments. Refer to the Regions section in the API documentation for token format and API base URL information.

2. Creating an applicant

With your API token, you should create an applicant by making a request to the create applicant endpoint from your server:

shell
Copy
$ curl https://api.onfido.com/v3/applicants \
  -H 'Authorization: Token token=YOUR_API_TOKEN' \
  -d 'first_name=John' \
  -d 'last_name=Smith'

Note: If you are currently using API v2 please refer to this migration guide for more information.

You will receive a response containing the applicant id which will be used to create a JSON Web Token.

3. Generating an SDK token

For security reasons, instead of using the API token directly in you client-side code, you will need to generate and include a short-lived JSON Web Token (JWT) every time you initialize the SDK. To generate an SDK Token you should perform a request to the SDK Token endpoint in the Onfido API:

shell
Copy
$ curl https://api.onfido.com/v3/sdk_token \
  -H 'Authorization: Token token=YOUR_API_TOKEN' \
  -F 'applicant_id=YOUR_APPLICANT_ID' \
  -F 'referrer=REFERRER_PATTERN'

Note: If you are currently using API v2 please refer to this migration guide for more information.

Make a note of the token value in the response, as you will need it later on when initialising the SDK.

* Tokens expire 90 minutes after creation.

4. Including/Importing the library

4.1 HTML Script Tag Include

Include it as a regular script tag on your page:

html
Copy
<script src="dist/onfido.min.js"></script>

And the CSS styles:

html
Copy
<link rel="stylesheet" href="dist/style.css" />

Example app

JSFiddle example here. Simple example using script tags.

4.2 NPM style import

You can also import it as a module into your own JS build system (tested with Webpack).

sh
Copy
$ npm install --save onfido-sdk-ui
js
Copy
// ES6 module import
import { init } from 'onfido-sdk-ui'

// commonjs style require
var Onfido = require('onfido-sdk-ui')

The CSS style will be included inline with the JS code when the library is imported.

Note

The library is Browser only, it does not support the Node Context.

Example App

Webpack Sample App repository here. Example app which uses the npm style of import.

5. Adding basic HTML markup

There is only one element required in your HTML, an empty element for the modal interface to mount itself on:

html
Copy
<!-- At the bottom of your page, you need an empty element where the
verification component will be mounted. -->
<div id="onfido-mount"></div>

6. Initialising the SDK

You are now ready to initialize the SDK:

js
Copy
Onfido.init({
  // the JWT token that you generated earlier on
  token: 'YOUR_JWT_TOKEN',
  // ID of the element you want to mount the component on
  containerId: 'onfido-mount',
  // ALTERNATIVE: if your integration requires it, you can pass in the container element instead
  // (Note that if `containerEl` is provided, then `containerId` will be ignored)
  containerEl: <div id="root" />,
  onComplete: function (data) {
    console.log('everything is complete')
    // `data` will be an object that looks something like this:
    //
    // {
    //   "document_front": {
    //     "id": "5c7b8461-0e31-4161-9b21-34b1d35dde61",
    //     "type": "passport",
    //     "side": "front"
    //   },
    //   "face": {
    //     "id": "0af77131-fd71-4221-a7c1-781f22aacd01",
    //     "variant": "standard"
    //   }
    // }
    //
    // For two-sided documents like `driving_licence` and `national_identity_card`, the object will also
    // contain a `document_back` property representing the reverse side:
    //
    // {
    //   ...
    //   "document_back": {
    //     "id": "6f63bfff-066e-4152-8024-3427c5fbf45d",
    //     "type": "driving_licence",
    //     "side": "back"
    // }
    //
    // You can now trigger your backend to start a new check
    // `data.face.variant` will return the variant used for the face step
    // this can be used to perform a facial similarity check on the applicant
  },
})

Congratulations! You have successfully started the flow. Carry on reading the next sections to learn how to:

  • Handle callbacks
  • Remove the SDK from the page
  • Customize the SDK
  • Create checks

Handling callbacks

  • onComplete {Function} optional

    Callback that fires when both the document and face have successfully been captured and uploaded. At this point you can trigger your backend to create a check by making a request to the Onfido API create check endpoint. The callback returns an object with the variant used for the face capture. The variant can be used to initiate a facial_similarity_photo or a facial_similarity_video check. The data will be formatted as follows: {face: {variant: 'standard' | 'video'}}.

    Here is an onComplete callback example:

    js
    Copy
    Onfido.init({
      token: 'your-jwt-token',
      containerId: 'onfido-mount',
      onComplete: function (data) {
        console.log('everything is complete')
        // tell your backend service that it can create the check
        // when creating a facial similarity check, you can specify
        // whether you want to start a `facial_similarity_photo` check
        // or a `facial_similarity_video` check based on the value within `data.face.variant`
      },
    })
    

    Based on the applicant id, you can then create a check for the user via your backend.

  • onError {Function} optional

    Callback that fires when one an error occurs. The callback returns the following errors types:

    • exception This type will be returned for the following errors:

      • Timeout and server errors
      • Authorization
      • Invalid token

      The data returned by this type of error should be used for debugging purpose.

    • expired_token This error will be returned when a token is expired. This error type can be used to provide a new token at runtime.

    Here is an example of the data returned by the onError callback:

    js
    Copy
    // Example of data returned for an `exception` error type
    {
      type: "exception",
      message: "The request could not be understood by the server, please check your request is correctly formatted"
    }
    
    // Example of data returned for an `expired_token` error type
    {
      type: "expired_token",
      message: "The token has expired, please request a new one"
    }
    
  • onUserExit {Function} optional

    Callback that fires when the user abandons the flow without completing it. The callback returns a string with the reason for leaving. When the user exits the flow by declining the consent prompt the value returned will be 'USER_CONSENT_DENIED'.

    js
    Copy
    Onfido.init({
      token: 'your-jwt-token',
      containerId: 'onfido-mount',
      onUserExit: function (userExitCode) {
        console.log(userExitCode)
      },
    })
    
  • onModalRequestClose {Function} optional

    Callback that fires when the user attempts to close the modal. It is your responsibility to decide then to close the modal or not by changing the property isModalOpen.

Removing the SDK

If you are embedding the SDK inside a single page app, you can call the tearDown function to remove the SDK completely from the current webpage. It will reset state and you can safely re-initialize the SDK inside the same webpage later on.

JavaScript
Copy
onfidoOut = Onfido.init({...})
...
onfidoOut.tearDown()

Customising the SDK

A number of options are available to allow you to customize the SDK:

  • token {String} required

    A JWT is required in order to authorise with our WebSocket endpoint. If one isn’t present, an exception will be thrown.

  • useModal {Boolean} optional

    Turns the SDK into a modal, which fades the background and puts the SDK into a contained box.

    Example:

    JavaScript
    Copy
    <script>
        var onfido = {}
    
        function triggerOnfido() {
          onfido = Onfido.init({
            useModal: true,
            isModalOpen: true,
            onModalRequestClose: function() {
              // Update options with the state of the modal
              onfido.setOptions({isModalOpen: false})
            },
            token: 'token',
            onComplete: function(data) {
              // callback for when everything is complete
              console.log("everything is complete")
            }
          });
        };
    </script>
    
    <body>
      <!-- Use a button to trigger the Onfido SDK  -->
      <button onClick="triggerOnfido()">Verify identity</button>
      <div id='onfido-mount'></div>
    </body>
    
  • isModalOpen {Boolean} optional

    In case useModal is set to true, this defines whether the modal is open or closed. To change the state of the modal after calling init() you need to later use setOptions() to modify it. The default value is false.

  • shouldCloseOnOverlayClick {Boolean} optional

    In case useModal is set to true, the user by default can close the SDK by clicking on the close button or on the background overlay. You can disable the user from closing the SDK on background overlay click by setting the shouldCloseOnOverlayClick to false.

  • containerId {String} optional

    A string of the ID of the container element that the UI will mount to. This needs to be an empty element. The default ID is onfido-mount. If your integration needs to pass the container element itself, use containerEl as described next.

  • containerEl {Element} optional

    The container element that the UI will mount to. This needs to be an empty element. This can be used as an alternative to passing in the container ID string previously described for containerId. Note that if containerEl is provided, then containerId will be ignored.

  • language {String || Object} optional

    The SDK language can be customized by passing a String or an Object. At the moment, we support and maintain translations for English (default), Spanish, German and French using respectively the following locale tags: en_US, es_ES, de_DE, fr_FR. To leverage one of these languages, the language option should be passed as a string containing a supported language tag.

    Example:

    JavaScript
    Copy
    language: 'es_ES' | 'es'
    

    The SDK can also be displayed in a custom language by passing an object containing the locale tag and the custom phrases. The object should include the following keys:

    • locale: A locale tag. This is required when providing phrases for an unsupported language. You can also use this to partially customize the strings of a supported language (e.g. Spanish), by passing a supported language locale tag (e.g. es_ES). For missing keys, the values will be displayed in the language specified within the locale tag if supported, otherwise they will be displayed in English. The locale tag is also used to override the language of the SMS body for the cross device feature. This feature is owned by Onfido and is currently only supporting English, Spanish, French and German.

    • phrases (required) : An object containing the keys you want to override and the new values. The keys can be found in src/locales/en_US/en_US.json. They can be passed as a nested object or as a string using the dot notation for nested values. See the examples below.

    • mobilePhrases (optional) : An object containing the keys you want to override and the new values. The values specified within this object are only visible on mobile devices. Please refer to the mobilePhrases property in src/locales/en_US/en_US.json. Note: support for standalone mobilePhrases key will be deprecated soon. Consider nesting it inside phrases if applicable.

    JavaScript
    Copy
    language: {
      locale: 'en_US',
      phrases: { welcome: { title: 'My custom title' } },
      mobilePhrases: {
        'capture.driving_licence.instructions': 'This string will only appear on mobile'
      }
    }
    

    If language is not present the default copy will be in English.

  • smsNumberCountryCode {String} optional

    The default country for the SMS number input can be customized by passing the smsNumberCountryCode option when the SDK is initialized. The value should be a 2-characters long ISO Country code string. If empty, the SMS number country code will default to GB.

    Example:

    JavaScript
    Copy
    smsNumberCountryCode: 'US'
    
  • userDetails {Object} optional

    Some user details can be specified ahead of time, so that the user doesn't need to fill them in themselves.

    The following details can be used by the SDK:

    • smsNumber (optional) : The user's mobile number, which can be used for sending any SMS messages to the user. An example SMS message sent by the SDK is when a user requests to use their mobile devices to take photos. This should be formatted as a string, with a country code (e.g. "+447500123456")
    JavaScript
    Copy
    userDetails: {
      smsNumber: '+447500123456'
    }
    
  • customUI {Object} optional

    If you would like to customize the SDK, this can be done by providing the customUI option with an object with the corresponding CSS values (e.g. RGBA color values, border radius values) for the following options:

    Typography optionsDescription
    fontFamilyTitleChange font family of the SDK screen titles
    fontFamilySubtitleChange font family of the SDK screen subtitles
    fontFamilyBodyChange font family of the SDK screen content
    fontSizeTitleChange font size of the SDK screen titles
    fontSizeSubtitleChange font size of the SDK screen subtitles
    fontSizeBodyChange font size of the SDK screen content
    fontWeightTitleChange font weight of the SDK screen titles (number format only, e.g. 400, 600)
    fontWeightSubtitleChange font weight of the SDK screen subtitles (number format only, e.g. 400, 600)
    fontWeightBodyChange font weight of the SDK screen content (number format only, e.g. 400, 600)
    colorContentTitleChange text color of the SDK screen titles
    colorContentSubtitleChange text color of the SDK screen subtitles
    colorContentBodyChange text color of the SDK screen content

    Example configuration with the different CSS font related values that can be used:

    JavaScript
    Copy
    customUI: {
      "fontFamilyTitle": "Impact, fantasy",
      "fontSizeTitle": "26px",
      "fontWeightSubtitle": 600,
      "fontSizeSubtitle": "1.25rem",
    }
    

    Note: If using a scalable font size unit like em/rem, the SDK's base font size is 16px. This is currently not customizable.

    Modal (SDK main container)Description
    colorBackgroundSurfaceModalChange background color of SDK modal
    colorBorderSurfaceModalChange color of SDK modal border
    borderWidthSurfaceModalChange border width of SDK modal
    borderStyleSurfaceModalChange border style of SDK modal
    borderRadiusSurfaceModalChange border radius of SDK modal

    Example configuration with the different CSS colour value variations, border style that can be used:

    JavaScript
    Copy
    customUI: {
        "colorBackgroundSurfaceModal": "#fafafa",
        "colorBorderSurfaceModal": "rgb(132 59 98)",
        "borderWidthSurfaceModal": "6px",
        "borderStyleSurfaceModal": "groove",
      }
    
    Primary ButtonsDescription
    colorContentButtonPrimaryTextChange color of Primary Button text
    colorBackgroundButtonPrimaryChange background color of Primary Button
    colorBackgroundButtonPrimaryHoverChange background color of Primary Button on hover
    colorBackgroundButtonPrimaryActiveChange background color of Primary Button on click/tap
    colorBorderButtonPrimaryChange color of Primary Button border
    Secondary ButtonsDescription
    colorContentButtonSecondaryTextChange color of Secondary Button text
    colorBackgroundButtonSecondaryChange background color of Secondary Button
    colorBackgroundButtonSecondaryHoverChange background color of Secondary Button on hover
    colorBackgroundButtonSecondaryActiveChange background color of Secondary Button on click/tap
    colorBorderButtonSecondaryChange color of Secondary Button border
    Document Type ButtonsDescription
    colorContentDocTypeButtonChange Document Type Button text color
    colorBackgroundDocTypeButtonChange background color of Document Type Button
    colorBorderDocTypeButtonChange color of Document Type Button border
    colorBorderDocTypeButtonChange color of Document Type Button border
    colorBorderDocTypeButtonHoverChange color of Document Type Button border on hover
    colorBorderDocTypeButtonActiveChange color of Document Type Button border on click/tap
    Icon Background optionDescription
    colorBackgroundIconChange color of the background circle of pictogram icons in the SDK

    Example configuration with the different CSS colour value variations that can be used:

    JavaScript
    Copy
    customUI: {
        "colorContentButtonPrimaryText": "#333",
        "colorBackgroundButtonPrimary": "#ffb997",
        "colorBorderButtonPrimary": "#B23A48",
        "colorBackgroundButtonPrimaryHover": "#F67E7D",
        "colorBackgroundButtonPrimaryActive": "#843b62",
    
        "colorContentButtonSecondaryText": "hsla(90deg 1% 31%)",
        "colorBackgroundButtonSecondary": "rgba(255 238 170 / 92%)",
        "colorBorderButtonSecondary": "coral",
        "colorBackgroundButtonSecondaryHover": "#ce6a85",
        "colorBackgroundButtonSecondaryActive": "#985277",
      }
    

    The following options are applied to multiple Button elements:

    Shared Button optionsValue TypeDescription
    borderRadiusButtonstringChange border radius value of Primary, Secondary and Document Type Option buttons
    buttonGroupStacked (default: false)booleanDisplay Primary, Secondary button group in Document and Face capture confirmation screens are in separate rows instead of inline by default

    Example configuration:

    JavaScript
    Copy
    customUI: {
        borderRadiusButton: "50px",
        buttonGroupStacked: true
      }
    
    LinksDescription
    colorContentLinkTextHoverChange Link text color
    colorBorderLinkUnderlineChange Link underline color
    colorBackgroundLinkHoverChange Link background color on hover
    colorBackgroundLinkActiveChange Link background color on click/tap
    Warning PopupsDescription
    colorContentAlertInfoChange warning popup text color
    colorBackgroundAlertInfoChange warning popup background color
    colorContentAlertInfoLinkHoverChange warning popup fallback Link background on hover
    colorContentAlertInfoLinkActiveChange warning popup fallback Link background on click/tap
    Error PopupsDescription
    colorContentAlertErrorChange error popup text color
    colorBackgroundAlertErrorChange error popup background color
    colorContentAlertErrorLinkHoverChange error popup fallback Link background on hover
    colorContentAlertErrorLinkActiveChange error popup fallback Link background on click/tap
    Info Header/Highlight PillsDescription
    colorBackgroundInfoPillChange background color of Cross Device, Camera/Mic Permissions screens' information header pill
    colorContentInfoPillChange text color of Cross Device, Camera/Mic Permissions screens' information header pill
    Icon ButtonsDescription
    colorBackgroundButtonIconHoverChange background color of Back, Close Modal icon buttons on hover
    colorBackgroundButtonIconActiveChange background color of Back, Close Modal icon buttons on click/tap
    Camera Shutter ButtonDescription
    colorBackgroundButtonCameraHoverChange background color of Live Selfie/Document Capture screens's Camera button on hover
    colorBackgroundButtonCameraActiveChange background color of Live Selfie/Document Capture screen's Camera button on click/tap
  • steps {List} optional

    List of the different steps and their custom options. Each step can either be specified as a string (when no customization is required) or an object (when customization is required):

    JavaScript
    Copy
    steps: [
      {
        type: 'welcome',
        options: {
          title: 'Open your new bank account',
        },
      },
      'document',
      'face',
    ]
    

    In the example above, the SDK flow is consisted of three steps: welcome, document and face. Note that the title option of the welcome step is being overridden, while the other steps are not being customized.

    The SDK can also be used to capture Proof of Address documents. This can be achieved by using the poa step.

    Below are descriptions of the steps and the custom options that you can specify inside the options property. Unless overridden, the default option values will be used:

    welcome

    This is the introduction screen of the SDK. Use this to explain to your users that they need to supply identity documents (and face photos/videos) to have their identities verified.

    The custom options are:

    • title (string)
    • descriptions ([string])
    • nextButton (string)

    userConsent

    This step contains a screen to collect the US user's privacy consent for Onfido and is an optional step in the SDK flow. It contains the consent language required when you offer your service to US users as well as links to Onfido's policies and terms of use. The user must click "Accept" to get past this step and continue with the flow. The content is available in English only, and is not translatable.

    Note that this step does not automatically inform Onfido that the user has given their consent. At the end of the SDK flow, you still need to set the API parameter privacy_notices_read_consent_given outside of the SDK flow when creating a check.

    If you choose to disable this step, you must incorporate the required consent language and links to Onfido's policies and terms of use into your own application's flow before your user starts interacting with the Onfido SDK.

    For more information about this step, and how to collect user consent, please visit the Onfido Privacy Notices and Consent page.

    Note: The userConsent step must be used in conjunction with the onUserExit callback. See the Handling Callbacks section for more information.

    document

    This is the identity document capture step. Users will be asked to select the document type and to provide images of their selected document. For driving licence and national ID card types, the user will be able to see and select the document's issuing country from a list of supported countries. They will also have a chance to check the quality of the image(s) before confirming.

    The custom options are:

    • documentTypes (object)

      The list of document types visible to the user can be filtered by using the documentTypes option. The default value for each document type is true. If documentTypes only includes one document type, users will not see either the document selection screen or the country selection screen and instead will be taken to the capture screen directly.

      Configuring Country

      The country configuration for a document type allows you to specify the issuing country of the document with a 3-letter ISO 3166-1 alpha-3 country code. Users will not see the country selection screen if this is set for a document type.

      Note: You can set the country for all document types except Passport.

      For example, if you would like to set the country as Spain (ESP) and skip the country selection screen for the driving licence document type only:

      JSON
      Copy
      {
        "steps": [
          "welcome",
          {
            "type": "document",
            "options": {
              "documentTypes": {
                "driving_licence": {
                  "country": "ESP"
                },
                "national_identity_card": true,
                "residence_permit": true
              }
            }
          },
          "complete"
        ]
      }
      

      If you would like to suppress the country selection screen for driving licence but do not want to set a country:

      JSON
      Copy
      {
        "steps": [
          "welcome",
          {
            "type": "document",
            "options": {
              "documentTypes": {
                "driving_licence": {
                  "country": null
                },
                "passport": true,
                "national_identity_card": true
              }
            }
          },
          "complete"
        ]
      }
      
    • showCountrySelection (boolean - default: false)

      Note: Support for the showCountrySelection option will be deprecated soon in favour of the per document country configuration detailed above which offers integrators better control.

      The showCountrySelection option controls what happens when only a single document is preselected in documentTypes It has no effect when the SDK has been set up with multiple documents preselected.

      The country selection screen is never displayed for a passport document.

      By default, if only one document type is preselected, and the document type is not passport, the country selection screen will not be displayed. If you would like to have this screen displayed still, set showCountrySelection to true.

      JavaScript
      Copy
      options: {
        documentTypes: {
          passport: boolean,
          driving_licence: boolean,
          national_identity_card: boolean,
          residence_permit: boolean
        },
        showCountrySelection: boolean (note that this will only apply for certain scenarios, see example configurations below)
      }
      

      Example of Document step without Country Selection screen for a preselected non-passport document (default behaviour)

      JSON
      Copy
      {
        "steps": [
          "welcome",
          {
            "type": "document",
            "options": {
              "documentTypes": {
                // Note that only 1 document type is selected here
                "passport": false,
                "driving_licence": false,
                "national_identity_card": true
              },
              "showCountrySelection": false
            }
          },
          "complete"
        ]
      }
      

      Examples of Document step configuration with more than one preselected documents where Country Selection will still be displayed

      Example 1 All document type options enabled, "showCountrySelection": false has no effect

      JSON
      Copy
      {
        "steps": [
          "welcome",
          {
            "type": "document",
            "options": {
              "documentTypes": {
                "passport": true,
                "driving_licence": true,
                "national_identity_card": true
              },
              "showCountrySelection": false (NOTE: has no effect)
            }
          },
          "complete"
        ]
      }
      

      Example 2 2 document type options enabled, "showCountrySelection": false has no effect

      JSON
      Copy
      {
        "steps": [
          "welcome",
          {
            "type": "document",
            "options": {
              "documentTypes": {
                "passport": true,
                "national_identity_card": true,
                "driving_licence": false
              },
              "showCountrySelection": false (NOTE: has no effect)
            }
          },
          "complete"
        ]
      }
      
    • forceCrossDevice (boolean - default: false)

      When set to true, desktop users will be forced to use their mobile devices to capture the document image. They will be able to do so via the built-in SMS feature. Use this option if you want to prevent file upload from desktops.

      JavaScript
      Copy
      options: {
        forceCrossDevice: true
      }
      
    • useLiveDocumentCapture (boolean - default: false) This BETA feature is only available on mobile devices.

      When set to true, users on mobile browsers with camera support will be able to capture document images using an optimised camera UI, where the SDK directly controls the camera feed to ensure live capture. For unsupported scenarios, see the uploadFallback section below. Tested on: Android Chrome 78.0.3904.108, iOS Safari 13

    • uploadFallback (boolean - default: true) Only available when useLiveDocumentCapture is enabled.

      When useLiveDocumentCapture is set to true, the SDK will attempt to open an optimised camera UI for the user to take a live photo of the selected document. When this is not possible (because of an unsupported browser or mobile devices with no camera), by default the user will be presented with an HTML5 File Input upload because of uploadFallback. In this scenario, they will be able to use their mobile device's default camera application to take a photo, but will not be presented with an optimised camera UI.

      This method does not guarantee live capture, because certain mobile device browsers and camera applications may also allow uploads from the user's gallery of photos.

      Warning: If the mobile device does not have a camera or there is no camera browser support, and uploadFallback is set to false, the user will not be able to complete the flow.

      JavaScript
      Copy
      options: {
        useLiveDocumentCapture: true,
        uploadFallback: false
      }
      

    poa

    This is the Proof of Address capture step. Users will be asked to select the document type and to provide images of their selected document. They will also have a chance to check the quality of the images before confirming. The custom options are:

    • country (default: GBR)
    • documentTypes
    JavaScript
    Copy
    options: {
      country: string,
      documentTypes: {
        bank_building_society_statement: boolean,
        utility_bill: boolean,
        council_tax: boolean, // GBR only
        benefit_letters: boolean, // GBR only
        government_letter: boolean // non-GBR only
      }
    }
    

    The Proof of Address document capture is currently a BETA feature, and it cannot be used in conjunction with the document and face steps as part of a single SDK flow.

    face

    This is the face capture step. Users will be asked to capture their face in the form of a photo or a video. They will also have a chance to check the quality of the photos or video before confirming.

    The custom options are:

    • requestedVariant (string)

      A preferred variant can be requested for this step, by passing the option requestedVariant: 'standard' | 'video'. If empty, it will default to standard and a photo will be captured. If the requestedVariant is video, we will try to fulfil this request depending on camera availability and device/browser support. In case a video cannot be taken the face step will fallback to the standard option. At the end of the flow, the onComplete callback will return the variant used to capture face and this can be used to initiate a facial_similarity_photo or a facial_similarity_video check.

    • uploadFallback (boolean - default: true)

      By default, the SDK will attempt to open an optimised camera UI for the user to take a live photo/video. When this is not possible (because of an unsupported browser or mobile devices with no camera), by default the user will be presented with an HTML5 File Input upload because of uploadFallback. In this scenario, they will be able to use their mobile device's default camera application to take a photo, but will not be presented with an optimised camera UI.

      This method does not guarantee live capture, because certain mobile device browsers and camera applications may also allow uploads from the user's gallery of photos.

      Warning: If the mobile device does not have a camera or there is no camera browser support, and uploadFallback is set to false, the user will not be able to complete the flow.

      JavaScript
      Copy
      options: {
        requestedVariant: 'standard' | 'video',
        uploadFallback: false
      }
      
    • useMultipleSelfieCapture (boolean - default: true)

      When enabled, this feature allows the SDK to take additional selfie snapshots to help improve face similarity check accuracy. When disabled, only one selfie photo will be taken.

    complete

    This is the final completion step. You can use this to inform your users what is happening next. The custom options are:

    • message (string)
    • submessage (string)

Changing options in runtime

It's possible to change the options initialized at runtime:

JavaScript
Copy
onfidoOut = Onfido.init({...})
...
//Change the title of the welcome screen
onfidoOut.setOptions({
  steps: [
    {
      type:'welcome',
      options:{title:"New title!"}
    },
    'document',
    'face',
    'complete'
  ]
});
...
//replace the jwt token
onfidoOut.setOptions({ token:"new token" });
...
//Open the modal
onfidoOut.setOptions({ isModalOpen:true });

The new options will be shallowly merged with the previous one. So one can pass only the differences to a get a new flow.

Creating checks

This SDK’s aim is to help with the document capture process. It does not actually perform the full document/face checks against our API.

In order to perform a full document/face check, you need to call our API to create a check for the applicant on your backend.

1. Creating a check

With your API token and applicant id (see Getting started), you will need to create a check by making a request to the create check endpoint. If you are just verifying a document, you only have to include a document report as part of the check. On the other hand, if you are verifying a document and a face photo/video, you will also have to include a facial similarity report. The facial similarity check can be performed in two different variants: facial_similarity_photo and facial_similarity_video. If the SDK is initialized with the requestedVariant option for the face step, make sure you use the data returned in the onComplete callback to request the right report. The value of variant indicates whether a photo or video was captured and it needs to be used to determine the report name you should include in your request. Example of data returned by the onComplete callback: {face: {variant: 'standard' | 'video'}}

When the variant returned is standard, you should include facial_similarity_photo in the report_names array. If the variant returned is video, you should include facial_similarity_video in the report_names array.

shell
Copy
$ curl https://api.onfido.com/v3/checks \
    -H 'Authorization: Token token=YOUR_API_TOKEN' \
    -d '{
      "applicant_id": "<APPLICANT_ID>",
      "report_names": ["document", "facial_similarity_photo" | "facial_similarity_video"]
    }'

Note: If you are currently using API v2 please refer to this migration guide for more information.

You will receive a response containing the check id instantly. As document and facial similarity reports do not always return actual results straightaway, you need to set up a webhook to get notified when the results are ready.

Finally, as you are testing with the sandbox token, please be aware that the results are pre-determined. You can learn more about sandbox responses here.

2. Setting up webhooks

Refer to the Webhooks section in the API documentation for details.

User Analytics

The SDK allows you to track the user's journey through the verification process via a dispatched event. This is meant to give some insight into how your user's make use of the SDK screens.

Overriding the hook

In order to expose the user's progress through the SDK an EventListener must be added that listens for UserAnalyticsEvent events. This can be done anywhere within your application and might look something like the following:

JavaScript
Copy
addEventListener('userAnalyticsEvent', (event) => /*Your code here*/);

The code inside of the EventListener will now be called when a particular event is triggered, usually when the user reaches a new screen. For a full list of events see the bottom of this section.

The parameter being passed in is an Event object, the details related to the user analytics event can be found at the path event.detail and are as follows:

  • eventName: A String indicating the type of event. Currently will always this return as "Screen" as each tracked event is a user visiting a screen. In the future more event types may become available for tracking.
  • properties: A Map object containing the specific details of an event. This will contain things such as the name of the screen visited.

Using the data

Currently we recommend using the above hook to keep track of how many user's reach each screen in your flow. This can be done by storing the count of users that reach each screen and comparing them to the amount of user's who've made it to the Welcome screen.

Tracked events

Below is the list of potential events currently being tracked by the hook:

Copy
WELCOME - User reached the "Welcome" screen
USER_CONSENT - User reached the "User Consent" screen
DOCUMENT_TYPE_SELECT - User reached the "Choose document" screen where the type of document to upload can be selected
ID_DOCUMENT_COUNTRY_SELECT - User reached the "Select issuing country" screen where the the appropriate issuing country can be searched for and selected if supported
CROSS_DEVICE_INTRO - User reached the cross device "Continue on your phone" intro screen
CROSS_DEVICE_GET_LINK - User reached the cross device "Get your secure link" screen
CROSS_DEVICE_START - User reached the "document capture" screen on mobile after visiting the cross device link
DOCUMENT_CAPTURE_FRONT - User reached the "document capture" screen for the front side (for one-sided or two-sided document)
DOCUMENT_CAPTURE_BACK - User reached the "document capture" screen for the back side (for two-sided document)
DOCUMENT_CAPTURE_CONFIRMATION_FRONT - User reached the "document confirmation" screen for the front side (for one-sided or two-sided document)
DOCUMENT_CAPTURE_CONFIRMATION_BACK - User reached the "document confirmation" screen for the back side (for two-sided document)
FACIAL_INTRO - User reached the "selfie intro" screen
FACIAL_CAPTURE - User reached the "selfie capture" screen
FACIAL_CAPTURE_CONFIRMATION - User reached the "selfie confirmation" screen
VIDEO_FACIAL_INTRO - User reached the "liveness intro" screen
VIDEO_FACIAL_CAPTURE_STEP_1 - User reached the 1st challenge during "liveness video capture", challenge_type can be found in eventProperties
VIDEO_FACIAL_CAPTURE_STEP_2 - User reached the 2nd challenge during "liveness video capture", challenge_type can be found in eventProperties
UPLOAD - User's file is uploading

Premium Enterprise Features

These features must be enabled for your account before they can be used. For more information, please contact your Onfido Solution Engineer or Customer Success Manager.

Customized API Requests - Premium Enterprise Feature

This premium enterprise feature enables you to control the data collected by the Onfido SDK through the use of callbacks that are invoked when the user submits their captured media. These callbacks provide all of the information that would normally be sent directly to the Onfido API and expect a promise in response that controls what the SDK does next. Before the feature can be used, it must be enabled for your account. Once enabled, you will need to set useCustomizedApiRequests to true and provide the callbacks for onSubmitDocument and onSubmitSelfie within the enterpriseFeatures block of the configuration options. The callback for video is not supported yet.

Example:

JavaScript
Copy
Onfido.init({
  // Other options here
  enterpriseFeatures: {
    useCustomizedApiRequests: true,
    onSubmitDocuments: (documentData) => {
      // Your callback code here
    },
    onSubmitSelfie: (selfieData) => {
      // Your callback code here
    },
  },
})

To enable callbacks on the cross-device flow you must also host the cross-device experience of the Onfido SDK yourself. This can be done using the cross device URL premium enterprise feature. Once you have a server with the Onfido Web SDK installed and set up you must initialize the SDK with mobileFlow: true as well as the callbacks and useCustomizedApiRequests options shown above.

Callbacks Overview

The callbacks will provide you with a FormData object including the information that the SDK would send to Onfido. These callbacks will be invoked when the user confirms their image on the UI and won’t send the request to Onfido unless requested in the response.

onSubmitDocument FormData Paramaters

JavaScript
Copy
{
  file: blob,
  side: string,
  type: string,
  sdk_validations: object,
  sdk_source: string,
  sdk_version: string,
  sdk_metadata: object,
}

onSubmitSelfie FormData Paramaters

JavaScript
Copy
{
  file: blob,
  snapshot: blob,
  sdk_source: string,
  sdk_version: string,
  sdk_metadata: object,
}

Allowing the SDK to upload data to Onfido

If you would like the SDK to upload the user-submitted data to Onfido you can resolve the promise with an object containing continueWithOnfidoUpload: true

Example:

JavaScript
Copy
onSubmitDocument: (data) => {
  // Send data to your backend then resolve promise,
  return Promise.resolve({ continueWithOnfidoUpload: true })
})

Providing the SDK with the Onfido response

If you would like to upload the data yourself from your backend, we strongly recommend that you add all of the data provided to you through the callbacks in your request to the appropriate endpoint - /documents or /live_photos. Additionally, you should use the SDK token created for each applicant in the Authorization header of the request as shown below. Please note, the SDK token is not included in the FormData provided by the callbacks. You may want to append this or some other unique identifier that is mapped to the applicant's SDK token on your backend before sending it off.

Example:

Copy
Authorization: Bearer <SDK token here>

Once you have sent the request to Onfido yourself, you can supply the SDK with the response so it can determine what the user should be presented with. In the case where a success response is received, the promise should be resolved with onfidoSuccessResponse: <onfidoResponse>, otherwise reject the promise with the Onfido error response. Please note that an error response could be returned due to image quality issues and the SDK will present the user with the appropriate error message.

Example:

JavaScript
Copy
onSubmitDocument: (data) => {
  // Send request to Onfido API /documents via your backend proxy
  .then(onfidoSuccessResponse =>
    Promise.resolve({ onfidoSuccessResponse }))
  .catch(onfidoError => Promise.reject(onfidoError))
}

Below is a sample openAPI YAML file you could use as an example to start your own proxy.

yaml
Copy
openapi: 3.0.0
info:
  title: Network decouple back-end sample
  description: Network decouple back-end setup skeleton
  version: '1.0'
  contact: {}
tags: []
servers: []
components:
  schemas:
    IDocumentsRequest:
      type: object
      properties:
        file:
          type: string
          format: binary
          description: Uploaded document. Passed in from the web SDK callback.
        type:
          type: string
          default: passport
          description: >-
            The type of document that was submitted. Passed in from the web SDK
            callback.
        side:
          type: string
          default: front
          description: >-
            The type side of the document that was submitted. Passed in from the
            web SDK callback.
        sdk_metadata:
          type: object
          description: >-
            The metadata that web SDK collects. Forward this to Onfido API
            without modifications. Passed in from the web SDK callback.
        sdk_validations:
          type: object
          description: >-
            This is a an object used by web SDK to seek image quality feedback
            from the API. Forward this object without modifications to Onfido
            API. Passed in from the web SDK callback.
        sdk_source:
          type: string
          default: onfido_web_sdk
          description: >-
            The source of origin of the requests. Forward this without
            modifications to the Onfido API. Passed in from the web SDK callback.
        sdk_version:
          type: string
          description: >-
            The SDK version. Forward this without modifications to the Onfido
            API. Passed in from the web SDK callback.
    IMultiFrameSelfieRequest:
      type: object
      properties:
        file:
          type: string
          format: binary
          description: Uploaded photo
        sdk_metadata:
          type: object
          description: >-
            The metadata that web SDK collects. Forward this to Onfido API
            without modifications. Passed in from the web SDK callback.
        sdk_source:
          type: string
          default: onfido_web_sdk
          description: >-
            The source of origin of the requests. Forward this without
            modifications to the Onfido API. Passed in from the web SDK callback.
        sdk_version:
          type: string
          description: >-
            The SDK version. Forward this without modifications to the Onfido
            API. Passed in from the web SDK callback.
        snapshot:
          type: string
          format: binary
          description: Uploaded snapshot taken by the Web SDK to improve fraud analysis.
paths:
  /onfido/v3/documents:
    post:
      operationId: OnfidoController documents
      parameters:
        - name: Auhorization
          in: header
          description: Customer back-end Authentication token
          schema:
            type: string
      requestBody:
        required: true
        description: The API endpoint to intercept the document upload from the Web SDK
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/IDocumentsRequest'
      responses:
        '200':
          description: >-
            The response received from Onfido v3/documents API call. The
            response format might slightly vary with the use case. Forward it
            without modifications as the callback response.
          content:
            application/json:
              schema:
                properties:
                  id:
                    type: string
                    format: uuid
                  created_at:
                    type: string
                    format: date-time
                  file_name:
                    type: string
                  file_size:
                    type: integer
                  file_type:
                    type: string
                  type:
                    type: string
                  side:
                    type: string
                  issuing_country:
                    type: string
                  applicant_id:
                    type: string
                  href:
                    type: string
                  download_href:
                    type: string
                  sdk_warnings:
                    type: object
        '201':
          description: ''
          content:
            application/json:
              schema:
                type: object
        '422':
          description: ''
          content:
            application/json:
              schema:
                properties:
                  error:
                    type: object
                    properties:
                      type:
                        type: string
                      message:
                        type: string
                  fields:
                    type: object
  /onfido/v3/live_photos:
    post:
      operationId: OnfidoController
      parameters:
        - name: Auhorization
          in: header
          description: Customer back-end Authentication token
          schema:
            type: string
      requestBody:
        required: true
        description: The API endpoint to intercept the live photos upload from the Web SDK
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/IMultiFrameSelfieRequest'
      responses:
        '200':
          description: >-
            The response received from Onfido v3/live_photos API call. The
            response format might slightly vary with the use case. Forward it
            without modifications as the callback response.
          content:
            application/json:
              schema:
                properties:
                  id:
                    type: string
                    format: uuid
                  created_at:
                    type: string
                    format: date-time
                  file_name:
                    type: string
                  file_type:
                    type: string
                  file_size:
                    type: integer
                  href:
                    type: string
                  sdk_source:
                    type: string
                  sdk_version:
                    type: string
                  download_href:
                    type: string
        '201':
          description: ''
          content:
            application/json:
              schema:
                type: object

Cross device URL - Premium Enterprise Feature

This feature allows you to specify your own custom or whitelabel url that the cross device flow will redirect to instead of the Onfido default id.onfido.com. To use this feature generate a SDK token as shown below and use it to start the SDK.

shell
Copy
$ curl https://api.onfido.com/v3/sdk_token \
 -H 'Authorization: Token token=YOUR_API_TOKEN' \
 -F 'applicant_id=YOUR_APPLICANT_ID' \
 -F 'referrer=REFERRER_PATTERN' \
 -F 'cross_device_url=YOUR_CUSTOM_URL'

In addition to this, you must either:

  1. Set up a server to forward the incoming HTTP request, including the path, to https://id.onfido.com. This can be done by setting up a server as a reverse proxy so that the URL that the end-user sees is your selected URL but the content shown is the Onfido-hosted Web SDK.

Below is an example set-up for a minimal nginx server using docker.

Example

nginx.conf

nginx
Copy
server {
  # Change the next 2 lines as needed
  listen       80;
  server_name  localhost;

  location / {
    # This forwards the path to Onfido and is the only change
    # necessary when working with the default nginx configuration
    proxy_pass https://id.onfido.com;
  }
}

dockerfile

Copy
FROM nginx:1.15.8-alpine

COPY ./nginx.conf /etc/nginx/conf.d/default.conf
  1. Set up a server to host the Onfido Web SDK yourself at the provided URL. This server must use the same version of the Onfido Web SDK and must initialize the SDK with Onfido.init({ mobileFlow: true }). All other configuration options, except for callbacks provided for the useCustomizedApiRequests feature, will be provided by your original instance of the Onfido Web SDK.

Below is an example of how you could host the Onfido Web SDK with minimal setup, but it does not have to be done this way.

Example

This example involves using docker and an nginx image to serve an html file which starts the Onfido Web SDK using just the minified js and css files from the dist directory. (onfido-sdk-ui/dist/onfido.min.js and onfido-sdk-ui/dist/style.css)

To help with getting the correct version of the Web SDK, we append the Onfido files with the base32 version that is associated with each release. This value can be obtained from the first 2 characters in the appended path when using the cross-device flow. For example, if the current release appends a path that starts with BW we would rename the minified files BW-onfido.min.js and BW-style.css for this example to work.

File structure for this minimal example

Copy
- dist
  - <BASE32>-onfido.min.js
  - <BASE32>-style.css
- dockerfile
- nginx.conf
- index.html

dockerfile

Copy
FROM nginx:1.15.8-alpine

COPY ./nginx.conf /etc/nginx/conf.d/default.conf

COPY ./index.html /usr/share/nginx/html/

COPY ./dist /usr/share/nginx/sdk/

nginx.conf

nginx
Copy
server {
  # Change the next 2 lines as needed
  listen       80;
  server_name  localhost;

  location ~ ^/[0-9a-zA-Z]+$ {
    root   /usr/share/nginx/html;
    try_files $uri /index.html =404;
  }

  location ~* \.(js|jpg|png|css)$ {
    root /usr/share/nginx/sdk/;
  }
}

index.html

html
Copy
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta
      charset="utf-8"
      name="viewport"
      content="width=device-width, initial-scale=1"
    />
    <meta name="mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="format-detection" content="telephone=no" />
    <title>Onfido Verification</title>
    <style type="text/css">
      html,
      body {
        height: 100%;
        margin: 0;
      }
      body,
      button {
        -webkit-font-smoothing: antialiased;
      }
      @media (min-width: 30em) {
        #onfido-mount {
          position: relative;
          top: 10%;
        }
        .onfido-sdk-ui-Modal-inner {
          font-family: 'Open Sans', sans-serif !important;
        }
      }
    </style>
    <script type="text/javascript">
      var version = window.location.pathname.substring(1, 3)
      var jsPath = version + '-onfido.min.js'
      var cssPath = version + '-style.css'

      var link = document.createElement('link')
      link.rel = 'stylesheet'
      link.href = cssPath

      var script = document.createElement('script')
      script.onload = function () {
        window.onfidoOut = Onfido.init({ mobileFlow: true })
      }
      script.src = jsPath

      document.head.appendChild(link)
      document.head.appendChild(script)
    </script>
  </head>

  <body>
    <div id="onfido-mount"></div>
  </body>
</html>

Going live

Once you are happy with your integration and are ready to go live, please contact client-support@onfido.com to obtain live version of the API token. We will have to replace the sandbox token in your code with the live token.

A few things to check before you go live:

  • Make sure you have set up webhooks to receive live events
  • Make sure you have entered correct billing details inside your Onfido Dashboard

Accessibility

The Onfido SDK has been optimised to provide the following accessibility support by default:

  • Screen reader support: accessible labels for textual and non-textual elements available to aid screen reader navigation, including dynamic alerts
  • Keyboard navigation: all interactive elements are reachable using a keyboard
  • Sufficient color contrast: default colors have been tested to meet the recommended level of contrast
  • Sufficient touch target size: all interactive elements have been designed to meet the recommended touch target size

Refer to our accessibility statement for more details.

Note

If you are making your own UI customizations, you are responsible for ensuring that the UI changes will still adhere to accessibility standards for such things like accessible color contrast ratios and dyslexic friendly fonts.

TypeScript

From version 6.5.0, TypeScript is officially supported, providing typings for:

  • init() method.
  • options argument (SdkOptions) and return object (SdkHandle) of init() method.
  • Arguments (SdkResponse and SdkError) for onComplete() and onError() callbacks.
  • steps option (StepTypes and StepConfig).
  • language option (SupportedLanguages and LocaleConfig).
  • region option (ServerRegions).

More information

Browser compatibility

ChromeFirefoxIEEdgeSafari
Latest ✔Latest *11 ✔Latest ✔Latest ✔

* Firefox on Android, iOS not supported

Troubleshooting

Content Security Policy issues

In order to mitigate potential cross-site scripting issues, most modern browsers use Content Security Policy (CSP). These policies might prevent the SDK from correctly displaying the images captured during the flow or to correctly load styles. If CSP is blocking some of the SDK functionalities, make sure you add the following snippet inside the <head> tag of your application.

html
Copy
<meta
  http-equiv="Content-Security-Policy"
  content="
  default-src 'self' https://assets.onfido.com;
  script-src 'self' https://www.woopra.com https://assets.onfido.com https://sentry.io;
  style-src 'self' https://assets.onfido.com;
  connect-src blob: *.onfido.com wss://*.onfido.com https://www.woopra.com https://sentry.io;
  img-src 'self' data: blob: https://lipis.github.io/flag-icon-css/;
  media-src blob:;
  object-src 'self' blob:;
  frame-src 'self' data: blob:;
"
/>

SDK navigation issues

In rare cases, the SDK back button might not work as expected within the application history. This is due to the interaction of history/createBrowserHistory with the browser history API. If you notice that by clicking on the SDK back button, you get redirected to the page that preceeded the SDK initialisation, you might want to consider using the following configuration option when initialising the SDK: useMemoryHistory: true. This option allows the SDK to use the history/createMemoryHistory function, instead of the default history/createBrowserHistory. This option is intended as workaround, while a more permanent fix is implemented.

Example:

JavaScript
Copy
Onfido.init({
  useMemoryHistory: true,
})

Support

Please open an issue through GitHub. Please be as detailed as you can. Remember not to submit your token in the issue. Also check the closed issues to check whether it has been previously raised and answered.

If you have any issues that contain sensitive information please send us an email with the ISSUE: at the start of the subject to web-sdk@onfido.com.

Previous version of the SDK will be supported for a month after a new major version release. Note that when the support period has expired for an SDK version, no bug fixes will be provided, but the SDK will keep functioning (until further notice).

How is the Onfido SDK licensed?

Please see LICENSE for licensing details.

Changelog

All notable changes to this project will be documented in this file.

This change log file is based on best practices from Keep a Changelog. This project adheres to Semantic Versioning. Breaking changes result in a different MAJOR version. UI changes that might break customizations on top of the SDK will be treated as breaking changes too. This project adheres to the Node default version scheme.

6.7.1 - 2021-03-26

Fixed

  • UI: Fix host app/site's own link styling getting overridden by SDK's default theme styling

6.7.0 - 2021-03-25

Added

  • Internal: Introduce SdkOptionsProvider component and useSdkOptions() hook for SDK options' single source of truth.
  • Public: Added cross-device support for useCustomizedApiRequests callbacks via customer hosting of SDK. Note - This is a premium enterprise feature.
  • Public: Added support for UI customizations in SDK configuration using customUI option. See README for details of supported customization options.
  • Internal: Add Woopra tracking for UI customization option usage.

Changed

  • UI: Replaced internal button component with button from @onfido/castor-react.
  • UI: Replaced some Sass variables with CSS variables to allow customization of colors and fonts.
  • Public: Added new enterprise feature logoCobrand. When purchased and enabled allows integrator to provide their own logo image to be displayed alongside the Onfido logo.
  • Internal: Use Node 14 LTS for Travis to be consistent with .nvmrc and Dockerfile.

Fixed

  • UI: Fix Camera Permission icon not displaying on iOS devices on Selfie/Liveness capture flow

6.6.0 - 2021-03-09

Added

  • Internal: Added ScreenLayout component. This is currently used in the Welcome and Complete screens.
  • Public: Added user consent screen
  • Public: Added callbacks that are triggered on user media submission if the feature is enabled. Note - This is a premium enterprise feature.
  • Internal: App component, Redux system, utils, HoCs & routers are now typed in TypeScript.
  • Internal: Use ScreenLayout component in Confirm screen.

Changed

  • Internal: Replace ts-loader with @babel/preset-typescript for better TypeScript transpilation.

Fixed

  • Public: Fix zoomed document capture view for Document Live Capture on some Huawei devices, e.g. Huawei P40, P30.
  • Public: Fix issue where documents are submitted to Onfido API without filename or file type.

6.5.0 - 2021-02-08

Added

  • Public: Added npm latest version badge.
  • Internal: Now the UI tests will hit API endpoints from a dockerised mock server.
  • Internal: Introduce TypeScript on non-critical components & deprecate FlowType.
  • Internal: Introduce integration tests for API endpoint integrations.

Changed

  • Internal: Switched to bundlewatch Github Action for bundle size diff reporting, checking.
  • UI: Updated text and background colours.
  • Public: Removed references to MIT license in README and updated copy in LICENSE to refer to Onfido Service Agreement and 3rd party licenses reports.
  • Public: Return error for image quality failures on the first two document upload attempts.

Fixed

  • Public: Fix "File type not supported" error on snapshot upload in selfie step.
  • Public: Fix typo in en_US.json file

6.4.0 - 2020-12-21

Added

  • Internal: Introduce Hooks on non-critical components.
  • Public: Added CROSS_DEVICE_INTRO, CROSS_DEVICE_GET_LINK user analytic events for integrators to listen for when tracking user journey when initiating Cross Device flow from desktop browser
  • Public: Added licenses.json file containing the list of dependencies licenses.

Changed

  • UI: User is no longer blocked from uploading an image file over 10MB in size. Instead image is resized to 1440px if file size is over 3MB.
  • Internal: Update SDK's Publish Release workflow to not use the now deprecated set-env command.

Fixed

  • Public: Fixed issue where the SDK could not be initialised with poa as a single step.
  • Public: Only return Missing keys warning for unsupported language locale tags

6.3.1 - 2020-11-30

Fixed

  • Public: Fix missing country selector screen when the SDK is imported as an NPM module.

6.3.0 - 2020-11-09

Added

  • Internal: Added unit tests for Demo and App components
  • Public: Updated supported documents data to include Peru, Colombia as an issuing country option in Country Selection screen when user selects Residence Permit document type and remove Saudi Arabia option for National Identity Card document type.
  • Public: Added CROSS_DEVICE_START to Tracked events list
  • Public: Country Selection screen can now be suppressed for a non-passport document type when configured with a 3-letter ISO code.

Changed

  • Internal: Upgrade Preact from version 8.5.2 to 10.5.4.
  • Internal: Replace react-modal-onfido with version 3.11.2 of react-modal.
  • Internal: Refactor cross device option logic.

Fixed

  • Public: Fixed Woopra module import errors
  • Internal: Include isCrossDevice property and value in Document, Face capture payload's sdk_metadata object for data tracking

6.2.1 - 2020-11-04

Fixed

  • Public: Non-Latin localised strings throw exception in Welcome screen.

6.2.0 - 2020-10-19

Changed

  • UI: Accessibility - Update passport quality guide copy to be more descriptive for visually impaired users using screen readers
  • Internal: Update the Web SDK to handle telephony back end service's new error response format which is now consistent with API's error response format
  • Public: Improve description of showCountrySelection option for Document step to be more explicit about when/how it works and include example configurations.
  • Internal: Store third-party licence comments for each bundle in separate files.
  • Internal: Re-enable skipped tests for image quality logic.

Fixed

  • UI: Accessibility - Loading screen is now announced on iOS
  • Internal: Release script didn't update BASE_32_VERSION correctly and didn't finish at publishing tag step

6.1.0 - 2020-10-16

Added

  • Public: Add migrate_locales script to enable integrator migrate to next versions of Web SDK locale system.
  • Internal: Add unwrap_lokalise script to sanitise locale files pulled from Lokalise.

Changed

  • Public: Introduced new system for locale keys. Keys are now more structured and easier to find within the code.
  • Internal: Replace all string values from JS SDK to Web SDK and js-sdk to web-sdk.

Fixed

  • UI: Accessibility - Error and warning alert heading is now ARIA heading level 1
  • UI: Camera inactivity timeout only starts from camera access granted instead of on initial render
  • UI: Fixed call to action buttons covering content and instructions on Passport Image Guide, Selfie Intro screens when viewed on a mobile device with a shorter viewport, e.g. iPhone SE (1st gen)

6.0.1 - 2020-10-09

Fixed

  • Public: Updated supported documents data. This update includes adding Turkey as an issuing country option in Country Selection screen when user selects National Identity Card type.
  • Public: Only send issuing_country to the documents endpoint if issuing_country is present. This fixes the issue that was preventing documents upload when showCountrySelection was disabled and issuing_country was undefined.

6.0.0 - 2020-09-17

Added

  • UI: Add country selection screen after document selection. This screen is skipped by default for a preselected document but can still be displayed by enabling the showCountrySelection option for the document step.
  • UI: New warnings for cut-off & blurry images detection.
  • UI: When the uploaded image is either cut-off, glary or blurry, the end-user must retry at most 2 times prior to proceeding further.
  • UI: Added Residence Permit option for document selection
  • Internal: The release script and the release/RELEASE_GUIDELINE.md file now include the information needed to update the MIGRATION.md file.
  • Internal: Send additional system data in sdk_metadata which contains os, os_version, browser & browser_version info of the current session.

Changed

  • Internal: Changed resolution constraints for live document captures from 720 to 1080.
  • Public: Remove SMS_BODY key from locale files as it's not a customisable key and does not belong to this codebase.
  • Internal: Update SDK to handle new error response format from cross device SMS service

Fixed

  • Public: Return a generic error for unmapped Onfido API validation keys.
  • Fix typo in PhoneNumberInput SASS styles producing invalid CSS
  • UI: Fixed inconsistent font family for non Primary, Secondary button elements.

5.13.0 - 2020-08-24

Added

  • Public: Added isCrossDevice flag to user analytics events to differentiate between cross-device and non-cross-device user analytic events
  • Public: Added DOCUMENT_TYPE_SELECT and FACIAL_CAPTURE to user analytics event list
  • Public: Added option to pass a container element containerEl instead of a container ID string containerId. If containerEl is provided, then containerId will be ignored.

Changed

  • Internal: Sass CSS pre-processor is now used instead of Less.
  • Public: Fix live camera issues on certain Android devices, such as Huawei P20, when the useLiveDocumentCapture option for documents is enabled.
  • Internal: Fix cross-device SMS number input bundle import that broke when using newer versions of @babel/preset-env.
  • Internal: Added Prettier code formatting on npm run lint
  • Internal: Hybrid devices are now detected by checking if the device has touch screen and is Windows, instead of calling getUserMedia.
  • Internal: Use Onfido API v3 endpoints for documents, live_photos, live_videos and snapshots.
  • Public: When uploadFallback option is disabled for document or face live captures, display the unsupported browser error at the beginning of the flow.

Fixed

  • Public: Fixed spelling mistakes in Spanish translations for cross_device.link.sms_option and cross_device.link.qr_code_sub_title

5.12.0 - 2020-07-08

Added

  • Public: Added new enterprise feature cobrand. This allows integrators with access to the feature to display a co-branded footer with their company name, followed by "powered by Onfido" on all screens, including cross-device. Note that this will not be displayed if the hideOnfidoLogo enterprise feature is also enabled.
  • Internal: Added bundle size limit check for dist/style.css.
  • Public: Fix empty file sometimes being sent to /snapshots endpoint on some browsers when useMultipleSelfieCapture is enabled. This results in user seeing a "Unsupported File" error on Selfie upload.

Changed

  • Public: Moved UserAnalytics event firing outside of disableAnalytics config check

Fixed

  • UI: Top and bottom of icon cut off on Camera Permission screen for Document Auto Capture

5.11.1 - 2020-07-01

Fixed

  • Public: Fix issue preventing the SDK from loading or being updated in runtime if a step with type document is not found.

5.11.0 - 2020-06-30

Added

  • Public: Added check for cross_device_url in SDK Token to be used as the link for all cross device options instead of the default HOSTED_SDK_URL, if present. cross_device_url is an enterprise feature and can only be set when creating a SDK token if the feature is enabled.
  • Public: Added new enterprise feature hideOnfidoLogo. When purchased and enabled allows integrator to hide the Onfido logo on all screens, including cross-device.
  • UI: Added passport quality guide before upload/capture.

Changed

  • Public: Use history/createBrowserHistory as the default option to manage the SDK history. This change also gives the integrators the option to use history/createMemoryHistory by passing the configuration option useMemoryHistory: true to the SDK, in case history/createBrowserHistory does not behave as expected.
  • UI: Updated to new Onfido SDK watermark design

Fixed

  • Public: Fix issue that affects Safari on iOS 13.4.1, where the SDK was showing the wrong image rotation.
  • Public: Fix false Missing keys warning for present mobilePhrases. The warning should only be displayed when translation keys are missing.
  • Internal: Fix failing IE11 UI test for Passport upload

5.10.0 - 2020-06-16

Added

  • Internal: Added basic history to SDK demo.
  • Public: Added French translation. The language tag is fr_FR.

Changed

  • Internal: Remove unused dependencies and scripts from package.json
  • Public: Update description for region queryString in CONTRIBUTING.md
  • Public: Updated Browser Compatibility section in README.md to better indicate IE11, Firefox support
  • Public: Update English copy text for error message shown when no document is in the cameras view
  • Public: The useMultipleSelfieCapture configuration option is now stable and enabled by default
  • UI: All primary/secondary buttons now use the new width styling. This change also fixes the buttons UI issues noticeable when using de_DE as a language.

Fixed

  • UI: Accessibility - Focus is at document start
  • Public: Fix unexpected back button behaviour due to createBrowserHistory usage. The SDK now uses createMemoryHistory.
  • UI: Fixed blank screen displaying instead of Cross Device screen on desktop browsers when uploadFallback is disabled and browser does not have getUserMedia API support, e.g. IE11, or device does not have a camera.

5.9.2 - 2020-05-19

Fixed

  • UI: Fixed 2000ms delay to load Document Capture screen on non-Safari browsers

5.9.1 - 2020-05-14

Fixed

  • UI: Camera not detected on Safari 13.1 on iOS 13.4.1, macOS 10.15.4

5.9.0 - 2020-04-28

Added

  • Public: Added German translation and Lokalise integration. The expected language tags are now en_US, es_ES, de_DE. For backward compatibility, the SDK can also be initialised with tags that do not include the region, e.g.en, es, de.
  • Public: Added information on api/token regions to documentation.
  • Internal: Added CA region in demo app. The region can be selected in the previewer or by using a query string.

Changed

  • Public: Updated to react-webcam-onfido@0.1.18 to have fix for camera stream not getting on some Android devices, e.g. Motorola G5, Samsung Galaxy A6

Fixed

  • Public: Fix moderate vulnerabilities in minimist, a sub-dependecy used by @babel/cli and @babel/register.
  • Public: Fixed hybrid device camera detection and access request
  • Public: Fixed bug where user is able to click/tap on the button on the Camera screen before allowing/denying permission.
  • Public: Fixed iPads on iOS13 not getting detected as mobile device on cross device flow.

5.8.0 - 2020-03-19

Added

  • Public: Changes to allow hybrid desktop/mobile devices with environment facing cameras (e.g. Surface Pro) to use the useLiveDocumentCapture feature (BETA feature)
  • Public: Added a userAnalyticsEvent to existing analytics calls for integrators to listen for.
  • Internal: Analytics can now be disabled via the disableAnalytics option
  • Internal: Test coverage for snapshot feature
  • Internal: Send additional properties to back-end in sdkMetadata object
    • isCrossDeviceFlow (true|false)
    • deviceType (mobile|desktop)
    • captureMethod (live|html5)

Changed

  • Internal: Use v2/snapshots endpoint to upload additional selfie frames.
  • Internal: Split Confirm component into multiple files.
  • UI: Accessibility - Update font colours and weight following DAC Audit report feedback
  • Internal: Pushing dist files to S3 and publishing the release to NPM has been automated using GitHub Actions
  • Internal: Improve UI tests stability when looking for and clicking on UI elements
  • Public: Documentation should use v3 for API endpoints and include links to migration guide.

Fixed

  • Public: Fixed bug where iPads on iOS13 were detected as desktop devices.
  • Public: Made fallback error message appropriate for both face and document verification
  • Public: Fixed video recording in liveness capture step not working for Firefox >= 71
  • Internal: Fix flaky modal UI tests
  • Public: Fixed bug where blob was not handled correctly when an upload event was fired on IE11
  • Public: Fixed camera permission screen layout issue on desktop Safari where buttons disappears below view height
  • Public: Prevent "submit" event from being emitted when selecting a document

5.7.1 - 2020-02-25

Fixed

  • Public: Cross-device client and link now works when desktop SDK configured with US JWT

5.7.0 - 2020-01-22

Added

  • Public: Added a troubleshooting section to the documentation with details about solving CSP related issues
  • UI: Added selfie intro screen
  • UI: Option to send cross device secure link using QR code (Note: changes introduced with this UI update include possible breaking changes for integrators with custom translations or copy)

Changed

  • UI: Unsupported browser message for mobile browsers without getUserMedia API support when uploadFallback option is disabled for live document capture and selfie/liveness capture steps
  • Internal: Redux and EventEmitter are not in the global scope anymore. The tearDown function will only unmount the SDK.
  • UI: As part of work to add the QR code option for cross device secure link the UX has been updated for the copy link and SMS options

Fixed

  • Internal: Fixed Latest Surge link version not getting updated during release process
  • UI: Fixed Liveness capture staying darkened after x-device message dismissed
  • Accessibility: Changed Liveness background colour from 66% to 80%

5.6.0 - 2019-12-09

Note: This version might be a breaking change if you are providing customised language translations. Please see MIGRATION.

Added

  • Internal: Added UI test to check Submit Verification button is not clickable multiple times if Complete step is excluded
  • Internal: Deploy source maps to Sentry using @sentry/cli within our deployment script

Changed

  • Internal: Updated react-webcam-onfido to get check(s) for stream before calling getVideoTracks/getAudioTracks method
  • Internal: Removed libphonenumber-js from main bundle. Reduced bundle size limit by 20%.
  • Internal: Use @sentry/browser instead of raven to track Sentry events
  • UI: New Document Upload screen (Note: changes introduced with this UI update include possible breaking changes for integrators with custom translations or copy)

Fixed

  • Internal: Latest Surge link gets updated only on release of a full version, not release candidates or beta releases
  • UI: Fixed missing "basic camera mode" link style on "Camera not working" timeout error message when going through flow on mobile
  • UI: Fixed Back button not taking user to the right place during liveness recording
  • UI: Fixed invalid but possible number error blocking subsequent retries
  • UI: Users should not be able to click or tap on confirmation buttons or camera buttons multiple times. This will prevent callbacks (such as the onComplete callback) or click events to be fired multiple times.

5.5.0 - 2019-10-31

Added

  • Public: useLiveDocumentCapture option added to the document capture step (BETA feature)
  • Internal: Added bundlesize script to fail the build if our bundle becomes bigger than 400kb. It also tests that cross-device chunk does not exceeds 3kb.
  • Internal: Added npm audit script to the build using audit-ci to detect dependencies vulnerabilities at PR level.

Fixed

  • UI: Accessibility - Non-interactive Header elements do not get announced with "Double tap to activate" by Android Talkback
  • UI: Custom string nextButton set for the welcome step is now displayed
  • Internal: Fixed flaky UI tests by adding functions that wait until the elements are located or clickable

5.4.0 - 2019-10-03

Added

  • UI: Added hover and active state styles for clickable UI elements (buttons, links)
  • Public: Added onError callback. Callback that fires when one of the following errors occurs: timeout errors, authorization errors, server errors and invalid and expired token errors.

Changed

  • Public: Disable console warning for client integrations that override only some strings for a supported language. If they provide partial translations for an unsupported language, warning is still displayed.
  • Public: Only upgrade to patch versions of socket.io-client. See issue here

Fixed

  • UI: Accessibility - Make camera feed view accessible to screen readers
  • UI: Accessibility - More descriptive ARIA label for camera shutter button
  • Public: Fixed user being able to submit verification multiple times on coming back to desktop from the cross device flow if integrator has opted to exclude the complete step in SDK setup
  • Public: Fix wrong cross device redirection when user is already on mobile (iOS 10)

5.3.0 - 2019-09-03

Added

  • UI: User can now drag and drop images on desktop uploader
  • Public: option to configure click on overlay behaviour when SDK presented modally using shouldCloseOnOverlayClick option
  • Internal: Added basic automated tests for accessibility features
  • UI: Accessibility - Make Liveness screens accessible to screen readers
  • UI: Accessibility - Make Cross Device phone number input accessible to screen readers
  • Internal: Added automated testing for features using camera stream
  • Public: Added useMultipleSelfieCapture option for the face step. By enabling this configuration, the SDK will attempt to take multiple applicant selfie snapshots to help improve face similarity check accuracy.
  • Internal: Fetch URLs from JWT when present, otherwise use defaults

Changed

  • Public: Unbundled dependencies for npm. This also fixes the current issue with imports (tested on Next.js, Create-react-app and Storybook) and solves #615, #668, #733
  • UI: Changed camera permission screen design
  • Internal: Disable source maps for NPM build. Source maps will still be enabled for /dist build
  • Internal: Upgraded Preact for compatibility with latest version of React DevTools

Fixed

  • Public: Fixed user seeing the video capture intro screen, followed by selfie capture screen instead of x-device intro screen when video capture is enabled but device has no camera
  • Public: Fixed wrong message displaying on the Cross Device "End of Flow" screen
  • Public: Fixed footer overlapping Proof of Address document type list at the bottom of the container
  • Public: Fixed user seeing front side of previously uploaded 2-sided document in Proof of Address upload step

5.2.3 - 2019-07-18

Fixed

  • Public: Removed tarball as a way to import wpt library. The package is now imported as a dev-dependecy and is pointing at the new Woopra repository on github.

5.2.2 - 2019-06-19

Added

  • Internal: Better automation of the release process
  • UI: Accessibility - Make screenreader navigation work in modal mode

Changed

  • Public: Use tarball when importing wpt library

Fixed

  • Public: Fixed bug where double clicking on Send Link button then skips straight to Complete screen
  • Public: Fixed scrollbar appearing on some machines/devices

5.2.1 - 2019-05-30

Added

  • UI: Accessibility - Announce validation error on cross device SMS link screen

Changed

  • UI: Accessibility - Update all visually obvious lists to use the relevant HTML list elements

Fixed

  • Public: When glare is detected, onComplete callback returns doc id

5.1.0 - 2019-05-23

Added

  • UI: Accessibility - Make H1 readable by screen readers
  • UI: Accessibility - Make buttons/links readable by screen readers, allow tabbing to them
  • UI: Accessibility - Sort out order of items when tabbing through the content of each step
  • UI: Accessibility - Announce page transition when screen changes
  • UI: Accessibility - Make capture previews readable by screen readers
  • UI: Accessibility - Announce enlargement of captured image in preview
  • UI: Accessibility - Announce camera alerts
  • UI: Accessibility - Announce validation errors and warnings on confirm screen

Changed

  • Internal: Make Permission screen and Recovery screen buttons visible on small devices
  • Internal: The third party analytics (Woopra) is now imported via a dummy window in order not to pollute the shared global window

Fixed

  • Public: Handle non JSON error responses and return a Connection Lost error to the user
  • UI: Make sure "full screen" mode is off when navigating away from enlarged preview
  • UI: Make sure all buttons have a type of a "button" set
  • Internal: Fixed vulnerabilities on some dev dependencies

5.0.0 - 2019-04-01

Fixed

  • Public: Fixed issue where the user is prompted to submit the same document capture twice and fixed broken custom input UI by adding higher CSS specificity
  • Internal: We are using an updated version of socket.io server, which allows for better horizontal scalling.

Changed

  • Public: If the SDK is initialised with only one document type, users will not see the document selection screen, instead they will see the capture screen straight away.
  • Internal: Woopra is no longer polluting the global window object

4.0.0 - 2019-03-18

Added

  • Public: Prepopulate the user's mobile phone number, when specified through the userDetails.smsNumber option
  • Public: Send through details (such as ids) of the uploaded files, in the onComplete event
  • Public: Added forceCrossDevice option to document step. The feature forces users to use their mobile to capture the document image. It defaults to false. Not available on the Proof of Address flow.
  • Public: Upload fallback for the face step can be disabled by using the option { uploadFallback: false }. The default value is true (feature released in 3.1.0 as Internal)
  • Internal: Add an internal-only warning for internal-users of the cross-device flow (a warning entirely stripped in production)

Changed

  • Public: ES style import interface has been changed to a more standard one
  • Internal: Changed the way that blob/base64 files and images are rendered and passed through the system
  • Internal: Changed CSS units to be consistently em (but still tied to px at our root, until we can fix our media queries)
  • Public: More meaningful error message for upload fallback disabled on face step
  • Internal: Map colours and use less variables instead of hard-coding colour values
  • UI: Fixed issue with footer overlapping content, prevent buttons from disappearing below viewport, prevent images from overlapping buttons.
  • Internal: Rebranding of background, border and primary colors.
  • Internal: Woopra tracker now points at the latest tag of https://github.com/Woopra/js-client-tracker
  • Internal: Upgraded to webpack 4, removed import/export transpilation. Reduced bundle size as result.

Fixed

  • Public: Users entering the cross-device flow twice would have been able to request an SMS message without re-entering their mobile number correctly (the form could submit when still blank)
  • Internal: Fix a bug that potentially allowed 3rd party tracking scripts to (in some very specific conditions) continue to send Onfido tracking events, after calling .tearDown()
  • Public: Users could previously see a flicker of other screens when loading any flow involving the camera. This should now no longer occur, except in rare circumstances (where permissions/capabilities have changed since last render)
  • Public: Workaround an iOS Safari issue that causes a possible browser crash when mounting the webcam component multiple times

3.1.0 - 2019-01-28

Added

  • Public: Added Proof of address poa step where users can capture their proof of address documents. This is a beta feature.
  • Internal: Further device metadata submitted to Onfido API
  • Internal: Upload fallback for the face step can be disabled by using the option { uploadFallback: false }. The default value is true
  • Internal: Added multi-frame capture for the standard variant of the face step (only for camera capture).

Changed

  • Internal: Cross device client can now only be opened on mobile browsers. Users trying to open the link on a desktop browsers will see an error.
  • Internal: Removed unused development dependencies which had known vulnerabilities

3.0.1 - 2018-12-19

Fixed

  • Internal: Fixed an infinite loading loop that happened when video liveness is enabled and if, and only if, users transitioned from a desktop browser that support video liveness to a mobile browser that does not support video liveness

3.0.0 - 2018-10-31

Added

  • Internal: Introduce Jest unit testing framework
  • Public: Added support for default SMS number country code. The default country for the SMS number input can be customised by passing the smsNumberCountryCode option when the SDK is initialised. The value should be a 2-characters long ISO Country code string. If empty, the SMS number country code will default to GB.
  • UI: UI improvements including adding back icon with hover state and icon to close the modal

Changed

  • Public: Remove support for buttonId initialization option
  • Internal: Use imports-loader instead of script-loader to import Woopra
  • Internal: Ensures only onfido related events are included as part of the payloads sent to Sentry
  • Internal: Stop sentry tracking after tearDown
  • Internal: Prevent Raven from using console.log output for breadcrumbs by setting autoBreadcrumbs: { console: false }

2.8.0 - 2018-09-20

Changed

  • UI: Documents can be enlarged for inspection
  • UI: Camera warnings are now dismissible
  • UI: Title copy change on video confirmation screen

Fixed

  • Public: Fixed error with missing stream recording
  • UI: Fixed document selector UI on IE11
  • UI: Fixed overlapping footer and buttons on confirmation screen on Firefox

2.7.0 - 2018-09-03

Added

  • Public: Introduced ability to capture videos on the face step. Developers can now request a preferred variant for the face step, by adding the option requestedVariant: 'standard' | 'video'. If empty, it will default to standard and a photo will be captured. If the requestedVariant is video, we will try to fulfil this request depending on camera availability and device/browser support. In case a video cannot be taken the face step will fallback to the standard option. At the end of the flow, the onComplete callback will return the variant used to capture face and this can be used to initiate the facial_similarity check.

Changed

  • Public: The onComplete callback now returns an object including the variant used for the capture step. The variant can be used to initiate the facial_similarity check. Data returned: {face: {variant: 'standard' | 'video'}}.
  • UI: Selfie UI to adopt full container layout on desktop.
  • Internal: CSS namespacing now includes the full path of the component, to mitigate chances of name collision. Only impacts components nested in another component folder.

2.6.0 - 2018-08-08

Changed

2.5.0 - 2018-07-27

Added

  • UI: Added a permission priming screen to inform the user that camera permissions must be enabled.
  • UI: Added a permission recovering screen in case user media permissions are denied.
  • UI: Added intro screen when entering cross device flow.

Changed

  • UI: Changed UI for face capture step. On small screens it will display a full screen camera component.
  • UI: Desktop - If webcam is not available, a cross device intro screen will be shown to allow the user to take a live photo on their mobile phones.

2.4.1 - 2018-05-18

Fixed

  • Public: Fixed bug where hitting Enter key on the SMS input number was causing page reload.

2.4.0 - 2018-05-17

Added

  • Public: Added documentTypes to the document step options, which allows to filter the document types.

Changed

  • Internal: Refactored layout to better handle presence of header and footer elements.
  • Internal: On cross device client clear error message when configuration is received.

2.3.0 - 2018-04-17

Added

  • Public: Added onModalRequestClose options, which is a callback that fires when the user attempts to close the modal.

Fixed

  • Public: Fixed complete step to allow string customization at initialization time.
  • Internal: Fixed the tearDown method to clear the onComplete callback functions. (issue #306)

Deprecated

  • Internal: Removed references to useWebcam option from README.md and return console warning if the option is used.

2.2.0 - 2018-02-13

Added

  • Public: Added support for internationalisation. The SDK can now be displayed in Spanish by adding {language: 'es'} to the initialization options. It can also be displayed in a custom language by passing an object containing the custom phrases and the locale. If language is not present or the wrong locale tag is provided, the language locale will default to en.
  • Public: Added support for Spanish language on the SMS body.
  • Public: Added webcam support on Safari and IE Edge.

Changed

  • UI: If the webcam is facing the user it will be mirrored

2.1.0 - 2017-11-30

Added

  • UI: The cross device feature now supports sending the link via SMS. Users will still be able to copy the link to clipboard.
  • UI: Introduced a back button that allows the user to navigate to the previous screen.
  • Internal: Introduced code splitting and lazy loading

2.0.0 - 2017-11-08

In this version, we're introducting cross-device flow that allows to continue verification on mobile in order to take photos of your document and face.

Note:

  • This version is not backwards-compatible. Migration notes can be found in MIGRATION.md

Removed

  • Public: Removed onDocumentCapture that used to be fired when the document had been successfully captured, confirmed by the user and uploaded to the Onfido API
  • Public: Removed onFaceCapture callbacks that used to be fired when the face has beed successfully captured, confirmed by the user and uploaded to the Onfido API.
  • Public: Removed getCaptures function that used to return the document and face files captured during the flow.
  • Internal: Removed confirm action

Changed

  • Public: Changed the behaviour of onComplete callback. It used to return an object that contained all captures, now it doesn't return any data.

Added

  • UI: Introducing glare detection feature for documents. Not available for documents in PDF format yet.
  • Internal: Added confirm step to router history and tracking

Changed

  • UI: Improved how errors and warnings are displayed on the UI
  • UI: Improved navigation between steps when using the browser navigation buttons
  • Internal: Improved event tracking
  • Internal: Upgraded Preact to latest version

Note

Bumping version to 1.0.0 because SDK has already been implemented in production integrations. Also SDK now integrates with Onfido API.

Changed

  • Public: Support uploading documents and live photos to the Onfido API through use of new SDK tokens (JWT v2)

Removed

  • Public: Face no longer supports PDF upload in order to align with the Onfido API.

Fixed

  • Internal: Fixed problem on certain versions of Firefox that no longer supported the old version of getUserMedia
  • Internal: Fixed the tearDown method to clear the documents and faces currently in the store
  • Internal: Fixed PDF preview issues on IE Edge, IE11 and mobile browsers.
  • Internal: Fixed lower resolution webcams not working on Firefox

Changed

  • Internal: replaced the has_webcam checker with a more robust version that periodically checks if the state changed
  • Internal: Increased the file size upper limit to 10 MB.

Changed

  • Internal: Use HTTP protocol to post documents to the server instead of websockets

Fixed

  • Public: Fixed intermittent connection problem

Changed

  • Public: Document and face captures will be returned by callbacks as File or Blob instead of base64.
  • Internal: Callbacks are now linked to the flow rather than the Redux store.

Added

  • Public: Capture the reverse side of driving licenses and ID cards.
  • Public: Add a file size limit of 4 MB in line with the Onfido API.

Fixed

  • Internal: Read exif tags to orientate images correctly.

Changed

  • Public: Change the default to use file upload rather than the webcam for document captures.
  • Internal: Fix dependencies to avoid bugs due to changes in minor updates.

0.12.0-rc.1

Install with npm install onfido-sdk-ui@0.12.0-rc.1

Changed

  • Internal: Change the signature expected from the websockets server.

Fixed

  • Public: The documentType in the capture object now corresponds to the API document_types.
  • Public: Fixed bug where URL path was removed between steps.

0.11.1 - Hotfix

Fixed

  • Public: Fixed bug where Onfido.getCaptures() and onComplete(hash) was returning a broken hash.
  • Internal: Froze dependencies which were causing the upload document and pdf preview not to work.

Changed

  • Internal: Removed preact-router.
  • Public: Removed URL routes for each step of the SDK flow.
  • Internal: Removed unused components - Dropdown and ActionBar.
  • Internal: Use the staging backend when in development.
  • Updated version of onfido-sdk-core to 0.7.1.

Added

  • Public: tearDown method to remove the SDK elements.

Changed

  • Internal: Use visibilityjs to pause captures when the tab is inactive.
  • Internal: The copy of the document not found error message was changed.
  • Internal: Changed the order of the document selection to passport, driver's license and identity card.
  • Public: The returned webcam captures now have a resolution of 960x720, or lower if the webcam does not support it.
  • Internal: The confirmation step for webcam captures now displays the new high resolution images.
  • Internal: Updated react-webcam-onfido in order to get the higher resolution functionality.

Added

  • Public: Uploaded PDF files are now supported and returned by the callbacks as base64.
  • Internal: PDF files are displayed in the confirmation step as an embedded object, which means the browser needs to support pdf files in order for them to be visible.

Changed

  • Public: document and face callback are now passed only their respective capture, instead of both their captures.
  • Public: document and face callback are now only called after the user has confirmed the capture
  • Public: document, face and complete callback can be called multiple times, if the condition that triggers them is met more than once (eg. if the user goes back to redo the capture steps)
  • Internal: callbacks' returned value now have no impact on the event dispatcher.

Fixed

  • All captures have now a default no op function. This fixes an exception raise (in case some callbacks where not defined), which caused the rest of the callbacks not to be called after the exception was raised.

Fixed

  • Updated react-webcam to the onfido fork, this fixes the issue where the webcam canvas (used to obtain screenshots) has 0 height under certain circumstances (namely on windows machines running Chrome). This bug, when it happened, caused the document capture step not to work.

Added

  • Started tracking fatal exceptions and page views of the SDK.

Fixed

  • Fixed bug of a broken layout on the document selection step. Always reproducible on IE and on other browsers too, but only when going back a step on certain conditions.
  • Fixed bug where on IE an unnecessary scrollbar appeared and the scrolling area was bigger than it should have been.

Added

  • Public: An error message is now shown if the upload file has as unsupported file type.

Fixed

  • Object.assign was being used but not polyfilled. Its occurrence was replaced with an es6 object construction.
  • UI disappeared if the browser's windows width was smaller than 481px;

Changed

  • Public: Captures are now returned as png instead of webp, although webp is still used internally for streaming to the server.
  • Public: the captures returned by Onfido.getCaptures() have a simplified signature of just {id,image,documentType}.
  • Public: It's now possible to open and close the modal by calling .setOptions({isModalOpen:boolean})
  • Internal: The modal has been refactored to be fully reactive, vanilla-modal has been replaced with a fork of react-modal.
  • Internal: Updated to onfido-sdk-core@0.6.0, selectors are now more general as in they are no longer specific to each capture type, some new selectors are also being used.
  • Internal: Camera, Capture and Uploader have been refactored, the pure part of the components have been separated from the state logic part. This adds flexibility and encapsulation.
  • Internal: The Capture component now orchestrates all the state logic of the Uploader component, this allows to join the camera and uploader state logic together.

Added

  • Public: The capture screen UI now includes an upload button fallback, for whenever the user experiences problems with the webcam.
  • Internal: When requesting to validate documents there is now a strategy to cope with slow responses from the server. If the number of unprocessed documents is 3+, the client stops sending more requests until a response is given.
  • Internal: webp falls back to jpeg in case the browser does not support it.

Changed

  • Public: onComplete event now fires only after both the document and face captures have been confirmed in the UI
  • Internal: updated onfido-sdk-core to 0.5.0 which causes the all capture event to be triggered when captured are both valid and confirmed
  • Internal: made the confirm button change the state of the capture to confirmed

Fixed

  • Internal: sometimes when document was retaken multiple times the capture ended up squashed. This was fixed by upgrading to react-webcam@0.0.14.
  • Internal: fixed Bug #36, it caused the face to be captured every second after a document retake.

Changed

  • Public: Onfido.init() now returns an object.
  • Internal: isDesktop detection is now based on DetectRTC's isMobile detection
  • Internal: improved Webcam Detection, it now takes into account wether a Webcam exists and if it the user has given the website permission to use it. Before it was only checking whether the getUserMedia API is supported by the browser or not. DetectRTC is used for this detection.

Added

  • Public: it's now possible to change the init options at runtime by calling setOptions() on the object returned by Onfido.init()
  • Public: useWebcam option added to the facial and document capture step

Fix

Added

  • API: Flow customization option steps:[]
  • UI: Overlay to the webcam document capture (Possibly breaking change)
  • DOC: Integration examples to documentation

Fixed

  • NPM (commonjs2) style of importing the library now works

Onfido Web SDK Migration Guide

The guides below are provided to ease the transition of existing applications using the Onfido SDK from one version to another that introduces breaking API changes.

6.5.0 -> 6.6.0

Added strings

The English copy for the following string(s) has been added:

user_consent.button_primary user_consent.button_secondary user_consent.prompt.button_primary user_consent.prompt.button_secondary user_consent.prompt.no_consent_detail user_consent.prompt.no_consent_title

Note: The consent screen copy is only available in English

6.4.0 -> 6.5.0

From version 6.5.0, TypeScript is officially supported. If you previously installed the DefinitelyTyped package, you can safely remove it because the distributed NPM package already contains an index.d.ts declaration file.

6.1.0 -> 6.2.0

Changed strings

The English, Spanish, German, and French copy for the following string(s) has changed:

  • upload_guide.image_detail_blur_label
  • upload_guide.image_detail_glare_label
  • upload_guide.image_detail_good_label

6.0.1 -> 6.1.0

Introduce migrate_locales script

From version 6.1.0, Web SDK will use a new locale key naming convention that better supports scalability. As a result, many key names will be changed and this might affect the integrator's custom locale options. The migrate_locales script will help integrators migrate from the older key name convention to the new one with minimal hassle.

To use the script:

  • Upgrade onfido-sdk-ui package to latest version 6.1.0

  • Create a JSON file containing custom locales which was fed to Onfido.init() method. For instance:

    JavaScript
    Copy
    // your-custom-language.json
    {
      "locale": "en_US",  // untouched keys
      "phrases": {        // required key
        "capture": {
          "driving_licence": {
            "front": {
              "instructions": "Driving license on web"
            }
          }
        },
        "complete.message": "Complete message on web"
      },
      "mobilePhrases": {  // optional key
        "capture.driving_licence.front.instructions": "Driving licence on mobile",
        "complete": {
          "message": "Complete message on mobile"
        }
      }
    }
    
  • Consume the script directly from node_modules/.bin:

    shell
    Copy
    $ migrate_locales --help                # to see the script's usage
    
    $ migrate_locales --list-versions       # to list all supported versions
    
    Supported versions:
      * from v0.0.1 to v1.0.0
    
    $ migrate_locales \
      --from-version v0.0.1 \
      --to-version v1.0.0 \
      --in-file your-custom-language.json \
      --out-file your-custom-language-migrated.json
    
  • The migrated data should look like this:

    JavaScript
    Copy
    // your-custom-language-migrated.json
    {
      "locale": "en_US",
      "phrases": {
        "new_screen": { // renamed key in nested object
          "driving_licence": {
            "front": {
              "instructions": "Driving license on web"
            }
          }
        },
        "screen_1.complete.message": "Complete message on web", // 2 generated keys from 1 old key
        "screen_2.complete.message": "Complete message on web"
        "mobilePhrases": { // force nesting because standalone `mobilePhrases` will be deprecated soon
          "new_screen.driving_licence.front.instructions": "Driving licence on mobile", // renamed key in dot notation
          "screen_1": { // 2 generated keys from 1 old key
            "complete": {
              "message": "Complete message on mobile"
            }
          },
          "screen_2": {
            "complete": {
              "message": "Complete message on mobile"
            }
          }
        }
      },
    }
    
  • Notes: the script will preserve:

    • Order of the keys
    • Format: if your old keys are nested as an object, the migrated keys will be nested too. Otherwise, if your old keys are string with dot notation, the migrated keys will be string too.

5.10.0 -> 6.0.0

Change in UX flow for Document step

  • Document step now has a Issuing Country Selection screen after the Document Type Selection screen. This screen is never displayed for passport documents and is disabled by default when only 1 document is preselected using the documentTypes option. This screen can still be included in the document capture flow of non-passport preselected documents by enabling the showCountrySelection option in the Document step configuration.

Example of Document step with Country Selection for a preselected non-passport document

JSON
Copy
{
  "steps": [
    "welcome",
    {
      "type": "document",
      "options": {
        "documentTypes": {
          "passport": false,
          "driving_licence": false,
          "national_identity_card": true
        },
        "showCountrySelection": true
      }
    },
    "complete"
  ]
}

Example of Document step without Country Selection for a preselected non-passport document (default behaviour)

JSON
Copy
{
  "steps": [
    "welcome",
    {
      "type": "document",
      "options": {
        "documentTypes": {
          "passport": false,
          "driving_licence": false,
          "national_identity_card": true
        },
        "showCountrySelection": false
      }
    },
    "complete"
  ]
}

Example of Document step configurations with preselected documents where Country Selection will still be displayed

JSON
Copy
{
  "steps": [
    "welcome",
    {
      "type": "document",
      "options": {
        "documentTypes": {
          "passport": true,
          "driving_licence": true,
          "national_identity_card": true
        }
      }
    },
    "complete"
  ]
}
JSON
Copy
{
  "steps": [
    "welcome",
    {
      "type": "document",
      "options": {
        "documentTypes": {
          "passport": true,
          "national_identity_card": true,
          "driving_licence": false
        }
      }
    },
    "complete"
  ]
}

Added strings

  • country_selection.error
  • country_selection.dropdown_error
  • country_selection.placeholder
  • country_selection.search
  • country_selection.submit
  • country_selection.title
  • capture.residence_permit.front.title
  • capture.residence_permit.back.title
  • confirm.residence_permit.message
  • document_selector.identity.residence_permit_hint
  • residence_permit

Changed strings

The English, Spanish, German, and French copy for the following string(s) has changed:

  • document_selector.identity.title
  • document_selector.identity.hint

Changed keys

The following keys have been renamed:

  • errors.server_error.instruction => errors.request_error.instruction
  • errors.server_error.message => errors.request_error.message

Removed strings

  • SMS_BODY

5.7.0 -> 5.10.0

Added strings

  • image_quality_guide.title
  • image_quality_guide.sub_title
  • image_quality_guide.all_good
  • image_quality_guide.not_cut_off
  • image_quality_guide.no_glare
  • image_quality_guide.no_blur
  • image_quality_guide.image_alt_text
  • image_quality_guide.next_step
  • mobilePhrases.image_quality_guide.title
  • mobilePhrases.image_quality_guide.next_step

Changed strings

The English copy for the following string(s) has changed:

  • errors.invalid_capture

5.6.0 -> 5.7.0

With release 5.7.0 there are breaking changes that will affect integrators with customised languages or UI copy.

Added strings

  • capture.face.intro.title

  • capture.face.intro.subtitle

  • capture.face.intro.selfie_instruction

  • capture.face.intro.glasses_instruction

  • capture.face.intro.accessibility.selfie_capture_tips

  • continue

  • cross_device.intro.title

  • cross_device.intro.sub_title

  • cross_device.intro.description_li_1

  • cross_device.intro.description_li_2

  • cross_device.intro.description_li_3

  • cross_device.intro.action

  • cross_device.link.sms_sub_title

  • cross_device.link.copy_link_sub_title

  • cross_device.link.qr_code_sub_title

  • cross_device.link.options_divider_label

  • cross_device.link.sms_option

  • cross_device.link.copy_link_option

  • cross_device.link.qr_code_option

  • cross_device.link.qr_code.help_label

  • cross_device.link.qr_code.help_step_1

  • cross_device.link.qr_code.help_step_2

  • cross_device.link.copy_link.action

  • cross_device.link.copy_link.success

Removed strings

  • cross_device.intro.document.title

  • cross_device.intro.document.take_photos

  • cross_device.intro.document.action

  • cross_device.intro.face.title

  • cross_device.intro.face.take_photos

  • cross_device.intro.face.action

  • cross_device.link.sub_title

  • cross_device.link.link_copy.action

  • cross_device.link.link_copy.success

Changed strings

The English and Spanish copy for the following string(s) has changed:

  • cross_device.link.copy_link_label
  • cross_device.link.sms_label

5.0.0 -> 5.6.0

With release 5.6.0 there is a breaking change that will affect integrators with customised languages or UI copy.

Note: The string custom translation version scheme has changed, going forward if the strings translations change it will result in a MINOR version change, therefore you are responsible for testing your translated layout in case you are using custom translations or copy.

Added strings

  • capture.switch_device

Removed strings

  • cross_device.switch_device.submessage

Changed strings

The English and Spanish copy for the following string(s) has changed:

  • capture.upload_file
  • errors.invalid_size.message
  • errors.invalid_size.instruction

The English copy for the following string(s) has changed:

  • capture.driving_licence.front.title
  • capture.driving_licence.back.title
  • capture.national_identity_card.front.title
  • capture.national_identity_card.back.title
  • capture.passport.front.title
  • capture.bank_building_society_statement.front.title
  • capture.utility_bill.front.title
  • capture.benefit_letters.front.title
  • capture.council_tax.front.title
  • errors.invalid_type.message
  • errors.invalid_type.instruction

4.0.0 -> 5.0.0

We have changed the behaviour of the document step. If the document step is initialised with only one document type, the document selector screen will not be displayed. If your application relies on the document selector screen, even if you are picking only one document, you will have to implement that UI yourself.

3.1.0 -> 4.0.0

Import breaking changes

We have changed how the SDK is exported, in order to reduce redundant transpiled code and to better trim dead code too. This led to a size reduction overall.

However, this has potentially created a breaking change for those consuming the SDK with an ES style of import. Classic window style import and commonjs require should work the same.

Example of old behaviour

js
Copy
import Onfido from 'onfido-sdk-ui'

Onfido.init(...)

Example of new behaviour

js
Copy
import {init} from 'onfido-sdk-ui'
init(...)

or

js
Copy
import * as Onfido from 'onfido-sdk-ui'
Onfido.init(...)

Style Breaking change

  • We have internally changed the CSS units used in the SDK to be relative (em) units.

Therefore, if you previously set the font-size of .onfido-sdk-ui-Modal-inner, it is recommended that you remove this font-size override.

This is because we are looking to make the SDK compatible with em, but first we need to remove media queries which are not really compatible with that unit.

Example of old behaviour

css
Copy
.onfido-sdk-ui-Modal-inner {
  font-size: 20px;
}

Example of new behaviour

css
Copy
.a-more-specific-selector {
  font-size: 20px;
}

2.8.0 -> 3.0.0

Breaking changes

  • Removed support for buttonId. From this version you will need to create a function that launches the SDK when a trigger element (ie a button) is clicked.

Example of old behaviour

html
Copy
<script>
  Onfido.init({
    useModal: true,
    buttonId: 'onfido-btn',
    token: 'YOUR_JWT_TOKEN',
    onComplete: function (data) {
      // callback for when everything is complete
      console.log('everything is complete')
    },
  })
</script>

<body>
  <button id="onfido-btn">Verify identity</button>
  <div id="onfido-mount"></div>
</body>

Example of new behaviour

html
Copy
<script>
  var onfido = {}

  function triggerOnfido() {
    onfido = Onfido.init({
      useModal: true,
      isModalOpen: true,
      onModalRequestClose: function () {
        // Update options with the state of the modal
        onfido.setOptions({ isModalOpen: false })
      },
      token: 'YOUR_JWT_TOKEN',
      onComplete: function (data) {
        // callback for when everything is complete
        console.log('everything is complete')
      },
    })
  }
</script>

<body>
  <!-- Use a button to trigger the Onfido SDK  -->
  <button onClick="triggerOnfido()">Verify identity</button>
  <div id="onfido-mount"></div>
</body>

1.1.0 -> 2.0.0

Breaking changes

  • Removed onDocumentCapture that used to be fired when the document had been successfully captured, confirmed by the user and uploaded to the Onfido API
  • Removed onFaceCapture callbacks that used to be fired when the face has beed successfully captured, confirmed by the user and uploaded to the Onfido API.
  • Removed getCaptures function that used to return the document and face files captured during the flow.
  • Changed the behaviour of onComplete callback. It used to return an object that contained all captures, now it doesn't return any data.

Example of old behaviour

js
Copy
Onfido.init({
  token: 'YOUR_JWT_TOKEN',
  containerId: 'onfido-mount',
  onDocumentCapture: function (data) {
    /*callback for when the*/ console.log(
      'document has been captured successfully',
      data
    )
  },
  onFaceCapture: function (data) {
    /*callback for when the*/ console.log('face capture was successful', data)
  },
  onComplete: function (capturesHash) {
    console.log('everything is complete')
    // data returned by the onComplete callback including the document and face files captured during the flow
    console.log(capturesHash)
    // function that used to return the document and face files captured during the flow.
    console.log(Onfido.getCaptures())
  },
})

Example of new behaviour

js
Copy
Onfido.init({
  // the JWT token that you generated earlier on
  token: 'YOUR_JWT_TOKEN',
  // id of the element you want to mount the component on
  containerId: 'onfido-mount',
  onComplete: function () {
    console.log('everything is complete')
    // You can now trigger your backend to start a new check
  },
})