Mobile

Mobile SDKs

Android, iOS, React Native and Flutter wrappers around the hosted flow — one contract, the same behaviour everywhere.

View as Markdown

The mobile SDKs open the hosted verification flow in a hardened, full-screen WebView and hand your app a typed result. They all implement the same contract: the same results, events, failure codes and options, tested against one shared definition. The tables on these pages are generated from it.

The integration on every platform

  1. Your backend creates the session with its secret key (POST /v1/sessions) and sends the app only the returned url. Never put an sk_… key in an app.
  2. The app starts the SDK with that URL. The SDK loads the flow, asks for the camera when a step needs it, and reports progress events.
  3. The SDK returns one result: completed, cancelled or failed.
  4. Your backend waits for the webhook (or calls GET /v1/sessions/:id) for the decision. completed only means the applicant finished; the status it carries is a hint.

Results

ResultFieldsWhen
completedsession_id, statuscomplete event received
cancelledsession_id?user closed the flow (✕, back → confirm, swipe down) or exit event
failedcode, message, session_id?the flow could not run or continue

Events

EventWhenPayloadMobile SDKs
readyThe flow loaded and the session is ready.status: session statusdelivered
step_startedA step was shown for the first time.step: step keydelivered
step_completedA step was completed.step: step keydelivered
completeThe applicant finished; the SDK returns completed and closes after the auto-close delay.status: approved | declined | review | processing | expired | cancelleddelivered
errorA recoverable error happened inside the flow (the flow keeps running).step: step key (optional)
code: error code
delivered
exitThe flow asked to close; the SDK returns cancelled.—delivered
resizeWeb embeds only; mobile SDKs ignore it.height: pxignored

Options

Contract nameAndroidiOSReact NativeFlutterTypeDefaultDescription
session_urlsessionUrlsessionURLsessionUrlsessionUrlstringrequiredThe url returned by POST /v1/sessions. Never embed a secret API key in an app.
localelocalelocalelocalelocalestringnullFlow language (en, hi); must be one of the workflow's languages. Sent as ?locale=.
themethemethemethemethemelight | dark | system"system"Colour scheme of the flow. Sent as ?theme=.
allowed_hostsallowedHostsallowedHostsallowedHostsallowedHostsstring[][]Extra hosts the WebView may load (self-hosting).
block_screenshotsblockScreenshotsblockScreenshotsblockScreenshotsblockScreenshotsbooleantrueAndroid: FLAG_SECURE. iOS: cover the flow in the app switcher and while the screen is recorded.
auto_close_delayautoCloseDelayautoCloseDelayautoCloseDelayautoCloseDelayduration_ms2000 msHow long the result screen stays visible after complete before the SDK closes and returns completed. 0 or null = return the result immediately (no result screen).

Platform-only options: Android: title; iOS: presentation; React Native: none; Flutter: confirmExit, title.

Failure codes

CodeMeaningAndroidiOSReact NativeFlutter
invalid_configMissing or malformed session URL or configuration.✓✓✓✓
load_failedThe flow page failed to load (HTTP error or blank page).✓✓✓✓
network_errorNo connection or DNS/TLS failure while loading.✓✓✓✓
navigation_blockedRepeated navigation to non-allowlisted hosts.✓✓✓✓
permission_deniedThe camera permission was permanently denied and the flow cannot continue.✓✓✓✓
flow_errorThe flow reported an unrecoverable error.✓✓✓✓
webview_unavailableThe WebView renderer crashed or is unavailable.✓✓✓—
presentation_failedNo view controller was available to present the flow.—✓——
  • Loads inside the WebView: <flow origin>, <allowed_hosts>, and DigiLocker (digilocker.meripehchaan.gov.in, *.digilocker.gov.in, api.digitallocker.gov.in) so its sign-in returns to the flow.
  • Other http(s) links: open in the system browser.
  • Other schemes (file:, intent:, javascript: …): blocked.
  • locale is sent as ?locale=, theme is sent as ?theme=, before the fragment.
  • Session token: URL fragment #t= — never sent to servers, never logged.

Security defaults

  • JavaScript and DOM storage on; no file:// access; no mixed content; no third-party cookies
  • WebView debugging only in debug builds
  • Camera/microphone granted to the WebView only for the flow origin, after OS permission
  • Clear cookies, cache and storage for the flow origin when the flow ends
  • Never log the session URL

Bridge protocol

You don't need this to integrate; it's how the flow talks to the SDK.

Protocol version 1. The flow sends JSON strings with the fields source, v, type, sessionId, payload, where source is okyc and v is 1. Messages larger than 10,240 bytes are dropped. Payload rule: ids and statuses only — never personal data.

PlatformBridgeNameMethod
Androidjavascript_interfaceOkycAndroidpostMessage
iOSscript_message_handlerokyc—
React Nativereact_native_webviewReactNativeWebView—
Flutterjavascript_channelOkycFlutter—

On this page