Google Geocoding API - REQUEST_DENIED

Obviously, I don’t need a “Maps API key” to use the “Google Geocoding API” according to:

http://code.google.com/apis/maps/documentation/geocoding/index.html

However, I get this:

{ "status": "REQUEST_DENIED", "results": [ ] } 

Does this mean that my IP is blocked? What can I do to overcome this?

+50
google-app-engine google-maps-api-3
Jul 09 '10 at 12:30
source share
12 answers

Until the end of 2014, the common source of this error did not indicate the required parameter sensor from the request, as shown below. However, as of 2014/12/31 or earlier, this is no longer required:

Sensor parameter

The Google Maps API previously required you to enable a sensor parameter to indicate whether your application used a sensor to determine a user's location. This parameter is no longer required.




Did you specify the sensor parameter in the request?

"REQUEST_DENIED" indicates that your request was rejected, usually due to a lack of a sensor parameter.

Sensor (required) - Indicates whether a geocoding request is being requested from a device with a location sensor. This value must be true or false.

+72
Jul 09 2018-10-09T00:
source share
— -

Remove the API key parameter and its value.

eg. https://maps.googleapis.com/maps/api/geocode/json?address=[YOUR ADDRESS]&sensor=true

+19
Oct 24
source share

I found that in my case, calling a service without a secure protocol (value: http) after adding the key = API_KEY causes this problem. The transition to https decided.

+18
Mar 23 '15 at 8:25
source share

If you just copy and paste the URL of the example that Google gives on its website http://maps.google.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View, + CA & sensor = true_or_false it will not work due to an incorrect sensor parameter. You should change it to true or false, and not what they wrote. Perhaps this is a mistake that you had, as it happened to me ...

+10
Jul 21 '11 at 16:11
source share

I noticed that you also get REQUEST_DENIED for some addresses if you are not correctly encoding the url url. For example, in

123 Main St #B, Mytown, CA 94110

character '#' must be encoded as% 23

+10
Jul 19 2018-12-17T00:
source share

For anyone looking for this page in 2017 or beyond, like me

The sensor is no longer required, I tried and got an error:

SensorNotRequired

I just needed to activate the Google Maps geocoding API , which is now necessary.

Hope this helps someone like me.

+8
Jun 19 '17 at 16:45
source share

I had this problem and realized that I was assuming that Geocoding comes with the JS API. However, this is a separate API that I have not included in the cloud console. The inclusion of this is fixed right away.

+7
Sep 08 '17 at 22:27
source share

Sucking Google does not allow you to prevent your service from being enabled by this account. First try turning it on. Go here https://console.developers.google.com/project and create a new project with the place service turned on, this may solve your problem.

+4
Mar 19 '14 at 5:54
source share

I also had this problem using the Drupal 7 Location module. The result of this error was the auto-complete of all empty spaces. Making one of the requests to the api address manually led to this error in the returned JSON:

"Browser API keys cannot have restrictions on links when used with this API."

The solution to the problem was easy: create a new key without any restrictions and use it only for geocoding.

Note for new google api keys: by restrictions, they imply limiting requests using the api key for certain domains / subdomains. (for example, only the request http://yourdomain.com is allowed).

+3
Jun 19 '16 at 11:50
source share

For those struggling with this problem, I just found out that the geocoding API cannot be used with API keys that have referrer restrictions. Just remove all restrictions of referrals, and everything will be fine.

If you use any other APIs that allow the use of keys with referrer restrictions (for example, the JS Maps API), it is probably best to create a second key without restrictions, which will be used exclusively for geocoding, as other APIs can display your key publicly, and someone else can start using it on their site.

+3
Apr 10 '18 at 17:17
source share

As you say, this may mean that your IP address has been blocked. I would make sure that you specify the key parameter in the query string for the geocoding API request.

https://maps.googleapis.com/maps/api/geocode/xml?sensor=false&address=Placename&key=XXxxxXXxXxxxxXXxx

Also make sure that if you set the IP address limits in the developer console, you specified the correct IP address, just click on the project in the list and you will see the allowed IP addresses.

Example of project list in Google Developer Console

If you still run into problems, you might want to print the values ​​of the status and error_message from the Google answer, you will see something like this:

REQUEST_DENIED - This IP, site or mobile application is not authorized to use this API key. Request received from IP address 123.4.5.678, with empty referer

If it does not mention the IP address restriction, it can give you enough information about the problem to fix it on Google.

+2
Jan 24 '18 at 11:42
source share

Google is returning a very useful error message that helps fix the problem!

 Dim Request As New XMLHTTP30 Dim Results As New DOMDocument30 Dim StatusNode As IXMLDOMNode Request.Open "GET", "https://maps.googleapis.com/maps/api/geocode/xml?" _ & "&address=xxx", False Request.Send Results.LoadXML Request.responseText Set StatusNode = Results.SelectSingleNode("//status") Select Case UCase(StatusNode.Text) Case "REQUEST_DENIED" Debug.Print StatusNode.NextSibling.nodeTypedValue ... 

Sample Error Messages

Message 1: Requests for this API must be through SSL. Download the API using "https: //" instead of "http: //".

Message 2: The server rejected the request: You must use the API key to authenticate each request to the Google Maps Platform API. For more information, please ...

0
Jan 30 '19 at 21:38
source share



All Articles