Skip to content
Shared Mobile and Web Firebase Login
Dart C++ Ruby Makefile Batchfile C Other
Branch: master
Clone or download
Latest commit c76a274 Nov 12, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea Initial commit Sep 5, 2019
.vscode Initial commit Sep 5, 2019
example
lib Update io.dart Nov 1, 2019
test Initial commit Sep 5, 2019
.DS_Store updating desktop projects Oct 2, 2019
.gitattributes
.gitignore Initial commit Sep 5, 2019
.metadata Initial commit Sep 5, 2019
CHANGELOG.md updating to bloc 2.0.0 Nov 12, 2019
LICENSE Initial commit Sep 5, 2019
README.md Update README.md Oct 2, 2019
fb_auth.iml Initial commit Sep 5, 2019
pubspec.yaml updating to bloc 2.0.0 Nov 12, 2019

README.md

fb_auth

A Shared Firebase Auth Plugin for Mobile, Web and Desktop. Included AuthBloc for minimal setup! Single dynamic import and compile time ready for ios, android, macos, windows, linux and web.

Getting Started

Setup your Bloc

final _auth = AuthBloc();

Follow Installation Instructions for Web: https://pub.dev/packages/firebase

Update /web/index.html in the body tag.

<!-- The core Firebase JS SDK is always required and must be listed first -->
  <script src="https://www.gstatic.com/firebasejs/6.3.3/firebase-app.js"></script>

  <!-- TODO: Add SDKs for Firebase products that you want to use
      https://firebase.google.com/docs/web/setup#config-web-app -->
  <script src="https://www.gstatic.com/firebasejs//6.3.3/firebase-auth.js"></script>
  <script src="https://www.gstatic.com/firebasejs/6.3.3/firebase-firestore.js"></script>
  <script src="https://www.gstatic.com/firebasejs/6.3.3/firebase-storage.js"></script>
  <script src="https://www.gstatic.com/firebasejs/6.3.3/firebase-functions.js"></script>

  <script>
    // Your web app's Firebase configuration
    var firebaseConfig = {
      apiKey: "API_KEY",
      authDomain: "AUTH_DOMAIN",
      databaseURL: "DATABASE_URL",
      projectId: "PROJECT_ID",
      storageBucket: "STORAGE_BUCKET",
      messagingSenderId: "MESSAGING_SENDER_ID",
      appId: "APP_ID"
    };
    // Initialize Firebase
    firebase.initializeApp(firebaseConfig);
  </script>

Follow Installation Instructions for Mobile: https://pub.dev/packages/firebase_auth

  • Update ios/Runner and add the GoogleService-Info.plist downloaded from firebase

  • Update android/app and add the google-services.json downloaded from firebase

  • Update android/build.gradle and update the classpath:

    classpath 'com.google.gms:google-services:4.2.0'

Actions

  • Check Current User
_auth.dispatch(CheckUser());
  • Listen for Auth Changes
_userChanged = _fbAuth.onAuthChanged().listen((user) {
    _auth.dispatch(UpdateUser(user));
});
  • Logout
_auth.dispatch(LogoutEvent(_user));
  • Login
_auth.dispatch(LoginEvent(_email, _password));
  • Guest
_auth.dispatch(LoginGuest());
  • Create Account
_auth.dispatch(CreateAccount(_email, _password, displayName: _name));
  • Edit Info
_auth.dispatch(EditInfo(displayName: _name));
  • Forgot Password
_auth.dispatch(ForgotPassword(_email));
  • Send Email Verification
_auth.dispatch(SendEmailVerification());
You can’t perform that action at this time.