# Cordova Plugin

# Latest Release

Version 1.13.1

# Installation

The plugin will ask for access to the camera and possibly the microphone and the photo library too. Because of this, it is mandatory to have the corresponding usage descriptions in the application's Info.plist file. When the system prompts the user to allow access, the corresponding usage string is displayed as a part of the dialog box. In order to add the entries you must pass the variables CAMERA_USAGE, MICROPHONE_USAGE and PHOTO_USAGE on plugin install.

cordova plugin add @sumsub/cordova-idensic-mobile-sdk-plugin \
  --variable CAMERA_USAGE="Let us take a photo" \
  --variable MICROPHONE_USAGE="Time to record a video" \
  --variable PHOTO_USAGE="Let us pick a photo"

If you do not provide the variables, the defaults shown in the example above will be used instead.

# Launching

Before launching make sure you did the Backend routines

let apiUrl = 'https://test-api.sumsub.com' // or https://api.sumsub.com
let flowName = 'msdk-basic-kyc' // or set up your own with the dashboard
let accessToken = 'your access token' // generate one on the backend

let snsMobileSDK = SNSMobileSDK.Builder(apiUrl, flowName)
        .withAccessToken(accessToken, () => {
          // this is a token expiration handler, will be called if the provided token is invalid or got expired
          // call your backend to fetch a new access token (this is just an example)
          return new Promise((resolve, reject) => {
              resolve('_act-1761a163-e5a8-4160-8e48-084145f4246f')
          })
        })
        .withDebug(true)
        .withSupportEmail('[email protected]')
        .withLocale('en') // Optional, for cases when you need to override system locale
        .build();

snsMobileSDK.launch().then(result => {
  console.log("SumSub SDK State: " + JSON.stringify(result))
}).catch(err => {
  console.log("SumSub SDK Error: " + JSON.stringify(err))
});

# Dismission

Normally the user closes the sdk himself, but if you need to do it programmatically, here is the helper:

snsMobileSDK.dismiss()
Last Updated: 10/12/2020, 12:04:38 PM