Google Maps JavaScript API v3 for Work UnauthorizedURLforClientIdMapError [英] Google Maps JavaScript API v3 for Work UnauthorizedURLforClientIdMapError

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

问题描述

我使用Google地图Web服务API进行工作,并且他们给了我一个客户端ID。当我加载主页面时,我没有收到错误。但是,当我单击一个子页面时,例如localhost:8080 / pages / page.xhtml,我会收到一个名为UnauthorizedURLforClientIdMapError的错误消息,指出该URL未被授权使用提供的Google Maps客户端ID。



作为参考,Google在其文档中对其进行了讨论: https://developers.google.com/maps/documentation/business/clientside/auth#registering_authorized_urls



尽管如此, ,我目前正在使用URL http:// localhost:8080 使用TomCat测试我的服务器。这个域名已被授权,我的个人IP也是如此。在我的视图文件中,我添加了这个:

 < script src =https://maps.googleapis.com / maps / api / js?& amp; amp; client = MY_CLIENT_ID 
& amp; v = 3.19
& amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp& ;

其中'MY_CLIENT_ID'和'MY_CHANNEL'显然会更改以适应我的需求(我的客户端ID和频道是正确的)。我已经通过堆栈溢出进行了搜索,并阅读了所有相关的Google文档,但我觉得我错过了一些非常小的东西(或者很大,我希望不会)。

发生了什么?

解决方案

使用Google Maps for Work和ClientID的每个网址必须经过授权才能使用clientid。



您可以找到所有详情这里。但这是总结:



  • 域名或IP地址不一定要公开访问 li>
  • 指定域的所有子域也都是授权的。

  • 授权路径的所有子路径也都是授权的。 >路径区分大小写。

  • 您可以限制使用特定端口的URL。

  • HTTP和HTTPS协议被视为不同的URL。 li>

如果您收到 UnauthorizedURLForClientIdMapError ,请查看URL授权规则并看看你是否只需要将URL添加到授权URL列表。



顺便说一句,这里是 Google Maps API错误代码和解释。


I'm using Google Maps Web Services API for work, and they've given me a client ID. When I load up the main page, I don't get an error. However, when I click a sub-page, eg localhost:8080/pages/page.xhtml, I get an error called UnauthorizedURLforClientIdMapError, with the message that this URL is not authorized to use the provided Google Maps client ID.

For reference, Google discusses it in its documentation here: https://developers.google.com/maps/documentation/business/clientside/auth#registering_authorized_urls

With all that being said, I'm currently testing my server with TomCat using the URL http://localhost:8080. This domain has been authorized, as has my individual IP. In my view files, I'm adding this:

<script src="https://maps.googleapis.com/maps/api/js?    &amp;client=MY_CLIENT_ID
        &amp;v=3.19
        &amp;channel=MY_CHANNEL" type="text/javascript"></script>

where 'MY_CLIENT_ID' and 'MY_CHANNEL' are obviously changed to suit my needs (my client id and channel are correct). I've searched through stack overflow and also read all of the relevant Google Documentation but I feel like I'm missing something very small (or large, I'd hope not though).

What's going on?

解决方案

Each URL that uses Google Maps for Work with the ClientID must be authorized to use that clientid.

You can find all the details here. But this is the summary:

  • The domain name or IP address does not have to be publicly accessible
  • All subdomains of a specified domain are also authorized.
  • All subpaths of an authorized path are also authorized.
  • Paths are case sensitive.
  • You may restrict valid URLs to those using certain ports.
  • HTTP and HTTPS protocols are considered different URLs.

If you are getting the UnauthorizedURLForClientIdMapError, look through the URL authorization rules and see if you simply need to add the URL to the list of authorized URLs.

Btw, here is the the list of Google Maps API Error Codes with explanations.

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

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