googlesamples / android-play-safetynet

Samples for the Google SafetyNet Attestation API
Apache License 2.0
287 stars 133 forks source link

Error: Network_Error: null #10

Open ksyamkrishnan opened 6 years ago

ksyamkrishnan commented 6 years ago

I took a pull and installed the app .

But when I verified the device response is Network_Error_null

JeppeLeth commented 6 years ago

I had the same issue. Turns out the API key I used was for a different project in the Google APIs Console

phileo commented 6 years ago

If you goto https://console.developers.google.com/apis/api/androidcheck.googleapis.com/overview and select your project in the upper left, you will see under the "Errors" section an http error code. In my case, I got a 403, which indicated that I had the same problem as @JeppeLeth . Once I passed in a valid API key to sendSafetyNetRequest() , I got the onSuccess() callback.

scorpeeon commented 6 years ago

I have the same problem. I found that it's indeed the API key that causes the issue: using a fully unrestricted API key works (as expected). But using one with the restriction: Android Device Verification API does not work, it produces the error: java.io.FileNotFoundException: https://www.googleapis.com/androidcheck/v1/attestations/verify?key=API_KEY

Shouldn't this work with the Android Device Verification API restriction? Do we really have to use unrestricted keys for this?

MunkyAlberto commented 6 years ago

Everything works as expected if the key has no restrictions, but I get this error when I enable the 'Android app' restriction with my package name and SHA-1 signature.

I can see 403 errors in the console.

Is this expected? An attacker could just deplete our quota if they get their hands on the API key.

harri35 commented 6 years ago

I have the same problem - is the restrictions are set, then I get 403 / ApiException 7. If no restrictions are set then everything works. I have the same API Key for GCM push also, works fine there.

ynagarjuna2012 commented 6 years ago

I have the same issue. Using a fully unrestricted key.

vishishttiwari commented 6 years ago

Make sure that you API is enabled. I was using the key without restrictions and it was not working until I realized that I had never enabled the APIs from the dashboard.

It will not work with restrictions because google has not implemented that. You can find this here: https://support.google.com/googleplay/android-developer/contact/safetynetqr

khalid64927 commented 6 years ago

I've suddenly started getting this issue, was working fine so far.

Trials

  1. tried with new API key (no restriction) same issue
  2. tried with different wifi and same issue
  3. tried new API key (no restriction) with deprecated SafetyNetApi and same issue

This we are getting in production and is high priority issue, anybody know why it is throwing NETWORK_ERROR all of sudden and is it happening for all new API Keys that is strange.

If it fails for one API key and not for other makes sense but this is weird.

parth9966 commented 6 years ago

Hello @khalid64927

Have you found the solutions about NETWORK_ERROR ?

khalid64927 commented 6 years ago

@parth9966 Nope

parth9966 commented 6 years ago

Hello @khalid64927

try this, Play services 15.0.1 to fix the Attest failures and let me know even success or fail. thanks

parth9966 commented 6 years ago

Hello @khalid64927 check #35 and #39

NETWORK_ERROR Solved !!!!

khalid64927 commented 6 years ago

@parth9966 I tried updating to 15.0.1 and gradle plugin 3.1.4 and wrapper to 4.4 still issue is reproducible in Google sample.

I think it also need code changes done by scotty

Do you have it working ?

I can see Scotty already uploaded to playstore working app but not merged code yet.

khalid64927 commented 6 years ago

@parth9966 Yup it's working with code changes

parth9966 commented 6 years ago

Hello Daviswliu,

Please refer below link, it will help you to solve the problem.

https://github.com/scottyab/safetynethelper/pull/39

you need to change below three things,

Gradle, SDK and play services version updates Play services version updates to 15.0.1 Hacked in the updated API calls and passed API key to attest

Thanks and Regards, Parth Kanthariya

On Thu, Sep 27, 2018 at 4:52 AM daviswliu notifications@github.com wrote:

@khalid64927 https://github.com/khalid64927 @parth9966 https://github.com/parth9966 I seemed to encounter the same problem you saw on Aug 27. I downloaded safetynethelper sample from https://github.com/scottyab/safetynethelper and it used to work in June and now it failed to run.

Updating to #39, the sample is able to get success for SafetyNet request and but fail for "Response validation". I used the same API KEY and made only change in sample/build.gradle by adding my API KEY to the double quotes in line String GOOGLE_VERIFICATION_API_KEY = "". The API key's restriction is none and its Activation status is "Enabled".

From Google APIs -> APIs & Services" ->Android Device Verification -> Metrics ->Methods, it reports Errors 100% Method Requests Errors Avg latency 99th percentile latency droidguard.attest.AndroidDeviceAttestationService.Attest 14 100% 0.011 seconds 0.03 seconds

Do I miss anything? Is there any Google SafetyNet support we can contact?

BTW, the downloaded safetynethelper from Play Store works well on the same Samsung phone.

I really appreciate any help.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/googlesamples/android-play-safetynet/issues/10#issuecomment-424902393, or mute the thread https://github.com/notifications/unsubscribe-auth/AJzRniDUcyzaHIDDLqJMwpqL9l-4VJm5ks5ufAw8gaJpZM4QRHwD .

daviswliu commented 6 years ago

It finally worked. Thanks.

Sent from Yahoo Mail for iPhone

On Wednesday, September 26, 2018, 10:06 PM, parth9966 notifications@github.com wrote:

Hello Daviswliu,

Please refer below link, it will help you to solve the problem.

https://github.com/scottyab/safetynethelper/pull/39

you can find

Thanks and Regards, Parth Kanthariya

On Thu, Sep 27, 2018 at 4:52 AM daviswliu notifications@github.com wrote:

@khalid64927 https://github.com/khalid64927 @parth9966 https://github.com/parth9966 I seemed to encounter the same problem you saw on Aug 27. I downloaded safetynethelper sample from https://github.com/scottyab/safetynethelper and it used to work in June and now it failed to run.

Updating to #39, the sample is able to get success for SafetyNet request and but fail for "Response validation". I used the same API KEY and made only change in sample/build.gradle by adding my API KEY to the double quotes in line String GOOGLE_VERIFICATION_API_KEY = "". The API key's restriction is none and its Activation status is "Enabled".

From Google APIs -> APIs & Services" ->Android Device Verification -> Metrics ->Methods, it reports Errors 100% Method Requests Errors Avg latency 99th percentile latency droidguard.attest.AndroidDeviceAttestationService.Attest 14 100% 0.011 seconds 0.03 seconds

Do I miss anything? Is there any Google SafetyNet support we can contact?

BTW, the downloaded safetynethelper from Play Store works well on the same Samsung phone.

I really appreciate any help.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/googlesamples/android-play-safetynet/issues/10#issuecomment-424902393, or mute the thread https://github.com/notifications/unsubscribe-auth/AJzRniDUcyzaHIDDLqJMwpqL9l-4VJm5ks5ufAw8gaJpZM4QRHwD .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.