Last updated:
0 purchases
magic sdk
Magic empowers developers to protect their users via an innovative, passwordless authentication flow without the UX compromises that burden traditional OAuth implementations.
⚠️ Removal of loginWithMagicLink() ⚠️ #
As of v4.0.0, passcodes (ie. loginWithSMS(), loginWithEmailOTP()) are replacing Magic Links (ie. loginWithMagicLink()) for all of our Mobile SDKs. Learn more
Features #
This is your entry-point to secure, passwordless authentication for your iOS or Android-based Flutter app.
Installation #
Add magic_sdk to your pubspec.yaml:
dependencies:
flutter:
sdk: flutter
magic_sdk: ^4.0.0
copied to clipboard
Run the following command to install dependencies
$ dart pub get
copied to clipboard
Create an SDK Instance #
In main.dart, instantiate Magic with your publishable key
void main() {
runApp(const MyApp());
Magic.instance = Magic("YOUR_PUBLISHABLE_KEY");
}
copied to clipboard
Use Stack in the top level and add Magic.instance.relayer to the children of Stack to ensure the best performance
Note: Relayer is required to establish communication between apps and Magic service. Make sure to have it in a stack whenever you need to authenticate or interact with blockchain
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Magic Demo',
home: Stack(children: [
const LoginPage(),
Magic.instance.relayer
]));
}
}
}
copied to clipboard
Authenticate your first user!
var token = await magic.auth.loginWithEmailOTP(email: textController.text);
copied to clipboard
Additional information #
For more detail, please check the Magic Link Flutter doc
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.