Prerequisites
Make sure your environment meets these requirements before installing. Frontend applications
Backend applications
Supported backend frameworks include Express, Fastify, and NestJS. ESM modules are recommended for TypeScript projects.
Get a Client ID
Every SocketFi SDK call is authenticated against your application using a Client ID. You must create an application in the Developer Portal before initialising the SDK.1
Create an account
Sign up at portal.socketfi.com and confirm your email address.
2
Create an application
Click New Application, give it a name, and select your target network (TESTNET for development, MAINNET for production).
3
Copy your Client ID
Your Client ID looks like
sf_live_xxxxxxxxxxxxxxxxx. Store it in an environment variable — never hardcode it in source.4
Add allowed origins
Under Allowed Origins, add every domain your application runs on. Requests from any other origin will be rejected.
Install the SDKs
Install only the packages your project needs. Most applications use the React or React Native SDK on the frontend and the Server SDK on the backend.React
React Native
Expo additional dependencies
If you’re using Expo, install these two packages as well. They provide the browser and deep-linking primitives that SocketFi uses for authentication and transaction approval flows.Server SDK
Configure environment variables
Store your Client ID in an environment variable. The correct variable name depends on your build tool. Vite / Remix / most bundlersNever store secrets (API keys, signing keys, or server-side tokens) in a
VITE_, NEXT_PUBLIC_, or EXPO_PUBLIC_ variable. These values are bundled into your client code and are visible to anyone who inspects your JavaScript. Your Client ID is the only SocketFi value that belongs in a frontend environment variable.Initialise the SDK
Create a single SocketFi instance and export it so every component in your application shares the same client.React
React Native
Server SDK
The Server SDK does not require initialisation. ImportverifyAuth wherever you need to validate a SocketFi access token.
Verify your installation
The quickest way to confirm everything is wired up correctly is to render a sign-in button and click it. A successful installation opens the SocketFi authentication popup.- The SocketFi hosted authentication popup opens.
- The user completes registration or login with their passkey.
- SocketFi resolves their wallet.
- A session object is returned to your callback.
Troubleshooting
Invalid Client ID
- Double-check the value of your environment variable matches what the Developer Portal shows.
- Confirm the application still exists and hasn’t been deleted or suspended.
- Confirm the
networkvalue in your SDK config (TESTNETorMAINNET) matches the network your application was created on.
Origin Not Allowed
- Open the Developer Portal, navigate to your application, and check the Allowed Origins list.
- Add the exact origin your app is running on (including protocol and port for local development, e.g.
http://localhost:5173). - Save and retry — changes take effect immediately.
Popup Blocked
Browsers block popups that are not triggered by a direct user interaction. Never callauthenticate() automatically on page load or inside a useEffect. Always invoke it from a click handler.