提供的密钥不是有效的 Google API 密钥 [英] The key provided is not a valid Google API Key

查看:21
本文介绍了提供的密钥不是有效的 Google API 密钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到错误

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

我从 api-console 生成了一个 API,并将其用于我的本地/本地主机网站,但每次我都收到上述错误.如何在本地服务器上显示谷歌地图?

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.

首先,我假设您已经有一个 google map api 密钥.我认为您需要做的是转到 API Console - Google Code 并点击 API 访问 在左侧.您可以看到您的 api 密钥,在密钥下方,Referers: 显示您允许的引用者.你需要做的是点击Edit allowed referers... 然后添加

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

本地主机/*

允许的引用.

我正在使用 MAMP 来托管我的 html,我监控浏览器发送到 google 获取 api 的请求,我得到了这个标题:

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:

将 Referer 显示为 localhost/*

showing Referer as localhost/*

在您更改 Referer 后,Google 需要几分钟的时间来处理,但它对我来说效果很好.

It takes several minutes for Google to process after you changed your Referer but it works fine for me afterwords.

这篇关于提供的密钥不是有效的 Google API 密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆