firebase_auth_simplify 0.4.4

Firebase Authentication Simplify #

A high-level framework of Firebase Auth package that wraps several lines of codes to one line in order to easily use sign-in function.

Why/Who should use this #

You may want to use firebase_auth package directly if you need specific customization on sign-in/out logic.
However, although the most of usecases have almost the same signing-in and out codes, it is pain to write redundant codes everytime even if it is just a several lines of code. Especially, when you provide more than 2 sign-in methods.

You will basically write some codes like below for Each of sign-in methods, and you want to manage it seperatly from the widget you use.

// Example of Google sign in (What you will do with original packages)

final GoogleSignIn _googleSignIn = GoogleSignIn();
final FirebaseAuth _auth = FirebaseAuth.instance;

Future<FirebaseUser> _handleSignIn() async {
  final GoogleSignInAccount googleUser = await _googleSignIn.signIn();
  final GoogleSignInAuthentication googleAuth = await googleUser.authentication;

  final AuthCredential credential = GoogleAuthProvider.getCredential(
    accessToken: googleAuth.accessToken,
    idToken: googleAuth.idToken,

  final FirebaseUser user = (await _auth.signInWithCredential(credential)).user;
  print("signed in " + user.displayName);
  return user;

    .then((FirebaseUser user) => print(user))
    .catchError((e) => print(e));

_handleSignOut() {

This package has nothing fancy but just do the dirty things for you and what you will have is something like:

import 'package:firebase_auth_simplify/firebase_auth_simplify.dart';

// Google

// Facebook


So if your priority is 'simplicity' and 'less code' for 3rd party integration, it is worth using this package.

Who should consider NOT using this #

Firstly, if your project only uses firebase provided sign-in methods, such as email or phone auth, it is better using firebase_auth package directly.

Secondly, as this package includes several 3rd party sign-ins, such as google, facebook and kakao, it contains related packages which you might not need it. For example, even though you only provide email and google sign-in methods to the customer, your project will still contain facebook or other sign-in packages which is not necessary in your case. If the issue matters to you, I recommend using your own way instead of implementing this package

Currently supporting Sign-ins (X = supporting) #

  • [X] Email
  • [X] Phone
  • [X] Google
  • [ ] Google Play Games
  • [X] Facebook
  • [X] Kakao
  • [ ] Apple
  • [ ] GameCenter
  • [ ] Twitter
  • [ ] Github
  • [ ] Line

Support #

If the package was useful or saved your time, please do not hesitate to buy me a cup of coffee! ;)
The more caffeine I get, the more useful projects I can make in the future.

Buy Me A Coffee

Getting Started #

NOTE: Only setup what you need. No need to configure all of followings

IF you encounter app crashes, you must configure Facebook setting.

Caused by com.facebook.FacebookSdkNotInitializedException
The SDK has not been initialized, make sure to call FacebookSdk.sdkInitialize() first.

The crash is happening because facebook auth package checkes the app id even if you do not use it and throws an exception when it is not set properly.

Firebase Auth Setup #

This project uses firebase_auth package and is just a wrapper of it. So please make sure you follow setup instruction of firebase_auth.

You basically need to set google services at Android build.gradle files, and then you must add App at Firebase Console.

NOTE: If previous setting is not completed you will get an error like below.

Default FirebaseApp is not initialized in this process [package name].
Make sure to call FirebaseApp.initializeApp(Context) first.

Google sign in Setup #

Import google_sign_in package and follow the instruction.

Facebook sign in Setup #

Import flutter_facebook_login package and follow the instruction.

Note: Use openssl-0.9.8e_X64 for getting key hash. Otherwise, it will fail to authenticate.
Also, on Windows platform, DO NOT use keytool at powershall using vs code's terminal. Use cmd.

Kakao sign in Setup #

Import flutter_kakao_login package and follow the instruction. Steps are similar to Facebook settings.

  1. Create an app at kakao developer portal.
  2. Set key hash in there.

Note: Use openssl-0.9.8e_X64 for getting key hash. Otherwise, it will fail to authenticate.
Also, on Windows platform, DO NOT use keytool at powershall using vs code's terminal. Use cmd.

For Android, Set AndroidManfest.xml

For iOS, Set info.plist and import SDK into xcode before building.

For Firebase, We need a cloud function which creates custom token with kakao access token. Please refer to below documents.

  1. Issue ticket at FirebaseExtended github.
  2. Basic implementation at FirebaseExtended github.
  3. Improved implementation by CorderSpinoza at github.
  4. Usage of userClaims at Stackoverflow.
  5. npm install --save request request-promise to use 'request-promise module'
  6. IMPORTANT: Make sure to call 'createCustomToken' with { provider: "" } at 2nd parameter. If not, you won't be able to call sign-out for it.

Note: Either using config.json file or using config 'firebase functions:config:set kakao.appid=your_kakao_app_id' for cloud function is recommended instead of coding it directely into cloud function code.
Then, you can decalre like:

const kakaoId = require("./config.json");
const kakaoId = functions.config().kakao.appid;

If you encounter below error, follow the link and enable API.

{error: {codePrefix: auth, errorInfo: {code: auth/insufficient-permission, message: Identity and Access Management (IAM) API has not been used in project YOUR_PROJECT_ID before or it is disabled. Enable it by visiting then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.; Please refer to for more details on how to use and troubleshoot this feature.}}}

If you see below error, you also need to set Permission of iam.serviceAccounts.signBolb.

{error: {codePrefix: auth, errorInfo: {code: auth/insufficient-permission, message: Permission iam.serviceAccounts.signBlob is required to perform this operation on service account projects/-/serviceAccounts/; Please refer to for more details on how to use and troubleshoot this feature.}}}

Grant permission in console.

Lastly, as this uses external request, you need to change your plan to 'Blaze'. Otherwise, you will get 500 error.

Usage #

Simple Sign-up/in/out #

Simply initialize the class you want to sign in for, and call signIn() function.
NOTE: If you use it this way, you need to manage 3rd party sign-'out' logic yourself, because 'firebase_auth' package does not support the function yet. It only provides signOut() function for firebase provided auth such as email. You also have to manage linking option yourself.

Sign-Up / Sign-In #

// e-mail
FirebaseEmailAuthAPI(email: inputEmail, password: inputPassword).signUp();
FirebaseEmailAuthAPI(email: inputEmail, password: inputPassword).signIn();

// phone auth
FirebasePhoneAuthAPI phoneAuthAPI = FirebasePhoneAuthAPI();
phoneAuthAPI.verifyNumber(phoneNumber, ....);

// google
FirebaseGoogleAuthAPI(scopes: ['email', '']).signIn();

// Kakao 

// Facebook

Sign-Out #

// Singing out using original package of firebase_auth. 
// IMPORTANT: This will NOT sign out from 3rd party provider

We provide FirebaseAuthProvider so that we can manage sign-out and 3rd party providers' account linking function for you.

Sign-Up / Sign-In #

FirebaseAuthProvider.instance.signUpWith(FirebaseWhateverAuthAPI());    // Only works with firebase provided auth. (eg. email)

Phone authenticate needs few more lines.

FirebasePhoneAuthAPI phoneAuthAPI = FirebasePhoneAuthAPI();
phoneAuthAPI.verifyNumber(phoneNumber, ....);


Sign-Out #

// Then you can sign-out anywhere. 

NOTE: Good thing to use this way is it does not only sign out from Firestore, but also sign out from 3rd party provider which we can allow user to sign-in with another account to the same provider. Also, you can manage account linking easily.

Linking #


Phone authenticate needs few more lines.

final FirebasePhoneAuthAPI phoneAuthAPI = FirebasePhoneAuthAPI(); // Initialize first
phoneAuthAPI.verifyNumber(phoneNumber, ......);          // Send phone number to get code
phoneAuthAPI.submitVerificationCode(code);                        // Submit the 6 digit code

FirebaseAuthProvider.instance.linkCurrentUserWith(phoneAuthAPI);  // Then try link (Will get ERROR_INVALID_VERIFICATION_CODE exception if code is wrong)

Other useful packages you might be instrested #

Material design Speed Dial
Google Maps Place Picker

Buy Me A Coffee

[0.4.4] - 2/Feb/2020

  • Bug Fix.

[0.4.3] - 1/Feb/2020

  • Update document

[0.4.2] - 30/Jan/2020

  • Added information about app crash regarding Facebook package issue

[0.4.1] - 30/Jan/2020

  • Added example screenshots

[0.4.0] - 29/Jan/2020

  • Added Phone authentication
  • Added Phone authentication example
  • Added assertion for sign-in logic

[0.3.3] - 29/Jan/2020

  • Fixed bug that Kakao sign-in links automatically with existing e-mail. It will throw an error and only can be linked by using link function.
  • Kakao sign-in will throw a new exception in regards to above issue.
  • Added try-catch block for email authentication. It will now catch error correctly.
  • Fixed bug at example code. It will now trim the white space before sending to the server.
  • Fixed bug at example code. Sign-in/out dialog will be disappear as expected when sign-in/out is succeeded.

[0.3.2] - 29/Jan/2020

  • Minor bug fix

[0.3.1] - 29/Jan/2020

  • Added getUserClaim function so that we can get claim data from provider
  • Changed logic of signing-out from 3rd party providers

[0.3.0] - 28/Jan/2020

  • Updated cloud function for verifiying/creating Kakao token
  • Changed logic of Kakao sign in
  • Refactoring Kakao sign in
  • Refactoring other sign ins
  • Added linking function
  • Made email and password as a required field

[0.2.0] - 27/Jan/2020

  • Supporting Facebook sign in

[0.1.0] - 27/Jan/2020

  • Supporting Kakao sign in

[0.0.1] - 25/Jan/2020

  • Initial release with Firebase email and Gmail support


example #

A new Flutter project.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  firebase_auth_simplify: ^0.4.4

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:firebase_auth_simplify/firebase_auth_simplify.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Feb 13, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5
  • Flutter: 1.12.13+hotfix.7


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
cloud_functions ^0.4.1+8 0.4.1+9
firebase_analytics ^5.0.10 5.0.11
firebase_auth ^0.15.3+1 0.15.4
flutter 0.0.0
flutter_facebook_login ^3.0.0 3.0.0
flutter_kakao_login ^0.7.0 0.7.0
google_sign_in ^4.1.1 4.1.1
http ^0.12.0+4 0.12.0+4
provider ^4.0.2 4.0.4 4.1.0-dev
Transitive dependencies
async 2.4.0
charcode 1.1.3
cloud_functions_platform_interface 1.0.0
cloud_functions_web 1.0.3
collection 1.14.11 1.14.12
firebase 7.2.1
firebase_auth_platform_interface 1.1.5
firebase_auth_web 0.1.2
firebase_core 0.4.4
firebase_core_platform_interface 1.0.2
firebase_core_web 0.1.1+2
flutter_web_plugins 0.0.0
google_sign_in_platform_interface 1.0.3
google_sign_in_web 0.8.3+1
http_parser 3.1.3
js 0.6.1+1
matcher 0.12.6
meta 1.1.8
nested 0.0.4
path 1.6.4
pedantic 1.9.0
plugin_platform_interface 1.0.1
quiver 2.1.2+1
sky_engine 0.0.99
source_span 1.6.0
stack_trace 1.9.3
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies