Firebase PhoneAuth with Real phone Number Is Not Working But Whitelisted Number is Working - Android

生来就可爱ヽ(ⅴ<●) 提交于 2020-06-26 05:54:38

问题


I am setting up Firebase Phone Auth in My App. I set up a Test Phone Number and a verification code in firebase auth section Whitelist. When I test with this Number and code, it's working. But When I Test With another number I got the Following error :

onVerificationFailed    com.google.firebase.auth.FirebaseAuthInvalidCredentialsException:
    The request contains malformed or mismatching credentials [ App ID does not match the requested project.

side note: I also use facebook account kit in this android app, and It goes well.

Any Suggestions?


回答1:


Please put SHA certificate fingerprint in your firebase account.

To get this follow these steps :

1.Open your project in Android Studio
2.Click on Gradle Menu (From Right Side Panel )
3.Expand Your Project -> Tasks -> Double click on siginingReports
4.You will see SHA-1 and MD5 fingerprint in your run tab
5.Copy it and paste in your firebase console.




回答2:


What worked for me :

1) Updated SHA1 certificate fingerprint for all package names (prod, dev..)

2) Downloaded google-services.json and added to app/

3) Rebuild project

It's the third step that I missed. It wasn't suggested in any of these suggested answers, so I'm leaving the tip here. Hope that helps some of you.




回答3:


What I have done wrong that, I have added the same android project and SHA key for Two Firebase Project.

The SHA key I have found for one app are Various according to build variant:

I got one SHA key, When I debug my app. I got another SHA key, When I made release build for my app. I got third SHA key for the Same app When I submitted this app in Play Console. (From App signing Section)

So, I have Deleted My previous Firebase Project (because of no longer needed), And Create A new Firebase Project, Add this Android App and Add those All SHA key in Firebase : Project overview > settings > your apps > android apps > add SHA fingerprint section.

And, Then its Worked Well. Alhamdulillah.




回答4:


  1. You should delete debug.keystore in ~./android/debug.keystore and in project android/app/debug.keystore

  2. Create new keystore:

$ keytool -genkey -v -keystore debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000
  1. Copy ~./android/debug.keystore to project android/app/
  2. Get SHA-1 and import firebase console like: https://stackoverflow.com/a/55774552
  3. Download google-services.json and replace in android/app/google-services.json and rebuild the project.


来源:https://stackoverflow.com/questions/55774387/firebase-phoneauth-with-real-phone-number-is-not-working-but-whitelisted-number

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!