fire_autho 0.0.31
fire_autho: ^0.0.31 copied to clipboard

Firebase Auth Manager is a provider class for controling Firebase User on Android,Ios and Web.

Fire_Autho #

Firebase Authentication Manager #

Generic badge Generic badge

Notice: This project is under development. It's unofficial. You can send pull request to contribute.

Features #

All features is avaible on Mobile and Web but I can't test on IOS.

  • Sign and login with email.
  • Sign in anonymously (can link with other credential).
  • Sign in with Google, Twitter and phone number.
  • Link multiple accounts.
  • Delete account.
  • Verify account.
  • Listen auth state with provider.

Instalization #

index.html : #

     <script src=""></script>
     <script src=""></script>
     <script src=""></script>

      var firebaseConfig = {
      apiKey: "********",
      authDomain: "******",
      projectId: "****",
      storageBucket: "****",
      messagingSenderId: "******",
      appId: "********",
      measurementId: "****"


You need to use ChangeNotifierProvider on top of the widget tree.


   void main() {
     runApp(ChangeNotifierProvider(create: (context) => AuthManager(), child: MyApp()));

class MyHomePage extends StatefulWidget {
   AuthManager manager = AuthManager(); // Singleton class.

       // if you  will use twitter sign in. you must call this function.

Setup for Google Sign In On Web #

Configure you project and google cloud api like in this video. Be sure you added local host on cloud.

  <script src="" async defer></script>
  <meta name="google-signin-client_id" content="">

Example Usage #

All methods usages showed on example project.

onPressed: () async {
   AuthResponse response = await manager.signInWithMailPass(
       mailFieldController.text, passFieldController.text);  // give mail and password.
 // you can get manager with Provider.of<AuthManager>(context) too.
 if (response.status == Status.Failed) {
     showSnack(response);  // show fail message or do something to handle.


AuthResponse response = await Provider.of<AuthManager>(context).signInWithGoogle();
print(response.message + response.code); // response.status  can be Failed, Successed, Waiting

Phone Sign in :

AuthResponse response = await Provider.of<AuthManager>(context, listen:false).signInWithPhone(phoneNumberString, context);
// this will send a sms. if this succesed, you get response.type == Status.Waiting  not Status.Successed. Operation will finish when you confirm verification sms.
AuthResponse response = await Provider.of<AuthManager>(context, listen:false).verifyPhoneSignForWeb( _smsController.text);
// call this when you get the sms code. I use in  button onclick.