Skip to main content
Deep linking is the mechanism that brings users back to your app after they complete authentication or approve a transaction in the SocketFi hosted browser. When the user finishes the flow, SocketFi redirects their browser to a URL like myapp://socketfi/auth/success. Your app intercepts that URL, extracts any result data, and resumes the user’s session.
Without deep linking configured, users will complete passkey authentication successfully in the browser but have no way to return to your app. They will be stuck in the browser with a blank or completed screen. Deep linking is not optional — it is required for the React Native SDK to function.

Why deep linking is required

Mobile browsers do not support the popup window pattern used by the React SDK. Instead, the React Native SDK opens a full in-app browser session (expo-web-browser), hands control to SocketFi’s hosted flow, and relies on a custom URL scheme to pass control back when done. This is the standard OAuth-style redirect pattern for mobile apps.

Step 1 — Register your app scheme

Open your app.json and add a scheme field inside the expo object:
app.json
The value you choose for scheme must be:
  • All lowercase
  • No spaces or special characters (hyphens are acceptable)
  • Unique to your app — generic schemes like app or myapp can collide with other apps on a user’s device
After setting the scheme, rebuild your native app (npx expo run:ios or npx expo run:android) so the scheme is registered with the OS. Changes to app.json are not picked up by Expo Go hot-reload. SocketFi uses the following URL patterns to communicate the result of a hosted flow back to your app: Replace myapp with the scheme value you registered in app.json.

Step 3 — Set up the expo-linking event listener

Register a URL listener early in your app’s lifecycle — typically in your root component or navigation container — so SocketFi deep links are caught as soon as they arrive.
App.tsx
The SocketFi SDK resolves the authenticate() Promise automatically when the deep link arrives — you don’t need to manually extract session data from the URL. The listener is useful for side effects like analytics, navigation, or showing toasts.

Step 4 — Wire the hook into your root component

Call useSocketFiDeepLinks() at the top of your root component so the listener is registered before any navigation occurs:
App.tsx
You can test that your scheme is registered correctly using the Expo CLI or adb/xcrun without going through a full authentication flow.
If your listener logs the path, deep linking is configured correctly. If nothing happens, double-check that you rebuilt the native app after adding the scheme to app.json.
During development with Expo Go, deep linking uses the exp:// scheme rather than your custom scheme. Use a development build (npx expo run:ios or npx expo run:android) to test your custom scheme end-to-end.

Common issues