FlutterFlow Docs
Search…
Initial Setup
In order 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 project with a Firebase setup.
To enable authentication in the FlutterFlow:
  • Open your FlutterFlow project.
  • Click on the Setting and Integrations (
    ) from the Navigation Menu (left side of your screen).
  • Under the App Settings, select Authentication.
  • Find the Authentication Enabled toggle and turn it on.
  • Now you can set initial pages based on whether or not a user is logged in. Scroll down to the Initial Page section.
  • Find the Entry Page dropdown, click on the No Page Selected, and then select your login page.
  • Now, Find the Logged In Page dropdown, Click on the No Page Selected, and then select the page that you would like to open after successful login.
Enabling authentication

2. Creating the user collection

The user collection stores the information for an authenticated user.
Skip if you have already enabled Create User Collection while creating a project with a Firebase setup.
Use these steps to create the User collection:
  • Click on the Firestore from the Navigation Menu (left side of your screen).
  • Click on the + Create Collection button.
  • Enter a collection_name (this can be anything, but we recommend users) and click on Create button.
  • Now, click on the Settings panel (on the left side of your screen).
  • Find the Users Collection switch and enable it.
  • Find the Collection dropdown below, click on the Unset, and select the name of the collection you just created.
  • Click on the Collection panel (on the left side of the Settings panel). You will now see that FlutterFlow has automatically populated the default Firebase email fields for you.
You may want to store and collect additional information besides the default user collection values.
Here's an example of how you could add additional data to your user collection:
  • To add a new field, click on the + Add Field button.
  • Enter the field_name as age and set the Data Type to Integer.
You do not need to create a password field. This is handled separately by Firebase.
Creating user collection

Google/Phone Sign-In Setup

In order to use the Google/Phone sign-in, you must go through the following steps:

1. Generate the SHA-1 key

A SHA-1 key (also known as 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.
You can generate SHA-1 key by entering the following command in your terminal with these steps:
  • Open a terminal window:
    • Mac: click the Launchpad icon
      , type Terminal in the search field, then click Terminal.
    • Windows: click the Windows icon and then scroll down to find the Windows System folder. Open the folder and click or right-click Command Prompt to open it.
  • Copy the following command (based on your operating system) and select Enter.
Windows
Mac/Linux
1
keytool -list -v \
2
-alias androiddebugkey -keystore %USERPROFILE%\.android\debug.keystore
Copied!
If you get the following error while trying the above command:
1
ERROR:'keytool' is not recognized as an internal or external command
Copied!
You might not have JAVA installed on your machine. Here is the helpful link to install JAVA and remove the above issue.
1
keytool -list -v \
2
-alias androiddebugkey -keystore ~/.android/debug.keystore
Copied!
  • After enter key passsword: write android and press enter.
Generate SHA-1 key
To add the SHA-1 key in the Firebase Console:
  • Open the Firebase console of your project, click on the Gear icon beside the Project overview (Lefthand side panel), and select Project Settings.
  • Scroll down to Your App section.
  • Select your Android App from the left side menu.
  • Find the SHA certificate fingerprints section and click on the Add fingerprint.
  • Enter the generated SHA-1 into the Certificate fingerprint input box.
  • Click on the Save button.
Adding SHA-1 key in Firebase console

2. Regenerate config files

After adding the SHA-1 key, regenerating config files helps you test the Google and Phone sign-in in your device.
To regenerate the config files:
  • Return to FlutterFlow. From the Navigation Bar, select Settings & Integrations > Project Setup > Firebase.
  • Click on the Regenerate Config Files.
Regenerate confg files