authowl_client library

AuthOwl headless client SDK for Flutter apps.

This entrypoint exposes the client and session layer without importing widgets. Most applications should import authowl.dart, which re-exports this API together with the managed Flutter UI.

final auth = AuthOwlClient(
  publishableKey: 'pk_live_…',
  apiUrl: 'https://api.authowl.dev',
  storage: mySecureStorage,   // flutter_secure_storage in an app
);

await auth.getSession();
auth.session.changes.listen((state) => setState(() {}));

final result = await auth.signInWithEmail(email: e, password: p);
if (!result.isSuccess) showError(result.error!.message);

Social sign-in takes an ID token from the provider's native SDK. Redirect OAuth is unsupported on purpose - it completes inside a system browser whose cookie jar this client cannot read, so the session would land somewhere the app can never see it.

The paths this calls are pinned by conformance/client-surface.json, derived from @authowl/core and drift-checked in CI.

Classes

AkedlyShieldChallenge
An Akedly Shield V1.2 challenge.
AkedlyShieldProof
Proof returned by the platform's official Akedly Shield SDK.
AuthError
A failed auth action.
AuthOwlClient
Signs users in, keeps the session, and exposes account and organization actions.
AuthOwlLegalConfig
Legal-consent policy for account creation.
AuthOwlPublicConfig
The public capabilities needed by Flutter clients.
AuthOwlSession
The active session, without its durable token - that never leaves the jar.
AuthOwlSessionState
A snapshot of who is signed in.
AuthOwlSessionStore
Holds the current session and notifies listeners when it changes.
AuthOwlStorage
Persistent storage for the session cookie.
AuthOwlTransport
Talks to one project's auth API, persisting the session cookie itself.
AuthOwlTurnstileChallenge
AuthOwl's standard Turnstile ceremony.
AuthOwlUser
The signed-in user, as the client surfaces it.
AuthResult<T>
The {data, error} envelope every auth action returns.
InMemoryAuthOwlStorage
An in-memory store, for tests and previews where persistence is unwanted.
Membership
The active-organization membership carried by a verified token.
PhoneOtpChallenge
The anti-abuse ceremony selected by the AuthOwl server for phone OTP.
PublishableKey
The decoded form of a pk_live_… / pk_test_… key.

Enums

AuthOwlEnvironment
The deployment a publishable key belongs to.
PublishableKeyErrorReason
Why a publishable key could not be decoded.

Constants

maxAkedlyShieldDifficulty → const int
Same ceiling enforced by the AuthOwl server and web SDK.
maxResponseBytes → const int
Ceiling on a response body. A hostile or misconfigured endpoint should not be able to exhaust memory on a phone.
requestTimeout → const Duration

Functions

decodePublishableKey(String key) PublishableKey
Validate a publishable key and extract its project id.
projectAuthPayload(String path, Object? payload) Object?
Strip the engine's long-lived session token out of the exact response families that carry one.
readSetCookie(List<String> setCookieValues, String name) String?
Parse one named cookie out of the response's Set-Cookie headers.

Exceptions / Errors

AuthOwlException
Error types shared across the AuthOwl Flutter SDK. Base class for every error this SDK throws.
PublishableKeyException
A publishable key could not be decoded.