Google Maps API 3 referrerNotAllowedMapError [英] Google Maps API 3 referrerNotAllowedMapError

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

问题描述

我对 Google Maps APi 并不陌生,并且已经使用它多年......但我被难住了.我已经安装了来自 Google Maps Javascript API:Simple Map 的最新代码示例的精确副本.然后我从 Google Developers Console 确认了我的浏览器和服务器密钥,添加了两种不同的引用方式(见下文).当我在控制台中将引用者设置为 * 通配符时,代码有效,但不能在生产中使用.

I'm no stranger to Google Maps APi, and have used it for years...but I am stumped. I've installed an exact copy of the latest code sample from Google Maps Javascript API: Simple Map. I then confirmed both my browser and server keys from Google Developers Console, added the refer two different ways(see below). Code works when I set the referer to * wildcard in console, but cannot use that in production.

这里是瘦:

  • 使用来自 Google Maps API Javascript(简单地图)的最新示例代码进行测试

  • tested using latest example code from Google Maps API Javascript (Simple Map)

YOURAPIKEYHERE - 替换为我帐户中的活动浏览器密钥

YOURAPIKEYHERE - replaced with an active browser key from my account

referer 被尝试作为 *./domain.ext/* 和 domain.ext/*

referer was tried as both *./domain.ext/* and domain.ext/*

还尝试了服务器密钥,将服务器 IP 作为允许的引用.

Also tried a server key, with server IP as allowed referer.

无法使用,但有效:使用浏览器密钥对允许的引用使用通配符,但我不能在生产中使用它...任何人都可以使用我的密钥我的一毛钱

CANNOT USE, BUT WORKED : used a wildcard for allowed referer using browser key, but I can't use that in production...anyone could use my key on my dime

嫌疑犯

由于密钥在我添加通配符时有效,但在引用域名时无效,因此看起来很可疑.这应该表明密钥有效,但引用信息没有传递给 Google.

Since the key works when I add a wildcard, but not with the referer domain name, it seems suspicious. This should indicate that the key works, but that the referer information is not getting passed to Google.

我的网站在 CloudFlare 后面.我的研究没有在任何地方找到任何答案,但我开始怀疑这是否可能是问题所在.其他似乎都不起作用.

My site is behind CloudFlare. My research is not finding any answers anywhere, but I'm beginning to wonder if this could be the issue. Nothing else seems to work.

推荐答案

解决方案:谷歌控制台专门为此显示了格式.但这是错误的.

SOLUTION: The google console specifically shows the format for this. But it is WRONG.

代替*./domain.ext/*使用:http://domain.ext/*

特别感谢谷歌提供糟糕的文档,特别感谢对我的问题投反对票的用户!

A special thanks to Google for crappy docs, and a very special thanks to the user that downvoted my question!

注意:根据您的设置,可能需要使用:http://www.domain.ext/*我没有测试这个,因为我的用例不包括 www.

Note: Depending on your setup, it may be necessary to use: http://www.domain.ext/* I did not test this as my use case excludes www.

这篇关于Google Maps API 3 referrerNotAllowedMapError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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