SirLouen
SirLouen

Reputation: 142

Google Maps API is never satisfied

If I use URL referrer authentication with Geocoding API it says:

There was an error while trying to fix the Venues geolocation information: API keys with referer restrictions cannot be used with this API.

Which after research I find that this means that Google Maps is looking for IP address authentication.

But if I use IP address authentication with Javascript Maps API it says:

JavaScript API error: RefererNotAllowedMapError

https://developers.google.com/maps/documentation/javascript/error-messages#referer-not-allowed-map-error Your site URL to be authorized: https://example.com

What can be going on?

How can I fully satisfy the good ol'Google Maps?

Upvotes: 2

Views: 1039

Answers (2)

Ann
Ann

Reputation: 11

I know this is 3 months old now. But I had the same problem and I found out how to solve this.

As evan said, you need 2 API Keys. And annoyingly, The Events Calendar only have one field for the API Key. BUT, I found a link here: https://support.theeventscalendar.com/ to https://support.theeventscalendar.com/716190-Using-Google-Maps-API-Key-Restrictions. The page redirects though... But I managed to screen shot parts of it before it redirects and found this snippet: https://gist.github.com/cliffordp/a2ec320313afbc1ffb5f0e5ac654b7fb (I changed the code to use a define instead because I don't want my API key in git)

This filter will make it possible to have two API KEYS.

Upvotes: 1

evan
evan

Reputation: 5691

It looks like you're using two different Maps APIs; the client-side JavaScript API and the server-side Geocoding API web service. This means you need 2 API keys; one restricted with HTTP referrers for client-side use, and the other one restricted by IP address for web services only.

To learn more on how API key restrictions work check out Google's documentation on API key best practices.

Hope this helps!

Upvotes: 3

Related Questions