javascript - getting error using google maps api : This API project is not authorized to use this API - Stack Overflow

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

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

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

Share Improve this question edited Jun 8, 2019 at 23:08 Thufir 8,49736 gold badges133 silver badges287 bronze badges asked Jun 27, 2016 at 11:00 Aurobindo ParidaAurobindo Parida 111 gold badge1 silver badge2 bronze badges
Add a ment  | 

4 Answers 4

Reset to default 2

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..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.

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 pared 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.

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./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./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./maps/api/js?v=3.exp&sensor=false"), just add &key=YOUR_API_KEY at the very end: "//maps.googleapis./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./maps/documentation/javascript/get-api-key

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

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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744843815a4596715.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信