Skip to content
This repository has been archived by the owner on Oct 29, 2020. It is now read-only.

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

License

Notifications You must be signed in to change notification settings

simpleclub/firebase_rest_auth

Repository files navigation

firebase_rest_auth

Discontinued & Deprecated

This package is discontinued & deprecated in favor of the changes to com.google.firebase:firebase-auth:20.0.0, now supporting devices without Google Play services

Until the Firebase BoM (Bill of Materials) version 26.0.0 is rolled out to flutterfire, it is possible to force integrate the library via app/build.grade :

dependencies {
  implementation ('com.google.firebase:firebase-auth') {
    version {
      strictly '20.0.0'
    }
  }
}

Thank you to all contributors who helped with the project!


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: [email protected]: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-extended/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:

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

A lot of methods such as currentUser are internally implemented by the Flutter instance and need no custom override.

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.