kirak_flutter 0.1.0
kirak_flutter: ^0.1.0 copied to clipboard
kirak's Flutter integration - a working, zero-config session default for Flutter apps.
kirak_flutter #
kirak's Flutter integration: a zero-config default for a real Flutter app on top of
the kirak core.
Install #
dependencies:
kirak_flutter: ^0.1.0
Or, working from inside this repo:
dependencies:
kirak_flutter:
path: ../kirak_flutter
kirak:
path: ../kirak
Quickstart #
import 'package:kirak_flutter/kirak_flutter.dart';
final kirak = await createKirakFlutterClient('https://your-app.kirak.dev');
await kirak.api('auth.login', params: {'email': 'a@example.com', 'password': 'secret'});
An unconfigured app stays logged in across restarts with no configuration -
createKirakFlutterClient defaults to a SharedPreferences-backed session store. Pass
your own store (for example one backed by flutter_secure_storage) via
KirakClientOptions(auth: KirakAuthOptions(storage: ...)) as the options: argument if
your app's threat model calls for it; it is never overridden.
Apple Sign In on web / FlutterFlow web #
Apple's web OAuth flow redirects to a short-lived token in your app's deep link
(myapp://auth/callback?token=...). Receiving that link is your app's own choice of
deep-link package; once you have the redirect Uri, hand it to:
final result = await adoptFromDeepLink(kirak, redirectUri);
Register an Android App Link / iOS Universal Link for this redirect rather than a bare custom URL scheme - a custom scheme can be intercepted by another app on the device.
Native Google / Apple sign-in #
No dedicated helper needed - after your native SDK signs the user in, call the normal
API with the provider's user id and email (optionally first_name, last_name,
display_name, photo_url). The session tokens the server returns are adopted
automatically:
await kirak.api('auth.google-oauth2.mobile', params: {'provider_user_id': providerUserId, 'email': email});
License #
MIT - see LICENSE.