myapp://socketfi/auth/success. Your app intercepts that URL, extracts any result data, and resumes the user’s session.
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 yourapp.json and add a scheme field inside the expo object:
app.json
scheme must be:
- All lowercase
- No spaces or special characters (hyphens are acceptable)
- Unique to your app — generic schemes like
appormyappcan collide with other apps on a user’s device
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.
Step 2 — Understand the deep link URL format
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
CalluseSocketFiDeepLinks() at the top of your root component so the listener is registered before any navigation occurs:
App.tsx
Testing deep links
You can test that your scheme is registered correctly using the Expo CLI oradb/xcrun without going through a full authentication flow.
- Expo CLI
- iOS Simulator
- Android Emulator
scheme to app.json.