Firebase Auth for Flutter Desktop
The platform implementation of FlutterFire for Linux and Windows.
NOTE: This package overrides the existing implementation of macOS in FlutterFire for development purposes.
Getting Started
First, please make sure you initialize Firebase for Dart by following the guide to install firebase_core
.
-
On the root of your project, run the following command:
dart pub add firebase_auth_desktop
-
Import it:
import 'package:firebase_auth_desktop/firebase_auth_desktop.dart';
Usage
This package is a platform implementation of firebase_auth
, check the full Usage documentation on the official guide.
Phone Authentication on Desktop
On Desktop, phone authentication is similar to Web.
- Call
signInWithPhoneNumber
method, this will trigger a reCAPTCHA webview in a seprate window for verification, once completed the user will receive SMS Code.FirebaseAuth auth = FirebaseAuth.instance; // Wait for the user to complete the reCAPTCHA & for an SMS code to be sent. ConfirmationResult confirmationResult = await auth.signInWithPhoneNumber('+44 7123 123 456');
- Prompt the user to provide the SMS Code, then confirm it.
However, there's currently one limitation, the SMS message that the user receives contain your App Name, on web that's usually your auth domain, but since Firebase doesn't fully support Phone auth on desktop platforms yet, the current implementation will show your app name in the message as 127.0.0.1 which stands for the localhost IP address.UserCredential userCredential = await confirmationResult.confirm('123456');
Issue and Feedback
Please file any issues, bugs, or feature requests in our issue tracker.
To contribute a change to this plugin, please review our contribution guide and open a pull request.