This integration method is deprecatedThe webview integration approach is no longer being maintained. Please use our native Mobile SDKs for better performance, security, and signal collection:
Verisoul can be integrated into mobile applications using webviews. This approach allows you to implement fraud prevention in React Native, Native iOS, and Native Android apps without requiring a full native SDK integration.
To use Verisoul in mobile apps, you’ll need to run the client SDK in a native webview. The webview can remain completely invisible to the user while still collecting the necessary signals for fraud prevention.To run the app a Verisoul Project ID is required. Schedule a call here to get started.
Listen for a message from the webview that includes the session_id. The session_id is required to authenticate an account so you’ll need to pass that to your backend in order to call the Verisoul API.
// listen for message from the webviewwkWebview.configuration.userContentController = userContentControllerwkWebview.configuration.userContentController.add(self, name: nativeToWebHandler)// parse session_id and pass to your backendpublic func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) { guard let body = message.body as? [String: String], message.name.lowercased() == nativeToWebHandler.lowercased(), let sessionId = body["session_id"] // pass to your backend // ... else { return }}
// Set up JavaScript interfacewebView.addJavascriptInterface(WebAppInterface(this), "Android")// JavaScript interface classprivate class WebAppInterface(private val context: Context) { @JavascriptInterface fun receiveSessionId(sessionId: String) { // Pass sessionId to your backend // ... }}// Enable JavaScriptwebView.settings.javaScriptEnabled = true