I have been trying to build a simple app to verify users using phone number through sending an OTP. However, I am keep getting this error and I clueless as to what to do.
Verification Failed: This app is not authorized to use Firebase Authentication. Please verify that the correct package name, SHA-1, and SHA-256 are configured in the Firebase Console. [ Invalid app info in play_integrity_token ]
I am using Flutter, Firebase CLI and Android Studio. Emulator : Google Pixel Fold API 35
I have tried reading threads here which dated a few years back but it didn't help.
NOTE: I have verified by SHA-1 and SHA-256 keys and they are correct. I have also added the debug token to the firebase console. I have enabled authentication and app check in the console and Google Play App Integrity API is also enabled in the google cloud platform.
This app only works if I add test numbers to the firebase console. It doesn't work when I try to get the OTP to a real number. What should I do?
Hello my fellow developers, After so much of research I have finally found the root cause for this error. Things to note:
If you are testing phone authentication+OTP with real numbers inside emulator, then it WON'T WORK.
If you want to test real phone numbers, you must connect to a real physical device that has a SIM in it.
In my case, I connected to my own phone using WiFi (Wireless Debugging). See below image.
https://i.sstatic.net/pziWRRRf.png
Make sure your computer, your physical device are connected to the same WiFi network. Also note: Your computer should not be connected to your physical device's hotspot. Your computer and your physical device(the phone) should be connected to another wifi network that has internet.
Then run the app and it should work fine. Mine does anyway. Hope this helps.