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
- AkedlyHostedWidgetChallenge
- An Akedly V2 hosted widget challenge.
- AkedlyShieldChallenge
- An Akedly Shield V1.2 challenge.
- AkedlyShieldProof
- Proof returned by the platform's official Akedly Shield SDK.
- AuthError
- A failed auth action.
- AuthOwlCaptchaConfig
- Provider-neutral bot-challenge configuration exposed to an application.
- AuthOwlClient
- Signs users in, keeps the session, and exposes account and organization actions.
- AuthOwlConsentPreference
- AuthOwlConsentPurpose
- One active optional-consent purpose exposed by public config.
- AuthOwlLegalConfig
- Legal-consent policy for account creation.
- AuthOwlPrivacyClient
- AuthOwlPrivacyConfig
- Published notices and optional purposes used by managed privacy surfaces.
- AuthOwlPrivacyNotice
- One immutable published notice exposed to a sign-up or privacy surface.
- AuthOwlPrivacyRequest
- 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
- AuthOwlChallengeAction
- The server-side action a challenge token must be minted for.
- AuthOwlConsentState
- AuthOwlEnvironment
- The deployment a publishable key belongs to.
- AuthOwlPrivacyLocale
- AuthOwlPrivacyRequestState
- AuthOwlPrivacyRight
- PublishableKeyErrorReason
- Why a publishable key could not be decoded.
Constants
- authChallengeHeader → const String
- Header carrying a single-use bot-challenge token.
- 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
-
createAuthOwlIdempotencyKey(
) → String - Create a cryptographically random RFC 4122 version 4 identifier.
-
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-Cookieheaders.
Typedefs
-
AuthOwlChallengeTokenProvider
= Future<
String?> Function(AuthOwlChallengeAction action) - Mints a fresh, single-use bot-challenge token for a built-in auth form.
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.