Firebase Phone OTP - Android
Last updated
Last updated
Android has added Play Integrity API you can read more here. For OTP to work you need to do the following:
To use the Play Integrity API, you must enable Play Integrity API responses by linking your app to a Google Cloud project. Then follow the instructions to integrate the API into your app.
In the Play Console, navigate to the Release section of the left menu. Go to Setup > App integrity. Select the Integrity API tab to get started.
You can enable Play Integrity API responses for your app without using the Google Play Console. To do so, complete these steps:
Choose an existing project or create a new project from the Google Cloud Console.
Go to APIs and services and select enable APIs and services.
Search for Play Integrity API. Select it and then select Enable.
If you haven't yet specified your app's SHA-256 fingerprint, do so from the Settings Page of the Firebase console. For more info read details here.
You need to configure firebase phone auth for phone otp verification to work, without this you would running into errors building the app.
To solve this error, you need to add both your keystore SHA1 and SHA56 as well as debug SHA1 and SHA256 to fireabse console.
That means two SHA1 and two SHA256
For debug keys use https://developers.google.com/android/guides/client-auth?authuser=1 to get the key, Navigate to the android folder in the project in your terminal/cmd, Then type the following command below
use ./gradlew signingReport
or .\gradlew signingReport
if in windows to get debug keys.
For release keys use Keystore explorer to see the SHA1 and SHA256.
If the issue persists after changing your SHA1 and SHA256 make sure the following:
Change the google-services.json file again.
Delete the app in settings and add a new one with the right SHA1
NOTE: If you are using issues with firebase OTP, you might have to also add the SHA1 and SHA256 from google Play app signing section.