firebase_rest_auth

pub package

Notice: The plugin is currently in development. See Limitations below for supported features.

You are more than welcome to contribute and extend the plugins functionality.

A Flutter plugin to use the Firebase Authentication API via REST.

Non Google Mobile Services (GMS) devices (such as Huawei or Amazon devices) can use the plugin to authenticate with Firebase, and can use plugins requiring user authentication such as

without further modifications.

The plugin supports REST authentication with Android only, but other platforms can be used through the standard firebase_auth implementation (see installation below).


Disclaimer

This plugins also implements an InternalAuthProvider for many other firebase plugins to use.

Firebase Instance Id (FirebaseIid) is not implemented yet by this plugin, therefore some plugins are reduced in functionality or might not work.

Note, you cannot also include the FirebaseAuth client library in your build.

For more information about the implementation read here.


Usage

The plugin utilizes the existing implementation and method channels of firebase_auth.

All implemented methods of the standard dart library can be used (see limitations), as this plugin only overrides the Android part of the method channel implementation!

Example:

FirebaseAuth.instance.signInWithCustomToken(token);

To use this plugin, see installation below.

Installation

To utilize the existing dart implementationa and method channels of firebase_auth, the installation comes with some unique requirements:

  1. Fork flutterfire
  2. Edit packages/firebase_auth/firebase_auth/pubspec.yaml:
    1. Change the plugins section:
      flutter:
        plugin:
          platforms:
            android:
              default_package: firebase_rest_auth
            ios:
              pluginClass: FLTFirebaseAuthPlugin
            macos:
              pluginClass: FLTFirebaseAuthPlugin
            web:
              default_package: firebase_auth_web
    
    1. Add this plugin to your forks pubspec.yml
    dependencies:
      firebase_rest_auth:
        git: git@github.com:simpleclub/firebase_rest_auth.git
    
  3. Commit the fork to a custom branch e.g. firebase-rest-auth
  4. Add your fork to your projects pubspec.yml
firebase_auth:
    git:
      url: https://github.com/<your_name_here>/flutterfire
      path: packages/firebase_auth/firebase_auth
      ref: firebase-rest-auth

A simple, pre-forked implementation is available at simpleclub-exteded/flutterfire, branch firebase-auth/firebase-rest-auth

Limitations

The plugins Android implementation is inspired heavily by FirebaseExtended/auth-without-play-services, therefore it currently shares the same limitations as described in the disclaimer.

Implemented methods of firebase_auth are:

  • currentUser()
  • signInWithCustomToken({@required String token})
  • signInWithEmailAndPassword({@required String email, @required String password})
  • get onAuthStateChanged
  • signOut()

You are more than welcome to contribute and extend the plugins functionality.

Contributing

If you wish to contribute a change in this repo, please review our contribution guide, and send a pull request.

Libraries

firebase_rest_auth
To enable firebase_rest_auth, you need to add the package to a custom fork for firebase_auth. [...]