Skip to content

Configuration

RakomiProvider is the SDK’s single root widget. It mounts the auth controller, the native adapter, and the deep-link handler for the widget subtree beneath child.

RakomiProvider(
publishableKey: 'pk_live_…',
redirectUri: 'myapp://callback',
child: MyApp(),
)
ParameterTypeRequiredDefaultNotes
publishableKeyStringYesIdentifies your tenant. Also used to derive tenantId when tenantId is not supplied.
redirectUriStringYesCallback URI for social/OAuth sign-in. See Installation for platform scheme rules.
childWidgetYesThe widget subtree that can reach RakomiProvider.of(context).
apiBaseUrlString?Nohttps://api.rakomi.comThe API host. Must be https://, or the dev-loopback exception below.
issuerString?Nohttps://api.rakomi.comExpected JWT iss. This is the platform brand identifier, not necessarily your apiBaseUrl — a custom-domain tenant still receives tokens issued by the platform issuer.
audienceString?Nohttps://api.rakomi.comExpected JWT aud.
tenantIdString?NopublishableKeyExplicit tenant id, when it differs from the publishable key.
adapterRakomiNativeAdapter?NoDefaultRakomiNativeAdapter()Swap the native adapter — for testing, or an alternative storage/browser/biometric implementation.
jwksUrlUri?No$apiBaseUrl/.well-known/jwks.jsonOverride the JWKS endpoint. Subject to the same https://-or-loopback validation as apiBaseUrl.
refreshLeadtimeDurationNokDefaultRefreshLeadtime (60s)How far ahead of exp the SDK proactively refreshes.
freshAuthWindowDurationNo30sAccepted by the constructor and stored, but not currently wired to any runtime behavior — there is no fresh-auth-window enforcement today, in either direction.
certificateFingerprintsList<String>?NonullOptional certificate pinning for https:// requests to non-loopback hosts, on iOS and Android. Ignored on Web (browser TLS). Supply more than one fingerprint (e.g. a backup pin) so a routine certificate rotation does not require an SDK update.

The constructor validates two URLs synchronously and throws ArgumentError if either fails:

  • apiBaseUrl must start with https://, or match a dev-loopback exception: http://localhost, http://127.x.x.x, or http://10.x.x.x (with an optional port/path). The match is anchored to the host, so http://localhost.evil.com does not qualify.
  • jwksUrl, when supplied, is validated against the same rule — the signing-key set is the root of signature trust, so an unvalidated http:// JWKS endpoint would fetch keys in plaintext and outside certificate pinning.
RakomiAuth auth = RakomiProvider.of(context); // throws if no enclosing provider
RakomiAuth? auth = RakomiProvider.maybeOf(context); // null if no enclosing provider

RakomiProvider is not a process-global singleton — of/maybeOf resolve to the nearest enclosing RakomiProvider. Multiple providers can coexist in the same widget tree (for example, a multi-tenant test harness), each with its own independent RakomiAuth instance and its own tenant-namespaced storage.

Supply your own adapter to swap storage, the system-browser launcher, the biometric gate, or connectivity detection — for example, in tests, or to plug in an alternative platform plugin. RakomiNativeAdapter is @sealed for the 0.x line: its contract is additive-only, and a breaking change to it ships as a minor version bump (0.1.x0.2.0) with a migration note, not silently.

See Session & tokens for what the default adapter persists and where, and Security for the full threat model.