I am trying to use Address2Geo and getting  (403) Forbidden
Question

When I call the Google Geo API I am getting a "403 Forbidden" error.

My first question is where does the API get my API Key? It does not ask for it in the Server call.

From Google Maps

Example of error conditionStatus code
The request includes an invalid parameter, or a required parameter is missing. For example, the size parameter is not within the expected range of numeric values, or is missing from the request.400 BAD REQUEST
The API key included in the request is invalid.403 FORBIDDEN


Any help would be appreciated.

Anthony


Hi Anthony,

From all what I have got to observe from that image and Google API Documentation, Kindly give a try giving the google API key for the Sensor parameter...Hope it helps!!

Thanks for the suggestion, but but that did not  work.

I put the key in the address field "&key=..." and it may have helped.

My response changed from Forbidden to REQUEST_DENIED.

I saw one post that implied that this may be referring to where the service is called from (client or server).

Any thoughts?

Hi Anthony, that component is from 2017 and before, made using an Extension and C#.

Although I couldn't find a specific REST implementation for the GeoCodeAPI I do have a demo that uses it, so you can see how it was implemented.

Check out the Uber Address component.

It is also old (2017) and probably outdated but it does use REST.

Hope this helps


Cheers

Hi Anthony,

I opened up the component in Visual Studio and see no reference to the api key variable so google probably added that requirement since the creation of the component.  However, the way the address is appended to the URL, you can inject "&key=xxx" at the end of your address string and it would normally work. BUT I spotted another issue in that google requires SSL now too and the base URL string sent to the api starts with http only so this will need to be adjusted in the component. 

As an alternative (and probably more flexible for now) you can just create a REST call to the URL endpoint with your parameters like this: https://maps.googleapis.com/maps/api/geocode/xml?address={address}&sensor={sensorBool)&key=YOURKEY and parse as a normal rest call which I found to be working

If using that component is inevitable you can proceed with @Jon Sullivan 's suggestion,else you can be using latest components that has got all the latest supportive features!!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.