0

In my site, I am using a feature to display the state name (Eg:Texas) from where the person is browsing the website. I am using google geolocation api for that feature. It was working perfectly till two weeks ago. But now it is not working. When I searched the browser console, the error message is "Failed to load resource: the server responded with a status of 403 ()". The site is using http and not https.

Inorder to know whether the key is expired or not, I used another key with geolocation api enabled in it. But still I am getting the same error. I tried postman to know the result but it shows "error": {"errors": [{"domain": "usageLimits","reason": ipRefererBlocked", }

https://www.googleapis.com/geolocation/v1/geolocate?key=xxxx

I need to get the name of state from where the user is browsing the website.

Shawn Domingo
  • 1,371
  • 1
  • 11
  • 16
Jerrin
  • 1
  • 1

1 Answers1

0

According to the Google Maps Geolocation docs, there are 2 possible reason behind the 403 error, first is it might be because you have exceeded your daily limit, and second is you might have exceeded the request limit that you configured in the Google Cloud Platform Console. This limit is typically set as requests per day, requests per 100 seconds, and requests per 100 seconds per user. This limit should be configured to prevent a single or small group of users from exhausting your daily quota, while still allowing reasonable access to all users. See Capping API Usage to configure these limits.

Shawn Domingo
  • 1,371
  • 1
  • 11
  • 16
  • In the browser console, there is another warning that "getCurrentPosition() and watchPosition() no longer work on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS." So inorder to test this case, I enabled a flag in google chrome browser to consider "insecure origin as secure" and gave the url within that particular browser. After that the geolocation ip tool is working and showing the result. So I am more into a doubt that it is much related to HTTPS. – Jerrin Feb 07 '19 at 13:56
  • Can you share a [MCVE](https://stackoverflow.com/help/mcve) that reproduces the issue? – Shawn Domingo Feb 07 '19 at 23:12
  • I referenced the url from stackoverflow - https://stackoverflow.com/questions/40696280/unsafely-treat-insecure-origin-as-secure-flag-is-not-working-on-chrome – Jerrin Feb 08 '19 at 07:59