Skip to main content
SDK 2.0 authenticates with a license token. Native platforms can also use appId + appKey for online auth. Web must never embed appKey in frontend JavaScript.
Complete Subscription first: bind your app identifiers in the Dashboard (Bundle ID / package name / domain) and enable a plan.

Native (Android / iOS / macOS / Windows)

Pass one of the following when creating the engine: Priority: if licenseToken is non-empty, the SDK validates that token locally and does not call the network with appId / appKey.
Recommended (same idea as Web): keep appId / appKey on your server, mint a short-lived licenseToken, and deliver it to the app. Set platform in the signed request to match the client (ios / android / macos / windows). See Web → Server proxy below. Direct appId + appKey and offline .lic remain supported.
iOS / macOS
Android
C++ (Windows)
Online alternative on native platforms:
Prefer shipping the offline .lic as an app asset and loading it at runtime instead of hard-coding it in source. How to obtain one: Offline license below.

Web

The browser SDK has no appId / appKey fields. The engine only accepts licenseToken and verifies it locally. Fetch the token from your server before init().
  1. Create an app in the Dashboard, bind your Web domain, and copy appId / appKey (see Subscription)
  2. Keep the keys on your backend; expose an endpoint (for example POST /api/facebetter/auth)
  3. Your backend signs a request to https://facebetter.pixpark.net/facebetter/v2/auth and returns the raw response body to the page
  4. Pass that string to EngineConfig.licenseToken, then call init()
The official demo (demo/web/react) uses the same pattern: frontend in src/fetchLicenseToken.js, server proxy in api/facebetter/auth.js.
Do not put appKey in a frontend bundle. Web does not support offline .lic files. Online tokens expire in minutes — fetch a new one before creating the engine again.

Frontend

Server proxy (Node example)

Store FB_APP_ID / FB_APP_KEY in environment variables. Drop this into Express / Fastify / a serverless function:
In other languages, implement the same steps: build the sign string → HMAC-SHA256 (hex) → POST upstream → hand the body to the frontend. Runnable reference: GitHub Demo api/facebetter/auth.js.

Upstream request fields

On success the upstream returns JSON (including a token field). You may forward the response text as-is, or extract only the token string — the SDK accepts either.

Offline license (native)

The Dashboard no longer offers self-serve offline .lic downloads. To get an offline license, contact sales or an administrator: After you receive the file, pass the entire contents as licenseToken / license_token. Validity matches your current subscription; after renewing or changing the plan, request a new file and replace it in the app.

Notes

  • The offline license is bound to the app identifiers configured in the Dashboard; a mismatch fails validation.
  • Not expired: features follow your subscription plan.
  • Expired: the engine can still initialize, but capabilities fall back to the Free plan (watermarked trial, no keypoint callbacks). Renew and request a new license.
  • Web cannot use offline licenses; it must complete an online v2 auth path.

Engine events

Listen for license and init results via onEngineEvent: