Comment on page
Onboarding links into WebView and iFrame
This section will support the integration of Onboarding links into WebView and iFrame.
In order for web Onboarding integrations that use WebView for Android to function properly, it is necessary that
setDomStorageEnabled
is set as true
. Example below:myWebView.getSettings().setDomStorageEnabled(true);
In order for web Onboarding integrations that use WKWebView for iOS to function properly, it is necessary to customize the configuration to allow media playback without request user's action and to reproduce the media inline. Example below:
let webView: WKWebView
init() {
let audioVisualMediaType: WKAudiovisualMediaTypes = []
let configuration = WKWebViewConfiguration()
configuration.mediaTypesRequiringUserActionForPlayback = audioVisualMediaType
configuration.allowsInlineMediaPlayback = true
webView = WKWebView(frame: .zero, configuration: configuration)
}
Other platforms
On other platforms, e.g. Flutter and React Native, you should look for WebView's configurations to allow media playback without require user gesture and to reproduce camera video inline, not in the native full-screen controller.
To integrate Onboarding into an iFrame, use the example code below. Note that you only need to give access permission to the device's camera in the
allow
attribute and also use geolocation to capture the location for the trust platform dashboard.<iframe src="https://cadastro.io/:token" allow="camera;geolocation"></iframe>
Onboarding service may not work within an iFrame, if the user enters the website while Block third-party cookies is enabled on their browser. This typically occurs when user enters through an anonymous browser session.
For Onboarding to communicate with the iFrame or WebView, it emits events using
window.postMessage()
. Currently, we have event support for iFrame, Flutter* and React Native.Listening to message event:
window.addEventListener('message', function (e) {
...
console.log(e.data);
...
}, false)
Return Example:
{
code: "ONBOARDING_FINISHED",
response: {
executionId: "xxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}
If using Web Message Listeners with Flutter, then InAppWebView should be used, with
jsObjectName
set as FutterOnboardingChannel
The events that can be issued by Onboarding are as follows:
SDK_CAPTURE_INVALID
: Will be triggered when capture is invalid, such as an incorrect document or poor image quality. (Document Detector and Passive Face Liveness)SDK_CAPTURE_FAILED
: Some other failure in the capture. (Document Detector and Passive Face Liveness)SDK_BACK_CAPTURE_STARTED
: Started capturing the backside of the document (Document Detector)SDK_FRONT_CAPTURE_STARTED
: Started capturing the front of the document (Document Detector)ONBOARDING_FINISHED
: Onboarding finished
Last modified 24d ago