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

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

问题描述

我对Google Maps APi并不陌生,并且已经使用了很多年......但我很难过。我已经安装了Google Maps JavaScript API最新代码示例的精确副本:简单地图。然后,我确认了Google Developers Console的浏览器和服务器密钥,并以两种不同的方式添加了引用(请参见下文)。代码适用于在控制台中将引用者设置为*通配符,但不能在生产环境中使用该引用。



以下是精简版:




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

  • * b $ b
  • 还尝试了服务器密钥,并将服务器IP作为允许引用者。

  • 不能使用,但工作:使用浏览器密钥为允许的引用者使用通配符,但是我无法在生产中使用它......任何人都可以在我的硬币上使用我的密钥


    可疑CULPRIT



    由于关键字在我添加通配符时起作用,但与引用者域名不同,似乎有些可疑。这个应该表明关键字有效,但是引用者信息不会传递给Google。



    我的网站位于CloudFlare的后面。我的研究并没有在任何地方找到答案,但我开始怀疑这是否会成为问题。没有其他东西似乎有效。



    < img src =https://i.stack.imgur.com/G2VSo.jpgalt =errormessages>

    解决方案

    div>

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



    而不是 *。/ domain.ext / *
    use: http://domain.ext/*



    特别感谢Google提供的蹩脚文档以及非常特别的感谢给用户降低了我的问题!



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


    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.

    Here's the skinny:

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

    • YOURAPIKEYHERE - replaced with an active browser key from my account

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

    • 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

    SUSPECTED CULPRIT

    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.

    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.

    Instead of *./domain.ext/* use: http://domain.ext/*

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

    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天全站免登陆