Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 744
Noor Hossain Avatar asked Apr 20 '19 14:04

Noor Hossain


People also ask

How can I check if the phone number already exists in the Firebase authentication?

In the Firebase console, open the Authentication section. In the Sign in method tab, enable the Phone provider if you haven't already. Open the Phone numbers for testing accordion menu. Provide the phone number you want to test, for example: +1 650-555-3434.

How can I authenticate my mobile number?

In phone authentication, the user has to verify his identity with his phone number. Inside the app user has to enter his phone number after that he will receive a verification code on his mobile number. He has to enter that verification code and verify his identity. So this is how phone authentication works.

How do I change my Firebase phone number?

On the Firebase Console, select the "Phone" authentication provider and click on the "Phone numbers for testing" dropdown. Enter a new phone number (e.g. +44 7444 555666 ) and a test code (e.g. 123456 ).


2 Answers

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 -> 'Android' -> 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.

like image 174
Swati Avatar answered Oct 11 '22 15:10

Swati


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.

like image 24
Jack' Avatar answered Oct 11 '22 15:10

Jack'