Google Maps API Error: This API key is not authorized to use this service or API. Places API error: ApiTargetBlockedMapError
Asked Answered
B

2

8

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?

Bojorquez answered 18/4, 2020 at 18:22 Comment(0)
D
22

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.

Delacruz answered 11/8, 2021 at 20:32 Comment(4)
Worked perfectly!Axial
Key Restrictions!Jewell
It would be nice if the error said which API the key is trying to access...Garin
that's fine, this solution save my dayZama
B
7

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

Bojorquez answered 18/4, 2020 at 22:15 Comment(1)
Same. Thanks for mentioning.Obelize

© 2022 - 2025 — McMap. All rights reserved.