Links

Initial Setup

To use authentication, you will need to complete the following initial setup:

1. Enabling authentication in FlutterFlow

Skip if you have already enabled authentication while creating a new project with a Firebase setup.
To enable authentication in FlutterFlow:
  1. 1.
    Open your FlutterFlow project.
  2. 2.
    Open Setting and Integrations (
    ) > App Settings > Authentication.
  3. 3.
    Turn on the Enable Authentication toggle and select Authentication Type to Firebase.
  4. 4.
    To ensure that your users are directed to the appropriate pages based on their login status, you must set the initial pages.
Enabling authentication in FlutterFlow

2. Creating the 'users' collection

The 'user' collection stores the information for authenticated users.
Skip if you have already enabled 'Create User Collection' while creating a new project with a Firebase setup.
Use these steps to create the 'users' collection:
  1. 1.
    Click on the Firestore from the Navigation Menu (left side of your screen).
  2. 2.
    Click on the + Create Collection button. If you have any other collection already added, you can click on the Plus button (
    ).
  3. 3.
    Enter a collection_name (this can be anything, but we recommend 'users') and click on Create button.
  4. 4.
    If you enter 'users' a popup will open which asks you to populate this collection with default fields. You can click Yes, and we will add all the fields.
  1. 5.
    If you skipped the previous popup but still want to add default fields, you can:
    1. 1.
      Switch to the Settings tab.
    2. 2.
      Find the Users Collection switch and enable it.
    3. 3.
      Find the Collection dropdown below, click on the Unset, and select the name of the collection you just created.
    4. 4.
      Now switch to the Collection tab. Now you should see all the default fields.
To store and collect additional information with the default fields, see how to add fields.
You do not need to create a password field. This is handled separately by Firebase.

Additional steps for Google or Phone sign-in setup

To use the Google or Phone sign-in, you must go through the following steps.
If you aren't planning to use Google or Phone Sign-In, you can skip these steps.

1. Generate the SHA-1 key

An SHA-1 key (aka the 'Secure Hash Algorithm') is required if you want to use Google Sign-in and Phone Sign-in. To learn more about the SHA-1 key, see this link.
While releasing the app, make sure to get the key from the Play Console.
You can generate the SHA-1 key by entering the following command in your terminal with these steps:
  1. 1.
    Open a terminal window:
    • Mac: Use the Launchpad (
      ) or press (⌘ + Spacebar) for Spotlight search, type 'Terminal', and open it.
    • Windows: Click the Windows icon, navigate to the 'Windows System' folder, and open 'Command Prompt' either by clicking or right-clicking it.
  2. 2.
    Copy the following command (based on your operating system) and select Enter.
Windows
Mac/Linux
keytool -list -v \
-alias androiddebugkey -keystore %USERPROFILE%\.android\debug.keystore
If you get the following error while trying the above command:
ERROR:'keytool' is not recognized as an internal or external command
You might not have JAVA installed on your machine. Here is the helpful link to install JAVA and remove the above issue.
keytool -list -v \
-alias androiddebugkey -keystore ~/.android/debug.keystore
  1. 3.
    After being prompted for the key password, type 'android' and press 'Enter'. Note: For security reasons, you won't see the password as you type it.
Generate SHA-1 key
To add the SHA-1 key in the Firebase Console:
  1. 1.
    Open the Firebase console > Project Overview > Project Settings.
  2. 2.
    Scroll down to Your App section.
  3. 3.
    Select your Android App from the left side menu.
  4. 4.
    Find the SHA certificate fingerprints section and click on the Add fingerprint.
  5. 5.
    Enter the generated SHA-1 into the Certificate fingerprint input box.
  6. 6.
    Click on the Save button.

2. Regenerate config files

After adding the SHA-1 key you must re-generate the config files in FlutterFlow.
To regenerate the config files:
  1. 1.
    Return to FlutterFlow. From the Navigation Menu, select Settings & Integrations > Project Setup > Firebase.
  2. 2.
    Click on the Regenerate Config Files.
Regenerating config files

Last Updated Date: August 22, 2023