pasby 0.1.0
pasby: ^0.1.0 copied to clipboard
Flutter SDK for integrating Pasby authentication flows in mobile apps.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:pasby/pasby.dart';
void main() {
runApp(const PasbyExampleApp());
}
class PasbyExampleApp extends StatelessWidget {
const PasbyExampleApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('Pasby Example')),
body: const _Home(),
),
);
}
}
class _Home extends StatelessWidget {
const _Home();
@override
Widget build(BuildContext context) {
final server = PasbyAuthWithServerFunctions(
baseUrl: 'https://api.example.com',
paths: Paths(
'/pasby/auth',
'/pasby/cancel',
'/pasby/ping',
'/pasby/wildcard',
),
);
return Padding(
padding: const EdgeInsets.all(16),
child: AuthenticateDifferentDevice(
server: server,
payload: 'signed-jwt-or-session-payload',
onSuccessful: (result) async {
debugPrint('Pasby auth success for user: ${result.user}');
},
onFailed: (error) {
debugPrint('Pasby auth failed: $error');
},
),
);
}
}