简体   繁体   English

Google Maps Javascript API v3错误消息“密钥已禁用”

[英]Google Maps Javascript API v3 Error Message “Key is Disabled”

I have generated a Google Maps Javascript API v3 key for my website treblecode.com, and have added www.treblecode.com to the list of referrers on my developer account. 我已经为我的网站treblecode.com生成了Google Maps Javascript API v3密钥,并将www.treblecode.com添加到了我的开发者帐户的引荐来源列表中。 I've also tried .treblecode.com/ to no avail. 我也尝试过.treblecode.com /无济于事。

However, in attempting to create a test HTML page according to the Hello World guidelines at developers.google.com/maps/documentation/javascript/tutorial#api_key, I receive the following error: 但是,尝试根据developers.google.com/maps/documentation/javascript/tutorial#api_key上的Hello World准则创建测试HTML页面时,出现以下错误:

"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#api_key " “ Google已禁止对此应用程序使用Maps API。提供的密钥不是有效的Google API密钥,或者未获得该网站上Google Maps Javascript API v3的授权。如果您是此应用程序的所有者,则您可以在此处了解有关获取有效密钥的信息: https : //developers.google.com/maps/documentation/javascript/tutorial#api_key

Below is the code I currently have on my test page at http://www.treblecode.com/apis/quickmap.html : 以下是我当前在测试页上位于http://www.treblecode.com/apis/quickmap.html上的代码:

  <!DOCTYPE html>
    <html>
      <head>
        <style type="text/css">
          html, body, #map-canvas { height: 100%; margin: 0; padding: 0;}
        </style>
        <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=REDACTED">
        </script>
        <script type="text/javascript">
          function initialize() {
            var mapOptions = {
              center: { lat: -34.397, lng: 150.644},
              zoom: 8
            };
            var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
          }
          google.maps.event.addDomListener(window, 'load', initialize);
        </script>
      </head>
      <body>
    <div id="map-canvas"></div>
      </body>
    </html>

If it helps, my hosting provider is GoDaddy.

Any help would be appreciated here, as I'm not sure what else I need to do to properly work with that API. 在这里将获得任何帮助,因为我不确定要与该API配合使用还需要做什么。

EDIT 27 july 2016 编辑 2016年7月27日

So, I said this at a time, not long ago, when this was true. 因此,我是在不久前的某个时候说这句话的。 It is not true anymore. 不再是真的。 Websites that were working perfectly in may 2016, stopped working suddenly. 2016年5月运行正常的网站突然停止工作。

So please disregard the text you see below. 因此,请忽略下面显示的文字。


You don't need the key. 您不需要钥匙。 Just load " https://maps.googleapis.com/maps/api/js " 只需加载“ https://maps.googleapis.com/maps/api/js

The Emmanuel's answer is outdated. 伊曼纽尔的答案已经过时。

From June 22nd, 2016. Google requires an api key for Google Maps 从2016年6月22日开始。Google需要Google Maps的api密钥

  1. You have to go to Google Console and create a new project. 您必须转到Google控制台并创建一个新项目。
  2. Credentials > Create credentials > API Key 凭证>创建凭证> API密钥

I'm not sure, how it resolved but I did the below steps, it worked. 我不确定如何解决,但是我按照以下步骤进行了工作。

  1. Go to https://console.developers.google.com/project/ 前往https://console.developers.google.com/project/
  2. Created a new project and named it 创建一个新项目并将其命名
  3. Go to "APIs & Auth" --> Push menu and add your domain name 转到“ API和身份验证”->推菜单并添加您的域名

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM