Firebase Phone OTP/ SHA1

Enable phone authentication on firebase first.

  1. Click on authentication

  2. Click on Sign-in method tab

  3. click on phone then enable it

  4. on the sign-in method tab, scroll to the Authorized domains

  5. Add your backend domain. This is so firebase can allow request from your server.

OTP

Android has added SafetyNet you can read more here. For OTP to work you need to do the following:

  • enable the Android Device verification api on the google cloud console. Follow the link here to enable it.

  • 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.

How to generate the app SHA1 and SHA56

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, 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:

  1. Change the google-services.json file again.

  2. Delete the app in settings and add a new one with the right SHA1

Last updated