SDK reference · React Native SDK / React Native Getting Started

Token-Based Setup

By default, the React Native SDK initializes with an API key. If your backend creates onboarding sessions and provides session tokens to your app, you can initialize the SDK without an API key and use the Sections API to run the flow.

This setup is useful when your backend manages session creation, you want to avoid embedding an API key in your app, or you need session tokens that are scoped to individual users.

Initialize without an API key

Omit the key field from apiConfig:

try {
  await IncodeSdk.initialize({
    testMode: false,
    apiConfig: {
      url: 'YOUR_API_URL',
    },
  });
} catch (error) {
  const e = error as IncodeSdkInitError;
  console.error(`${e.code} - ${e.message}`);
}

Set up the session with a token

Pass the backend-created token to setupOnboardingSession:

const session = await IncodeSdk.setupOnboardingSession({
  sessionConfig: {
    token: 'YOUR_TOKEN',
  },
});

Run the flow with sections

After the session is set up, use the Sections API to run the flow. Call startOnboardingSection() for each section, then finishOnboardingFlow() when all sections are complete:

await IncodeSdk.startOnboardingSection({
  flowConfig: [
    { module: 'IdScan', showTutorial: false },
    { module: 'SelfieScan', showTutorial: false },
  ],
});

await IncodeSdk.faceMatch();

await IncodeSdk.finishOnboardingFlow();

❗{/* [SME input needed: source-level review confirmed that startOnboarding, startFlow, and startWorkflow all accept the same sessionConfig shape that carries token, so passing a token directly to one of those methods is allowed by the types. Confirm whether this combination is actually tested and supported end-to-end, or whether token-based setup should only be used with the Sections API path shown above. Escalation candidate: needs product/SDK-team knowledge, not source review.] */}

For the full Sections API walkthrough, see Configure Flows Locally and Run Step by Step.

Was this page helpful?