Anajaleena Oliver
Anajaleena Oliver

Reputation: 121

What are the exact steps to enable safetynet device check api on Android

I have integrated firebase phone authentication in my android app. It was working fine for almost 2 months and suddenly from 2-3 days back I am observing different behavior.

Capcha screen started appearing. Earlier I had not enabled safetynet device check API. Looking at firebase documentation I treid enabling safetynet device check.

As the steps are not clear, I am not sure if I did it right. I am also not clear how firebase and google cloud are linked. How firebase will know which google cloud project to link to..

Earlier the flow was ... Phone authentication->receive SMS->auto verify SMS and user is logged in. Now the flow is ... Phone authentication-> Captcha screen appears (kind of web page is loaded)... -> after sometime the captcha screen closes on its own -> SMS received -> login with OTP verification.

Let me know how to avoid the captcha screen. I am sure I will lose many users if capcha screen comes in between.

Upvotes: 9

Views: 16506

Answers (3)

gowtham6672
gowtham6672

Reputation: 1068

Step 1:Go to your Google cloud console with this link ,enable Android Device Verification for your project.

Step 2: add SHA-256 fingerprint in your firebase.do so from the Settings Page of the Firebase console.Download and replace the latest google-services.json file

Upvotes: 11

Sehrish Waheed
Sehrish Waheed

Reputation: 1555

  1. Go to Google cloud console select your project and enable Android Device Verification google cloud console

  2. Go to your project dir and paste this

cd android && ./gradlew signingReport

  1. Copy SHA256 and SHA1 from Task :app:signingReport only

  2. Go to firebase console go to your poject -> Project settings -> Select your app -> Click on Add fingerprint and paste your SHA256 and then SHA1

Upvotes: 2

Himanshi Thakur
Himanshi Thakur

Reputation: 2299

As per firebase the reCAPTCHA flow will only be triggered:

a. When SafetyNet is unavailable.

b. If the user does not have Google Play Services support.

c. When you are testing your app on an emulator.

d. Your device does not pass suspicion checks (if your device bootloader is unlocked or device is rooted )

To enable SafetyNet follow below steps or you can also visit Firebase Auth for more info.

  1. Go to google cloud console , select your project .

  2. Click on navigation menu and select APis & services and then select Dashboard .

  3. Click on enable api and services and enable api " Android Device Verification".

  4. Add SHA 256 in firebase project settings.(debug and release both)

  5. Download and replace the latest google-services.json file in your project.

Upvotes: 6

Related Questions