Reputation:
So I have implemented firebase phone Auth in my app so as soon as I request OTP it first goes to captcha page but then it returns and says this in log
This request is missing a valid app identifier meaning that neither SafetyNet checks succeeded. Please try again, or check the logcat for more details.
And in log cat I saw the following error
[SmsRetrieverHelper] SMS verification code request failed: unknown status code: 17093 null
So what is the issue here and what does the status code means?
Upvotes: 15
Views: 33770
Reputation: 81
if you are using Chrome, you need to disable storage partitioning features on the browser.
1- paste 'chrome://flags/#third-party-storage-partitioning' in search bar.
2- set 'third-party storage partitioning' to disable.
Upvotes: 0
Reputation: 8049
I spent the last 3 days figuring out what was happening with my project on Android. There were a lot of things wrong with the Firebase configuration in my project. I will list them and I hope this may help you guys.
ERRORS
I was using different accounts on the 3 ends (Firebase, Google Cloud and Google Play console). Google Cloud and Play console with 1 account and Firebase with another account. Please make sure to use the same account in the 3 sites.
I overconfigured everything. Example:
a) Limiting the credentials in Google Could (The basic auto-created by Firebase key without any change should be enough)
b) Enable unnecessary services like Google Play Integrity API
c) Install extra dependencies like: androidx.browser:browser:1.3.0
, com.google.android.play:integrity:1.3.0
, etc.
d) And whatever other option people in the forums said
Nothing against this, but I want to clarify that these are extra things that you can do for security, but in no way this is something mandatory for firebase auth with phone to work AT LEAST IN MY CASE
I had flavors in my project, which means you need to have folders for each flavor and put the Google service file in each folder. For example: I have 2 flavors (qa, prod) so I have 2 folders called qa
and prod
inside the android/app
directory each one with the same google service file since in my case I didn't want to have a different project in Fireabse for my qa env.
I created multiple projects and changed multiple times the Google service in my project without cleaning the project. It is mandatory to clean your project every time you change the Google Service file.
The minimum steps are
Create your project and specify the correct package.name of your android project. Follow the instructions for adding the google service to the project and put the firebase dependencies in the gradle file, etc. All the basic stuff that you all probably already know
Enable the Phone
authentication method in Firebase
Put correctly the SHA fingerprints. I finally found exactly what to do with the 3 pairs of sha1 and sha256 we normally have available when we configure Firebase with phone auth in the project.
SHA Fingerprint configuration
keytool -genkey -v -keystore debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000
.If you are just testing your app and want to test the functionality you only need to extract the SHA1 by running
keytool -list -v -keystore android/app/debug.keystore -alias androiddebugkey -storepass android -keypass android
and paste only the SHA1 in Firebase
IMPORTANT: I discovered that for testing locally the SHA1 is the only one that is required
Pair 2 (Google Play Console -> Setup -> App signing -> Upload key certificate section): These are the ones generated when you create a production .keystore file. The idea is not to explain this here, I'm assuming you already know why you can't use the debug.keystore to generate a prod build. For this case you need to put also in firebase the sha1 but also the sha256.
Pair 3 (Google Play Console -> Setup -> App signing -> App signing key certificate secton): It's basically the same with the pair 2, you need to add these to the firebase android project
And basically, this is it. With this config, it worked for me on Android. Fortunately, on IOS this is simpler
Upvotes: 0
Reputation: 464
first, you need to check whether the following options are enabled or not in your project
step 1:- in your firebase project check inside Authentication>>
Sign-in method Sign-in providers make sure that the phone sign-in was enabled like below Screenshot
step 2:- both keys were added to your firebase project SHA1 and SHA-256. like I add a screenshot below
step 3:- make sure that the Android Device Verification is enabled in google cloud. if not how to enable it inside the google cloud link is below
log in to the console and select the project. in the side navigation menu check in APIs&Services and select Enabled APIs&Services and click on Enabled APIs&Services after that search for android verification Click. on Android Device Verification and enable it.
so these are the major steps to keep in mind when implementing OTP verification in your app. I hope this answer is help full for you.🙂
Upvotes: 1
Reputation: 11
Its very important to follow the above 6 steps.
I had the same problem, I was clueless and then after carefully looking at my code I realised what was creating a mess for me. I guess its same for you too.
Use this when you want test your app with predefined phone numbers(testing): mAuth.getFirebaseAuthSettings().setAppVerificationDisabledForTesting(true);
Otherwise, if you are trying to test with real phone number disable the line and test. It should work.
Upvotes: 1
Reputation: 478
Adding up to @fred answer, be sure the SHA-1 and SHA-256 signatures are added to the console, but be sure which signatures you are adding, beacuse if it is a release version, you should get the SHA's from Developer Console, remember Google signs your app with a key stored on google servers.
Additional to this, I had to enable Safety Net on Firebase Console. Let me know if you manage to get everything working.
Upvotes: 0
Reputation: 385
I was getting the same error and I could solved it with the last two steps of the following (make sure you have covered all of them):
Upvotes: 21