0
votes

The google maps request is going to the Google Maps Api (javascript). But I am getting this error message

And yes the google maps api is enabled and I have generated a key that I am using in my code. But getting this error "This API project is not authorized to use this API", screenshot below

error

4

4 Answers

2
votes

According to the recent changes announced on June 22, 2016

We now count Google Maps JavaScript API client-side requests towards the daily limit of the associated web service API.*

http://googlegeodevelopers.blogspot.com.es/2016/06/building-for-scale-updates-to-google.html

That means you have to enable Geocoding API in your project if you use geocoding service of Maps JavaScript API. If you use places library, you have to enable Places API and so on.

1
votes

I am having this problem as well, but only on some pages within my site - on other pages, it works fine. All the pages which use the maps API use it in exactly the same way, via a shared javascript library.

I compared the network calls on pages with and without the error, and they appear to be 100% identical except for the Referrer URL (https://site.url/page/that/works vs. https://site.url/page/that/fails).

I have https://site.url in the "Accept requests from these HTTP referrers" list, and this functionality used to work on all the pages! It stopped working recently, perhaps as recently as this weekend, yesterday, or today.

0
votes

Are you appending the maps script by hand on your website, or using a plugin? Can you send here your website URL? Anyway, here it is how to append the API key: Let's assume that you have the following piece of code

<script async defer src="//maps.googleapis.com/maps/api/js" type="text/javascript"></script>

To append the apy key, you must add ?key=YOUR_API_KEY at the end of the src path, like this:

<script async defer src="//maps.googleapis.com/maps/api/js?key=YOUR_API_KEY" type="text/javascript"></script>

If, instead, your src path already has some appended parameters (for example, "//maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"), just add &key=YOUR_API_KEY at the very end: "//maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&key=YOUR_API_KEY" This is how you append the API parameter (obviously, replace YOUR_API_KEY with your API key code).

You can find more information on obtaining a google maps key at https://developers.google.com/maps/documentation/javascript/get-api-key

Your API key should be up and running within 5 minutes. Enjoy!

0
votes

To make it work we need to use Google Maps Geocoding Api and Google Maps Javascript Api I was unfortunately using only the javascript one. It's working fine now.