Phone Sign-In
Phone Sign-In allows a user to sign in by sending an SMS message to the user's phone. The user login in using a one-time code contained in the SMS message.
Before getting started with this section, ensure you have:
- 1.
- 2.Completed Initial setup required for authentication. (Please note: Skip if you have already enabled authentication and created a 'users' collection while creating your project with Firebase Setup.)
Adding Phone sign-in comprises the following steps:
To use phone sign-in, you must get the SHA-1 key and regenerate the configuration files. You can find the detailed instructions here. Note that this step is often missed, so ensure you must complete this step before you proceed further.
To enable authentication in the Firebase:
- 1.
- 2.Click on the Get started button (this may not be visible if you have already set up other forms of Authentication).
- 3.Select the Sign-in method tab.
- 4.Click on Phone (Under the 'Native Providers' section). If you have already added any other provider, click on the Add new provider and then click on Phone.
- 5.Find the Phone switch and enable it.
- 6.Click on the Save button.
To allow users to authenticate using their phone number, you need to create a page to accept the user's phone number. We provide a collection of ready-to-use templates. You can use one of our templates or create a page from scratch.
Here is the page added from the templates, and after some modification, it looks the below:
You need to create another page to verify the SMS code. Here's how you build the verify code page using templates.
On click the 'sign-in' or 'send code' button, you will add the 'Phone Sing In' action, which redirects users to a page where they can enter the code received on their phone.
To add this action:
- 1.Select the widget (e.g., Button) on which you want to add the action.
- 2.
- 3.Search and select the Phone Sign In (under Backend/Database > Firebase Authentication) action.
- 4.Now provide the Phone Number via Widget State > TextField (that accepts the phone number).
- 5.Now, Select Page that you created to verify code.
On click of the 'Verify Code' button, you will add the 'Verify SMS Code' action, which opens the home page if the action is successful.
- 1.Select the widget (e.g., Button) on which you want to add the action.
- 2.
- 3.Search and select the Verify SMS Code (under Backend/Database > Firebase Authentication) action.
- 4.Now provide the SMS Code via Widget State > TextField (that accepts the code).
To test phone sign-in in Test or Run mode, you must add the authorized domain in the Firebase console.
Here's how you add the authorized domain:
- 1.For Test mode, you can open the browser console, try logging in, and get the domain from the browser console, and for Run mode, you can simply use 'app.flutterflow.io.'
- 2.
- 3.Select the Setting tab.
- 4.Select Authorized domains from the left side menu.
- 5.Click Add domain.
Here's how it should look:

Adding authorized domain
Phone Sign In does not work in an Android emulator. You can only test it on a real device.
To test on a real device, add the SHA-256 key in the Firebase console and enable the 'Google Play Integrity API' in Google Cloud.
Skip if you find the below steps already completed by our automated Firebase integration.
- 1.Get the SHA-256 key/fingerprint, add it to your Firebase project, and then regenerate the Firebase config files in FlutterFlow. Note: The instructions are similar to generating the SHA-1 key and are explained here. You will find the SHA-256 key in the terminal just below the SHA-1 key. This is required for the Firebase to verify that the sign-in request is coming from a legitimate device.

SHA-256 key
- 2.Open the Google Developers Console (Make sure your project is selected in the dropdown at the top), Click on the Library menu on the left, search for the Google Play Integrity API, and enable it.
- 3.
To confirm the successful integration and the creation of users, navigate to your Firebase project > Authentication > Users and check the user entries.

Verify user creation
If you're releasing your app to the Play Store, you must add the SHA certificate fingerprints from the Play Console.
To get the keys for the release app, navigate to Play Store Console > Your project > Release Setup > App Signing and copy the SHA-1 and SHA-256 keys.

Getting SHA keys for release mode
To try phone sign-in without any limitations, you can add some fictitious numbers to the Firebase console.
To add the fictitious number:
- 1.
- 2.Select the Sign-in method tab.
- 3.Click on the Phone (Under the Sign-in providers section).
- 4.Scroll down, find the Phone numbers for testing menu, and click on it.
- 5.Enter any dummy phone number (Make sure it looks unreal).
- 6.Enter the verification code that you would use on the verify code page.
- 7.Click on add.
- 1.
- 2.If this is already enabled, head over to Settings > SMS region policy > select Allow > Select regions you want to support and click Save.
Last Updated Date: August 29, 2023
Last modified 1mo ago