To use authentication, you will need to complete the following initial 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.
- Find the Entry Page dropdown, click the No Page Selected, and 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.
The user collection stores the information for an authenticated user.
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.
- 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 for you.
Creating user collection-1
- If you skipped the previous popup but still want to add default fields, you can:
- Switch to the Settings() tab.
- 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.
- Now switch to the Collection tab(). Now you should see all the default fields.
Creating user collection-2
To use the Google/Phone sign-in, you must go through the following steps.
You can generate the 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 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.
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
keytool -list -v \
-alias androiddebugkey -keystore ~/.android/debug.keystore
- After enter key password: write android and press enter (you won't see the password while you type in).
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
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:
Regenerating config files