kashi_auth 1.6.0 copy "kashi_auth: ^1.6.0" to clipboard
kashi_auth: ^1.6.0 copied to clipboard

Flutter sign-in for kashi APIs, with default passkeys (contact-free sign-up), codes, password, Google/Apple/Facebook, a sign-in screen, passkey settings and biometric lock.

example/example.md

kashi_auth example #

KSignIn shows every provider the server enables and the app supplies an adapter for. Pass adapters only for the providers you've configured; omit google/apple/passkeys to hide them.

import 'package:flutter/cupertino.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:kashi_auth/kashi_auth.dart';
import 'package:kashi_core/kashi_core.dart';

void main() {
  runApp(
    ProviderScope(
      overrides: [
        kashiConfigProvider.overrideWithValue(
          const KashiConfig(baseUrl: 'https://api.example.com/v1'),
        ),
      ],
      child: const MyApp(),
    ),
  );
}

class MyApp extends ConsumerWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    final auth = ref.watch(authControllerProvider);
    return CupertinoApp(
      home: switch (auth.status) {
        AuthStatus.signedIn => const HomeScreen(),
        _ => const CupertinoPageScaffold(
            child: KSignIn(title: 'Sign in to Acme'),
          ),
      },
    );
  }
}

Guard a screen behind biometrics with KBiometricGate (bring your own local_auth call), and let users manage their passkeys with KPasskeySettings:

KBiometricGate(
  reason: 'Unlock Acme',
  authenticate: (reason) => LocalAuthentication().authenticate(
    localizedReason: reason,
  ),
  child: const AccountScreen(),
);
0
likes
160
points
226
downloads

Documentation

API reference

Publisher

verified publishersoftwareseva.org

Weekly Downloads

Flutter sign-in for kashi APIs, with default passkeys (contact-free sign-up), codes, password, Google/Apple/Facebook, a sign-in screen, passkey settings and biometric lock.

Repository (GitHub)
View/report issues
Contributing

License

MIT (license)

Dependencies

flutter, flutter_riverpod, kashi_core, kashi_ui

More

Packages that depend on kashi_auth