Flutter plugin for Firebase Auth UI. Supports popular auth providers by using native SDK for Android and iOS.

Overview

firebase_auth_ui

Flutter plugin of Firebase UI which allows to add login/sign-up quickly.

NOTE: This plugin is under development. Please provide Feedback and Pull Requests in order to have your feature(s) integrated.

Screenshot

Usage

Import

import 'package:firebase_auth_ui/firebase_auth_ui.dart';
import 'package:firebase_auth_ui/providers.dart';

Use of the plugin

Present the auth screen
FirebaseAuthUi.instance()
        .launchAuth(
          [
            AuthProvider.email(), // Login/Sign up with Email and password
            AuthProvider.google(), // Login with Google
            AuthProvider.facebook(), // Login with Facebook
	    AuthProvider.twitter(), // Login with Twitter
	    AuthProvider.phone(), // Login with Phone number
          ],
          tosUrl: "https://my-terms-url", // Optional
          privacyPolicyUrl: "https://my-privacy-policy", // Optional,
        )
        .then((firebaseUser) =>
            print("Logged in user is ${firebaseUser.displayName}"))
        .catchError((error) => print("Error $error"));
Logout
void logout() async {
	final result = await FirebaseAuthUi.instance().logout();
	// ...
}
Delete
void delete() async {
	final result = await FirebaseAuthUi.instance().delete();
	// ...
}

Plugin returns FirebaseUser with following details:

Field Description
uid UID of authenticated user
displayName Display name of user
email Email of user
phoneNumber Phone number of user
photoUri URI of user's photo
providerId Indicates through which provider user was authenticated.
isNewUser Indicates if user is new
metaData Object of MetaData

MetaData

Field Description
creationTimestamp Timestamp of user's creation
lastSignInTimestamp Timestamp of user's last sign in

Notes:

  • Above details may be null depending on the provider user used to sign and user's privacy settings on respective provider.
  • creationTimestamp seems to return wrong value sometimes on Android.

If you want to have full FirebaseUser object then please add firebase_auth dependency. You can then use FirebaseAuth.instance.currentUser().

Configuration

Create a project on Firebase console and add Android and iOS platform in Settings > Your apps

  • Open the Authentication section and then navigate to Sign in method. Please enable Email/Password, Google, Facebook, Twitter and Phone method depending on your need and click save.
  • Navigate back to Settings > Your apps
  • Download "google-services.json" for Android
  • Download "GoogleService-Info.plist"for iOS

Android

Open project's build.gradle ([flutter_project]/android/build.gradle) and add following in dependencies{ ... }:

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

Open app module's build.gradle ([flutter_project]/android/app/build.gradle) and add following at the end of file, i.e as a last line:

apply plugin: 'com.google.gms.google-services'

Copy the downloaded google-services.json in [flutter_project]/android/app directory.

iOS

Copy the downloaded GoogleService-Info.plist in [[flutter_project]/ios/Runner directory.

Additional setup for Google, Facebook, Twitter and Phone sign-in

Google

Android

No additional setup required.

iOS

  • Open the GoogleService-Info.plist and copy REVERSED_CLIENT_ID. It should look like com.googleusercontent.apps.[APP_ID-somevalue]
  • Now open "Info.plist" ([flutter_project]/ios/Runner and paste following by replacing [REVERSED_CLIENT_ID] with yours copied in above step:
<key>CFBundleURLTypes</key>
	<array>
		<dict>
			<key>CFBundleURLSchemes</key>
			<array>
				<string>[REVERSED_CLIENT_ID]</string>
			</array>
		</dict>
	</array>

Facebook

Android

Add following lines in strings.xml [flutter_project]/android/app/src/main/res/values

<string name="facebook_application_id" translatable="false">[YOUR_FACEBOOK_APP_ID]</string>
<string name="facebook_login_protocol_scheme" translatable="false">fb[YOUR_FACEBOOK_APP_ID]</string>

iOS

  • Add fbFACEBOOK_APP_ID as a URL scheme Open open Info.plist ([flutter_project]/ios/Runner and paste following by replacing [YOUR_FACEBOOK_APP_ID] with yours:
<key>CFBundleURLTypes</key>
	<array>
		<dict>
			<key>CFBundleURLSchemes</key>
			<array>
				<string>fb[YOUR_FACEBOOK_APP_ID]</string>
			</array>
		</dict>
	</array>

NOTE: If you have configured Google sign-in by following above steps, you already have CFBundleURLSchemes key defined with [REVERSE_CLIENT_ID]. In that case, just add

<string>fb[YOUR_FACEBOOK_APP_ID]</string>

below [REVERSE_CLIENT_ID]

  • Add facebook app id and app's name in Info.plist
<key>FacebookAppID</key>
	<string>[YOUR_FACEBOOK_APP_ID]</string>
	<key>FacebookDisplayName</key>
	<string>[YOUR_FACEBOOOK_APP_NAME]</string>

Twitter

Android

Add following lines in strings.xml [flutter_project]/android/app/src/main/res/values

<string name="twitter_consumer_key" translatable="false">[YOUR_CONSUMER_KEY]</string>
<string name="twitter_consumer_secret" translatable="false">fb[YOUR_CONSUMER_SECRET]</string>

iOS

If you have already configured Google sign-in for iOS following above steps, then you don't need to do anything else. If not, please follow the exact same step.

Phone number

Android

No additional setup required.

iOS

If you have already configured Google sign-in for iOS following above steps, then you don't need to do anything else. If not, please follow the exact same step.

Customization

Add logo

Rename your icon to auth_ui_logo.png then follow below steps:

Android
  • Place the png file in [flutter_project]/android/app/src/main/res/drawable
iOS
  • Create an imageset with auth_ui_logo and place the png inside it. For creating the imageset, you can open the iOS project in XCode and then drag and drop the png image in Assets.

Android specific

  • Actionbar title: Define your app's name in strings.xml and that'll appear as title in action bar.
  • Actionbar and status bar color: Add following in your colors.xml [flutter_project]/android/app/src/main/res/values
<color name="colorPrimary">#[ACTIONBAR_COLOR]</color>
<color name="colorPrimaryDark">#[STATUSBAR_COLOR]</color>

Note: If you don't have colors.xml, please create one.

Misc

  • The order of login buttons depends on the sequence of AuthProviders you passed in launchAuth(). For example if you have Email, Google and Facebook auth configured and would like the Facebook to appear first, you can simply pass the AuthProvider.facebook() as first element in the providers list.
Comments
  • "ui_flow" title in actionbar

    Hi, when I launch the login/register process using FirebaseAuthUi.instance() .launchAuth the first page that appears lets choose the login method (email, facebook etc) , the title in the action bar is "ui_flow" can that be changed? Also, you have done a wonderful job with this. It is helping mw a lot Thanks

    question 
    opened by robmr88 4
  • Feature: Phone Authentication

    Feature: Phone Authentication

    Thanks for this amazing package, it really reduces the authentication burden!

    It would be really great if the authentication method by phone number would be added. For me it is still the best way to integrate contacts in my app.

    Happy to hear from you!

    enhancement 
    opened by GRBurst 3
  • Update firebase-ui-auth to 6.2.1, remove firebase-auth

    Update firebase-ui-auth to 6.2.1, remove firebase-auth

    FirebaseUI libraries have the following transitive dependencies on the Firebase SDK:
    
    firebase-ui-auth
    |--- com.google.firebase:firebase-auth
    |--- com.google.android.gms:play-services-auth
    

    https://github.com/firebase/FirebaseUI-Android/blob/e9df5b55a5e83cea037f61188ce6dca3179a86d5/README.md#compatibility-with-firebase--google-play-services-libraries

    opened by fdietze 2
  • How to stay logged in?

    How to stay logged in?

    From my understanding, logging in is only possible via launchAuth, which in turn takes forever to do its job even if the user signed in previously. Is there a way to store the authentication data until logout() is called? I can't find any api tokens exposed by this thing.

    opened by ciriousjoker 1
  • After phone auth, how to ask user for username?

    After phone auth, how to ask user for username?

    Thanks for the great library!

    Phone auth has as displayName an empty string. Would it be possible to ask for it in the auth process, or should I do it manually after auth?

    opened by fdietze 1
  • delete user throws native exception

    delete user throws native exception

    Hello, I am getting "java.lang.IllegalStateException: Reply already submitted" when trying to call the delete function on the user. Could you update a bit this library? It is very useful to many of us that have used it. Thank you

    opened by robmr88 0
  • The plugin `firebase_auth_ui` uses a deprecated version of the Android embedding.

    The plugin `firebase_auth_ui` uses a deprecated version of the Android embedding.

    Hi, This is my first time working on a flutter app so i am sorry if this is a stupid question but please explain where am I going wrong. I have purchased a template app and since the first time trying to run it (no modifications) I see the following warning in RED (the app still runs):

    The plugin firebase_auth_ui uses a deprecated version of the Android embedding. To avoid unexpected runtime failures, or future build failures, try to see if this plugin supports the Android V2 embedding. Otherwise, consider removing it since a future release of Flutter will remove these deprecated APIs. If you are plugin author, take a look at the docs for migrating the plugin to the V2 embedding: https://flutter.dev/go/android-plugin-migration.

    Following the bread crumbs have brought me here. Can you please let me know if this is something you can fix and update the package on pub.get or is there something I can do to to get rid of the error? I am worried of the red warning and that even if the app runs now if might not run in the future.

    Thank you for your time to look into this and aswer.

    opened by Polina-Hapi 0
  • Need Sign In Apple Urgently

    Need Sign In Apple Urgently

    Dear @sam0829 please make for sign in by apple, because my application rejection several times by apple cause didn't have apple sign in.

    thank you very much

    opened by rndsamjin 0
  • App Crashes on show auth UI

    App Crashes on show auth UI

    gradle: android compileSdkVersion 29 minSdkVersion 18 targetSdkVersion 29 multiDexEnabled true

    flutter doctor: Flutter (Channel master, 1.24.0-8.0.pre.149, on Linux, locale es_AR.UTF-8) • Flutter version 1.24.0-8.0.pre.149 at /home/xxx/snap/flutter/common/flutter • Framework revision 8e7748e74c (hace 3 semanas), 2020-11-08 20:32:04 -0800 • Engine revision 0f7cdca65f • Dart version 2.12.0 (build 2.12.0-27.0.dev)

    [✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3) • Android SDK at /home/xxx/Android/Sdk • Platform android-29, build-tools 29.0.3 • Java binary at: /home/xxx/apps/android-studio/jre/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593) • All Android licenses accepted.

    pubspec: flutter sdk: ">=2.7.0 <3.0.0"

    dependencies:

    firebase_auth_ui: ^1.0.1 firebase_auth: ^0.18.0+1

    phone Sony Xperia XA1 Plus Android 8.0 (SDK 26)

    stacktrace:

    java.lang.RuntimeException: at android.view.DisplayListCanvas.throwIfCannotDraw (DisplayListCanvas.java:229) at android.view.RecordingCanvas.drawBitmap (RecordingCanvas.java:97) at android.graphics.drawable.BitmapDrawable.draw (BitmapDrawable.java:529) at android.widget.ImageView.onDraw (ImageView.java:1367) at android.view.View.draw (View.java:19380) at android.view.View.updateDisplayListIfDirty (View.java:18287) at android.view.View.draw (View.java:19092) at android.view.ViewGroup.drawChild (ViewGroup.java:4344) at android.view.ViewGroup.dispatchDraw (ViewGroup.java:4130) at androidx.constraintlayout.widget.ConstraintLayout.dispatchDraw (ConstraintLayout.java) at android.view.View.updateDisplayListIfDirty (View.java:18275) at android.view.View.draw (View.java:19092) at android.view.ViewGroup.drawChild (ViewGroup.java:4344) at android.view.ViewGroup.dispatchDraw (ViewGroup.java:4130) at android.view.View.updateDisplayListIfDirty (View.java:18275) at android.view.View.draw (View.java:19092) at android.view.ViewGroup.drawChild (ViewGroup.java:4344) at android.view.ViewGroup.dispatchDraw (ViewGroup.java:4130) at android.view.View.updateDisplayListIfDirty (View.java:18275) at android.view.View.draw (View.java:19092) at android.view.ViewGroup.drawChild (ViewGroup.java:4344) at android.view.ViewGroup.dispatchDraw (ViewGroup.java:4130) at android.view.View.updateDisplayListIfDirty (View.java:18275) at android.view.View.draw (View.java:19092) at android.view.ViewGroup.drawChild (ViewGroup.java:4344) at android.view.ViewGroup.dispatchDraw (ViewGroup.java:4130) at android.view.View.updateDisplayListIfDirty (View.java:18275) at android.view.View.draw (View.java:19092) at android.view.ViewGroup.drawChild (ViewGroup.java:4344) at android.view.ViewGroup.dispatchDraw (ViewGroup.java:4130) at com.android.internal.policy.DecorView.dispatchDraw (DecorView.java:831) at android.view.View.draw (View.java:19392) at com.android.internal.policy.DecorView.draw (DecorView.java:817) at android.view.View.updateDisplayListIfDirty (View.java:18287) at android.view.ThreadedRenderer.updateViewTreeDisplayList (ThreadedRenderer.java:643) at android.view.ThreadedRenderer.updateRootDisplayList (ThreadedRenderer.java:649) at android.view.ThreadedRenderer.draw (ThreadedRenderer.java:757) at android.view.ViewRootImpl.draw (ViewRootImpl.java:3380) at android.view.ViewRootImpl.performDraw (ViewRootImpl.java:3182) at android.view.ViewRootImpl.performTraversals (ViewRootImpl.java:2703) at android.view.ViewRootImpl.doTraversal (ViewRootImpl.java:1602) at android.view.ViewRootImpl$TraversalRunnable.run (ViewRootImpl.java:7407) at android.view.Choreographer$CallbackRecord.run (Choreographer.java:948) at android.view.Choreographer.doCallbacks (Choreographer.java:750) at android.view.Choreographer.doFrame (Choreographer.java:682) at android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:934) at android.os.Handler.handleCallback (Handler.java:869) at android.os.Handler.dispatchMessage (Handler.java:101) at android.os.Looper.loop (Looper.java:206) at android.app.ActivityThread.main (ActivityThread.java:6749) at java.lang.reflect.Method.invoke (Method.java) at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:240) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:845)

    opened by gigonzalezs 0
  • Google Smart Lock doesn't allow to change accounts

    Google Smart Lock doesn't allow to change accounts

    Once I sign in via Google it doesn't show me auth dialog, it just automatically signs me with google without an option to choose other. We need an ability to disable that.

    opened by asmodeoux 0
Owner
Sandip Fichadiya
Mobile app enthusiast, having 6 years of experience in developing mobile apps in various technologies including Android, iOS, NativeScript, Flutter.
Sandip Fichadiya
Suggestion providers - Search suggestions for your dart/flutter app

suggestion_providers Get search suggestions (typeahead) from search engines, like google, duckduckgo and more. supported search engines: google duckdu

Clone Conflict 1 Jan 15, 2022
Excess Food Locator helps food providers connect with food distributing NGOs.

Excess Food Locator Excess Food Locator helps people having excess food connect with other resources and distributors. This application is based on a

Pranav Kale 6 Nov 6, 2022
This is just the simplyfied Flutter Plugin use for one of the popular flutter plugin for social media login.

social_media_logins Flutter Plugin to login via Social Media Accounts. Available Social Media Logins: Facebook Google Apple Getting Started To use thi

Reymark Esponilla 3 Aug 24, 2022
Flutter Downloader - A plugin for creating and managing download tasks. Supports iOS and Android.

Flutter Downloader A plugin for creating and managing download tasks. Supports iOS and Android. This plugin is based on WorkManager in Android and NSU

Flutter Community 789 Jan 3, 2023
A Video Player For Vimeo Videos in Flutter. This plugin allows us to play video from Vimeo and it supports Android and iOS platforms.

vimeo_video_player A Video Player For Vimeo Videos in Flutter. This plugin allow us to play video from vimeo and it's supports Android and iOS platfor

MindInventory 26 Dec 8, 2022
A Flutter plugin for authenticating users by using the native TwitterKit SDKs on Android & iOS.

flutter_twitter_login A Flutter plugin for using the native TwitterKit SDKs on Android and iOS. This plugin uses the new Gradle 4.1 and Android Studio

Iiro Krankka 83 Sep 15, 2022
Barcode scanner plugin for flutter. Supports barcode scanning for Android and iOS

flutter_barcode_scanner A plugin for Flutter apps that adds barcode scanning support on both Android and iOS. Try example Just clone or download the r

Amol Gangadhare 325 Jan 6, 2023
dna, dart native access. A lightweight dart to native super channel plugin

dna, dart native access. A lightweight dart to native super channel plugin, You can use it to invoke any native code directly in contextual and chained dart code.

Assuner 14 Jul 11, 2022
Let's setup Firebase​​ for our Flutter​​ app on Android​, iOS​ and Flutter Web. Setup Firebase to use Firebase products.

Flutter Tutorial - Firebase Setup For Flutter Web Let's setup Firebase for our Flutter app on Android, iOS and Flutter Web. Setup Firebase to use Fire

null 1 Apr 27, 2022
Todo is an Simple Task Management App coded using Dart which is a peogramming language for Flutter SDK(2.5) supports Null Safety 📑🚩

Todo ?? ?? ?? Introduction Todo is an Simple Task Management App coded using Dart which is a peogramming language for Flutter SDK(2.5) supports Null S

navee-ramesh 6 Nov 5, 2022
User auth form - Signup and signin user auth form with ability to stay signed in and have an option to signout.

user_auth_form SIgnup and signin user authentification form Getting Started This project is a starting point for a Flutter application. A few resource

null 0 Jan 6, 2022
Flutter firebase auth - Simple implementation of Firebase Authentication using Flutter

FlutterFire Authentication Sample A simple implementation of Firebase Authentica

Souvik Biswas 4 Apr 2, 2022
Easy-to-make native ads in flutter using AdMOB SDK.

native_admob_flutter Easy-to-make ads in Flutter with Google's AdMob SDK. English | Português Get started To get started with Native Ads for Flutter,

Bruno D'Luka 81 Dec 12, 2022
This is a flutter based project. It authorize the user by scanning fingerprint using ios and android native fingerprint scanners.

flutter_fingerprint_auth Fingerprint Authentication in Flutter Introduction In this article we are talking about fingerprint authentication. As far as

Vnnovate Solutions Pvt Ltd 1 Aug 22, 2022
A flutter plugin to get facebook deep links and log app events using the latest Facebook SDK to include support for iOS 14

Facebook Sdk For Flutter LinkedIn GitHub facebook_sdk_flutter allows you to fetch deep links, deferred deep links and log facebook app events. This wa

Saad Farhan 23 Dec 17, 2022
This is the code for the POAPin app, which is written in Flutter and currently supports iOS, Android, and Web platforms.

POAPin This is the code for the POAPin app, which is written in Flutter and currently supports iOS, Android, and Web platforms. ?? Get the app Platfor

Glory Lab 17 Nov 7, 2022
how to Integrating facebook audience network to flutter app for banner, interstitial, rewarded, native and native banner

fb_ads_flutter_12 A new Flutter project. Getting Started Watch the complite tutorial for integrating Facebook ads into the Flutter app in our Youtube

null 4 Nov 26, 2022
A Flutter implementation of splash screen. Supports Android and IOS.

your_splash A Flutter implementation of splash screen. Supports Android and IOS. Features Supports splash screen with the Future callback Supports spl

Stepanenko Stanislav 6 Sep 27, 2022
Flutter native ads - Show AdMob Native Ads use PlatformView

flutter_native_ads Flutter plugin for AdMob Native Ads. Compatible with Android and iOS using PlatformView. Android iOS Getting Started Android Androi

sakebook 64 Dec 20, 2022