Skip to main content

Overview

The OneSDK must be initialized before any modules can be used. The initialization process configures the SDK with your session token, sets the environment mode, and prepares all modules for use.

Import

Method

OneSdk(parameters)

Initializes the OneSDK and returns a Promise that resolves to the SDK context object. OneSdk is the default export of the package and is itself the initialization function. Signature:
Parameters:
When telemetry is enabled, the SDK automatically redacts sensitive values (e.g. tokens, API keys, secrets, clientID) from component options and recipe data before including them in telemetry events.

SessionOptions

Session configuration object. Required when mode is not "dummy".

Recipe Configuration

The recipe parameter controls how the SDK performs verification. You can pass either a string (recipe name) or an object (recipe configuration).

String Recipe Name

Pass a predefined recipe name to use standard verification workflows:
Common Recipe Names:
  • "auto" - Automatically selects appropriate recipe (default)
  • "default" - Standard verification flow
  • "standard_kyc" - Standard KYC verification
  • "full" - Full verification with all checks
  • "safe_harbour" - Safe harbour compliance checks
  • "safe_harbour_plus" - Enhanced safe harbour checks
  • "international" - International verification flow
  • "gov_id" - Government ID verification
  • "aml_only" - AML checks only
  • Custom recipe names configured by FrankieOne

Recipe Configuration Object

Pass a partial configuration object to customize the verification flow:
Recipe Object Structure: Examples:
Recipe configuration is typically managed by FrankieOne. The SDK will fetch and merge the recipe configuration from the server with any recipe options you pass during initialization.

SDK Modes

The SDK supports three operational modes: Type Definition:

Return Value

Returns a Promise<OneSdkContext> that resolves to the SDK context object.

OneSdkContext

The SDK context provides access to all modules and SDK functionality:

Usage Examples

Basic Initialization (Production)

Development Mode with DevTools

Dummy Mode (No Backend Required)

With Recipe (String Name)

With Recipe (Object Configuration)

With Token Persistence

Generating Session Tokens

Session tokens must be generated on your backend server by calling the FrankieOne API. Never expose your API credentials in client-side code.
For the complete implementation with React hooks and error handling, see the Embedded OneSDK Quick Start.

Error Handling

OneSdk() returns a Promise that will reject if initialization fails. Always wrap it in a try-catch block:

Events

The SDK emits several events during and after initialization:

resolved_root_config

Emitted when the root configuration is resolved.

telemetry

Emitted for internal diagnostic data. Used by FrankieOne for troubleshooting and support.
Telemetry events are primarily for internal use by FrankieOne support. Event structure is not fully typed and may change.

error

Emitted when an error occurs.

warning

Emitted for configuration warnings.

Network Events

The SDK monitors network connectivity:

Session Management

After initialization, you can access session information through the session property:

JavaScript/TypeScript Usage

OneSDK provides type definitions for TypeScript projects, but full TypeScript support is not available for all APIs:

Best Practices

  1. Always handle errors: Wrap initialization in try-catch blocks to handle failures gracefully.
  2. Use environment variables: Store tokens in environment variables, never hardcode them.
  3. Enable devtools in development: Use devtools: true during development for better debugging.
  4. Set appReference: Always provide an appReference to help track issues in logs.
  5. Listen to network events: Monitor network connectivity to improve user experience.
  6. Use token persistence wisely: Only enable persist: true when appropriate for your use case.

Common Issues

Token expired or invalid

If the session token is expired or invalid, initialization will fail. Generate a fresh token from your backend and reinitialize the SDK. See the Generating Session Tokens example above.

CSP (Content Security Policy) errors

If you see CSP errors in the browser console, ensure your CSP headers allow the OneSDK resources:
If you are using a third-party vendor (Onfido, Incode, Sumsub, etc.), additional vendor-specific domains are required. See Vendor CSP Settings for the full list.