Javascript Google Map API 密钥错误“您的站点 URL 将被授权”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/37987037/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 20:56:41  来源:igfitidea点击:

Google Map API key error "Your site URL to be authorized"

javascriptcordovagoogle-api

提问by Kirankumar Dafda

I have searched many links and read documents related to google api key, but every time I am getting the only error of Your site URL to be authorized

我搜索了很多链接并阅读了与 google api 密钥相关的文档,但每次我都得到唯一的错误 Your site URL to be authorized

I am creating a PhoneGap hybrid applicationwhere I am not sure if which URL I have to pass to google api key referrer so I am stuck here

我正在创建一个PhoneGap 混合应用程序,我不确定是否必须将哪个 URL 传递给 google api 密钥引用,所以我被困在这里

What I am using for google script is:

我用于谷歌脚本的是:

<script src="https://maps.googleapis.com/maps/api/js?v=3&key=MY_API_KEY&sensor=false" type="text/javascript"></script>

Updated

更新

I have already created Browse Key using google console but now What I have to pass in referrer link ( ? ) while I am creating a cordova application

我已经使用谷歌控制台创建了浏览键,但现在我在创建cordova应用程序时必须传入引用链接(?)

enter image description here

在此处输入图片说明

采纳答案by Jonas Wilms

1.Leave it blank 2.You need to enable the google maps api for your project.

1.留空2.您需要为您的项目启用谷歌地图api。

回答by Mike Q

I Dont know if this will help anyone but I spent a good hour trying to figure out this problem and ended up realizing I had the wrong API enabled. You need Google Maps JavaScript API enabled.Also sometimes you need to specify https.

我不知道这是否会帮助任何人,但我花了一个小时试图找出这个问题,最终意识到我启用了错误的 API。您需要启用 Google Maps JavaScript API。有时您还需要指定 https。

回答by WerT

  1. You need to enable the google maps api for your project.

  2. if your API key have no limitation and it still not work - trying to add signed_in=trueto url. It helps for me.

  1. 您需要为您的项目启用 google maps api。

  2. 如果您的 API 密钥没有限制并且仍然无法使用 - 尝试添加signed_in=true到 url。它对我有帮助。