Skip to main content
Setting up the SocketFi React Native SDK involves installing three packages, registering a URL scheme in your Expo config, and creating a shared client instance. The process takes about ten minutes on a fresh Expo project.

Install the SDK

Install Expo dependencies

The SDK uses expo-web-browser to open hosted authentication and approval screens, and expo-linking to handle the deep link that brings users back to your app after they complete the flow. Install both with the Expo CLI so they are pinned to a version compatible with your Expo SDK:
Always use npx expo install rather than plain npm install for Expo packages. This ensures the installed version is compatible with your current Expo SDK version and avoids hard-to-debug runtime errors.

Configure your app scheme

SocketFi needs a custom URL scheme to redirect users back to your app after authentication. Add the scheme field to app.json:
app.json
Choose a scheme that is unique to your app (e.g. acmepay, myfinanceapp). After the user authenticates, SocketFi will redirect them to:
The scheme field is required. Without it, users will complete authentication in the browser and have no way to return to your app. See the Deep Linking guide for full configuration details.

Set up environment variables

Store your Client ID in an environment variable using Expo’s config system. Add it to a .env file at the root of your project:
.env
Access it in your code with:
Do not commit your .env file to source control. Add it to your .gitignore. Your Client ID ties requests to your registered SocketFi application.

Initialize the SocketFi client

Create a shared instance in a dedicated file and import it wherever you need it. Avoid constructing multiple instances across different components.
lib/socketfi.ts

Full configuration example

lib/socketfi.ts
The React Native SDK accepts exactly the same constructor options as the React SDK. Refer to the React installation guide for the full ParamField reference.

Minimal working example

Once the client is initialized, you can trigger authentication from a button:
App.tsx
HTTPS is not required during React Native development — Expo’s dev server and the Metro bundler run over HTTP locally and this is fine. However, all SocketFi API calls made from production builds must go over HTTPS. Configure your production environment accordingly before submitting to app stores.

Next steps

With the SDK installed and initialized, configure deep linking so SocketFi can return users to your app after authentication:

Configure Deep Linking

Set up expo-linking event listeners and handle the SocketFi redirect URLs.