简体   繁体   中英

Firebase Phone authentication with OTP not working in release build

I am using Firebase SDK in android app for phone auth OTP verification. This is working fine on debug builds but not on release builds.

  1. Added my debug SHA-1 finger print in firebase project.
  2. Added my release certification SHA-1 fingerprint in firebase project.
  3. I haven't released/published the build into google play store yet.

Thanks in advance

For debug keys: Open your project in android studio > Click on Gradle (In the right panel) > Click on Your Project > Click on Tasks > Click on android > Double Click on signingReport

For release keys: Use this command to generate release keys: keytool -list -v -keystore "your jks file path " -alias "key name"

Add jks path and key name and run this command in android studio terminal.

OR

You can also get SHA1 and SHA- 256 from google play console. Go to Play store Console > Your project > Release > Setup > App signing.

  1. Copy both debug and release SHA1 and SHA- 256 keys and paste in firebase console.
  2. Update your firebase-auth version to 20.0.1 then you also need to configure safetynet in your project. For more info check this link
  3. Make sure PHONE AUTHENTICATION is enabled. Go to Firebase console -> Authentication -> Sign-in Methods.
  4. After adding keys, download updated google-services.json and add in your project.
  5. Clean project and then rebuild project.
  6. Test your app again (In order to prevent abuse the firebase phone authentication wont work in emulator so test on real device).

Check if you have completed all the above steps in your proejct. If your app is live on play store make sure your firebase project have both debug & release SHA1,SHA-256 key in your firebase console.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM