Current flow only allows to use SDK as a script. See an example at the bottom of the page.
SDK flow explained in a sandbox environment:
Generate idvID from swagger https://app-idvapi-snd-ond.azurewebsites.net/swagger/index.html POST/v1/identity-verifications
Provide correct and existing setupId.
Each unique session requires a new generation
Add script to an application <script src="build/index.1.0.0.min.js"></script>
Customize the script with following required properties:
IdvSdk.load({ mode: 'Sandbox', onSuccess: (props) => console.log('onSuccess', props), onFailure: (props) => console.log('onFailure', props), });
Begin and load should be used in try catch block.
Load
Purpose: Configures api.
Returns Begin and End methods if success
Possible exception:
NotSupportedMode
: invalid mode has been passed.
mode interface:
declare enum SdkMode { Production = "Production", Sandbox = "Sandbox" }
Events
onSuccess and onError: callback with returned props:
On every callback idv sdk application is closed.
Exceptions explained:
declare enum SdkProcessFailure { ConsentDeclined = "ConsentDeclined", // if user declines consent, sdk application is closed and error is returned CurrentSessionIdvIdAndPassedIdvIdMismatch = "CurrentSessionIdvIdAndPassedIdvIdMismatch", // idvId was provided and retry: true flag is set but different idvId was provided in the session error is returned. Only valid for F5(refresh page) cases. FailureExit = "FailureExit", // When idv process gives a dead end reason and idv identification process failed, user is prompted with exit from sdk application button. Button is clicked - sdk application is closed and FailureExit is returned. Generic = "Generic", // An error during sdk application flow happened and we cannot provide the exact reason why the process failed. Sdk closes and returns Generic error. (Something similar like internal server error) NoIdvContainer = "NoIdvContainer", // If user closes sdk application in an unknown way and there is still an sdk application instance running. NoIdvId = "NoIdvId", // no accessToken and no idvId case. Unauthorized = "Unauthorized" // in case of invalid idvId, in case of expired idvId, in case of any other way invalidated idvId, in case of completed idvId, in case of idvId that does not belong to accessToken etc. }
After setting up properties for
IdvSdk.load({mode,onSuccess, onFailure})
a correct idvId needs to be copy and pasted.Begin
Purpose: Creates idv session.
Props
idvSdk?.begin({ idvId: '16b47825-ed83-4b2e-bc24-4ef4a8c647f1', // unique idvId retry: true, // flag if idvId is saved in the session storage for example so that browser page could be refresh multiple times without needing to generate new idvId. language?: 'bg-BG' // possible languages are listed below or can be found in the interface }); declare enum IdvLanguage { BgBg = 'bg-BG', CaEs = 'ca-ES', CsCz = 'cs-CZ', DeDe = 'de-DE', EnGb = 'en-GB', EsEs = 'es-ES', EtEe = 'et-EE', FrFr = 'fr-FR', LtLt = 'lt-LT', LvLv = 'lv-LV', NlNl = 'nl-NL', PlPl = 'pl-PL', PtBr = 'pt-BR', RoRo = 'ro-RO', RuRu = 'ru-RU', SqAl = 'sq-AL', UkUa = 'uk-UA', ViVn = 'vi-VN', }
Recommended to save idvID in your applications session storage. F5(page refresh case), same id would be used and same session would be loaded. In this case retry: true must be set. Otherwise when refreshing the page idvId would be invalidated.
Exceptions explained:
declare enum SdkBeginFailure { CantBeUsedInIframe = "CantBeUsedInIframe", // Consumer cannot use this sdk in iframe. We restrict usage due to requiring full screen InvalidIdvId = "InvalidIdvId", // invalid idvId was provided NotSupportedMode = "NotSupportedMode",// check if provided mode is invalid according to SdkMode ProcessStarted = "ProcessStarted", // if multiple idv begin were started error. You cannot start multiple identifications in the same page simultaniously. StartFailed = "StartFailed" // if sdk applications has crashed for some reason when trying to initially load the sdk application. Due to nework error etc. }
End:
Closes SDK application without error. Cleans ups all sdk tasks and application.
Props: does not accept any properties.
IdvSdk.version()
returns current sdk version
Example how html file looks with an included sdk script:
Interface:
Video showcase of how to use SDK:
0 Comments