问题描述
我收到错误
Google已禁止在此应用中使用Maps API。提供的密钥不是有效的Google API密钥,或者未获得此网站上Google Maps JavaScript API v3的授权。如果您是此应用程序的所有者,则可以在此处了解如何获取有效密钥:https://developers.google.com/maps/documentation/javascript/tutorial#Obtaining_Key
我从api-console生成了一个API,并将其用于本地/本地主机网站,但是每次遇到上述错误。如何在本地服务器上显示Google地图?
我今天有类似的问题,我想我解决了它。
首先,我假设您已经拥有Google地图API密钥。我认为您需要做的是去并点击 API访问
在左边。你可以看到你的API密钥,并在 Referers:
键下面显示你允许的查阅者。你需要做的是点击 Edit允许查阅者...
,然后添加
添加到允许的查阅者。
MAMP来托管我的html,并且我监视了我的浏览器发送给api的请求,并且我得到了这个标题:
显示Referer为 localhost / *
在您更改Referer后,Google需要几分钟的时间才能处理,但对于我而言,这很适用。
I am getting error
Google has disabled use of the Maps API for this application. The provided key is not a valid Google API Key, or it is not authorized for the Google Maps Javascript API v3 on this site. If you are the owner of this application, you can learn about obtaining a valid key here: https://developers.google.com/maps/documentation/javascript/tutorial#Obtaining_Key
I have generated an API from api-console and using it for my local/local-host website but each time I am getting the above error. How can I show google maps on my localserver?
I have the similar problem as you today and I think I solved it.
First I am assuming that you have a google map api key already. I think what you need to do is to to go API Console - Google Code and click on API access
on the left. You can see your api key and just below the key, Referers:
shows your allowed referers. What you need to do is click Edit allowed referers...
and then add
to allowed referers.
I am using a MAMP to host my html, and I monitor the request my browser sent to google for api and I get this header:
showing Referer as localhost/*
It takes several minutes for Google to process after you changed your Referer but it works fine for me afterwords.
这篇关于提供的密钥不是有效的Google API密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!