【问题标题】:Google retires referrer-restricted API keys with Places Web ServiceGoogle 使用 Places Web Service 停用受推荐人限制的 API 密钥
【发布时间】:2018-04-18 17:11:37
【问题描述】:

我最近收到了一封来自 Google 的电子邮件,通知我:

您收到这封电子邮件是因为您的项目正在使用 Places Web 具有 API 密钥的服务 API,具有 HTTP 引用限制。 (...) 从 2018 年 1 月 31 日起,Places Web 服务 API 将不再 接受具有 HTTP Referer 使用限制的 API 密钥。

我的代码只使用了Javascript Maps and Places APIs,代码如

new google.maps.places.AutocompleteService();
new google.maps.places.PlacesService(document.createElement("div"));

深入了解用于 Javascript 文档的 Google Places API,i found out that

在使用 Google Maps JavaScript API 中的 Places 库之前, 首先确保在 Google API 控制台,在您为 Google 地图设置的同一个项目中 JavaScript API。

所以我不确定在那里做什么。 我使用 http 引用限制键来使用 Google Maps JS API,这是正确的并且不被弃用。但是,Google Maps JS API 本身使用 Places API Web Service,我不能使用 http referer 限制键。

我应该如何处理这种情况?

【问题讨论】:

  • 如果您不使用任何网络服务 Places API 请求并且仅使用 Maps JavaScript API 的地点库,我相信该服务应该可以不间断地工作。虽然我建议直接通过 Google 进行检查,但请在 Google issue tracker 中提交错误
  • 感谢您的评论。如果他们不在这里闲逛,我会这样做。 Stackoverflow 是他们在开发者控制台中提供的第一个帮助资源,所以我假设他们就在身边,他们的见解会对其他用户有益。

标签: javascript google-maps-api-3 google-places-api


【解决方案1】:

很抱歉给您带来了困惑。

我查看了您目前的情况,发现您不需要更新 API 密钥。

HTTP 引用限制 API 密钥将继续为 Places Library 工作,这是 Maps JavaScript API 的一部分: https://developers.google.com/maps/documentation/javascript/places

如果您直接将 Places API 与密钥一起使用,HTTP 引用限制 API 密钥将停止工作。它将继续为 Maps JavaScript API 工作,包括 Places Library 和 Services: https://developers.google.com/maps/documentation/javascript/directions

  • 路线服务
  • 距离矩阵服务
  • 高程服务
  • 地理编码服务

【讨论】:

  • 感谢您的澄清。不过我很好奇,你是如何找到我的具体情况的?我没有留下任何个人信息? :o
【解决方案2】:

我们有同样的问题。我们使用客户端 Places Autocomplete 库。这是否也适用于 http 引荐来源网址限制?

【讨论】:

    猜你喜欢
    • 2017-02-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-14
    • 1970-01-01
    • 1970-01-01
    • 2013-09-09
    • 1970-01-01
    相关资源
    最近更新 更多