1
votes

I've started getting this error from a Google Maps widget within a CMS I use:

This API key is not authorized to use this service or API. Places API error: ApiTargetBlockedMapError

The error message provides a helpful link to this page, which includes the following text:

ApiTargetBlockedMapError Error

The Maps JavaScript API has not been authorized for the used API key. Please check the API restrictions settings of your API key in the Google Cloud Platform Console.

See API keys in the Google Cloud Platform Console. For more information, see Using API Keys.

I know Google has tweaked this API in the past, so I went to the console and checked the permissions given for the key I am using. It includes these four permissions, include the Maps JavaScript API permission:

  • Geocoding API
  • Maps Embed API
  • Maps JavaScript API
  • Maps Static API

The only part not working is the address auto-complete. When I change to Don't Restrict Key mode so the key works with all services, it works fine. Any idea which service checkbox I might be missing? I'm wondering if Google is just displaying the wrong error.

Any ideas?

2

2 Answers

2
votes

It turns out that Google has tweaked their permissions settings without updating the error. I had to give access to the Places API as well for the autocomplete to function.

I've submitted a PR to the CMS widget's documentation: https://github.com/Frojd/wagtail-geo-widget/pull/59/files

1
votes

This is what I did. Updated.

  1. Make sure you have enabled all the next Google Maps Services enter image description here

  2. If you have key restrictions, make sure you add the services like the next image.enter image description here.

  3. Restart the project. It worked.