---
title: "Token-Based Setup"
url: "https://developer.incode.com/sdk-reference/react-native-token-based-setup/"
section: "sdk-reference"
group: "React Native SDK / React Native Getting Started"
version: "v1.1"
status: "live"
---
# 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`:

```ts
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`:

```ts
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:

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

await IncodeSdk.faceMatch();

await IncodeSdk.finishOnboardingFlow();
```


For the full Sections API walkthrough, see [Configure Flows Locally and Run Step by Step](/sdk-reference/react-native-configure-flows-locally-and-run-step-by-step/).