dapriett / nativescript-google-maps-sdk

Cross Platform Google Maps SDK for Nativescript
MIT License
244 stars 164 forks source link

Google Maps API platform restriction not working #412

Open Kristoffer-Axelsson opened 4 years ago

Kristoffer-Axelsson commented 4 years ago

Hi,

According to best practice regarding Google Maps API credentials, I tried to set a restriction based on platform using package name for iOS and packagename + sha1 thumprint for Android. No matter what we try, it does not seem to work. We have also tried to emulate a native app device by sending the headers similar to this article https://stackoverflow.com/questions/33989062/restricting-usage-for-an-android-key-for-a-google-api but to no avail, like this:

httpWebRequest.Headers["x-android-package"] = "packageName"; httpWebRequest.Headers["x-android-package"] = "signature";

We also tried using "X-Android-Cert" as request header, but it didn't work.

But no matter what we do, we get this error message: { JS: "error_message": "This IP, site or mobile application is not authorized to use this API key. Request received from IP address 82.103.78.249, with empty referer", JS: "results": [], JS: "status": "REQUEST_DENIED" JS: }

Is this an issue with the Google Maps nativescript SDK or nativescript itself? Anyone else having this issue? Ahead of golive of new features using Google Maps API to production I really feel that having the platform restriction in place would be the best, any help is greatly appreciated!

Regards Kristoffer

tommag21 commented 2 years ago

Hi @Kristoffer-Axelsson,

sorry for bumping this issue almost two years later but I am facing the same issue with great urgency on Android. Have you managed to solve this?


EDIT:

I found the problem, I entered the fingerprint of the upload key certificate instead of the signing key certificate generated by Google.