Mobile Integration
If you want to integrate the verification process directly into your mobile application, you should first create a session and then open the generated URL within your app. This guide will walk you through the process for React Native, iOS, and Android.
Creating a Session
To create a session, follow the instructions in the Creating a Verification Session documentation. This will provide you with a session URL that you can open in your mobile app.
Opening the Session URL
Once you have created a session and obtained the URL, you can open it in your mobile app using a WebView. Here's how to do it for React Native, iOS, and Android:
import React from 'react';
import { WebView } from 'react-native-webview';
const VerificationScreen = () => {
return (
<WebView
source={{ uri: '{session_url}' }}
// Make sure to set the user agent to a generic mobile one
userAgent="Mozilla/5.0 (Linux; Android 10; Mobile) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Mobile Safari/537.36"
// Mandatory props
mediaPlaybackRequiresUserAction={false}
allowsInlineMediaPlayback={true}
// Android-specific props
domStorageEnabled={true}
// Optional props for performance
androidHardwareAccelerationDisabled={false}
androidLayerType="hardware"
/>
);
};
export default VerificationScreen;
These settings will ensure that:
- Inline media playback is enabled
- Media playback doesn't require user action
- DOM storage is enabled for Android
- Hardware acceleration is optimized for Android
Handling the Callback
After the verification process is complete, the system will redirect to the callback URL you specified when creating the session. You should implement a way to handle this callback in your mobile app.
One common approach is to use a custom URL scheme for your app and set it as the callback URL. This allows your app to intercept the callback and handle it appropriately.
For more information on creating a session and specifying a callback URL, refer to the Creating a Verification Session documentation.
By following these steps, you can integrate the Didit verification process directly into your React Native, iOS, or Android application, providing a seamless experience for your users.