Before you begin make sure you have completed Firebase Setup.
If you plan to use Google Sign-In or Phone Sign-In you will also need to complete the Google/Phone Sign-In 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 AuthenticationEnabled 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
Additional Steps For Google/Phone Sign-In Setup
In order to use the Google/Phone sign-in, you must go through the following steps:
If you aren't planning to use Google/Phone Sign-In you can skip these steps for now.
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.