Google 停用 Places Web 服务的引用限制 API 键

Google retires referrer-restricted API keys with Places Web Service

我最近收到一封来自 Google 的电子邮件,告诉我:

You are receiving this email because your project is using Places Web Service API with an API Key with HTTP referer restrictions. (...) starting January 31 2018 the Places Web Service API will no longer accept API Keys with HTTP Referer usage restrictions.

我的代码仅使用 Javascript 地图和地点 API,代码如

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

正在 API 中挖掘 Google 文档的 Javascript 位置,i found out that

Before using the Places library in the Google Maps JavaScript API, first ensure that the Google Places API Web Service is enabled in the Google API Console, in the same project you set up for the Google Maps JavaScript API.

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

我该如何处理这种情况?

抱歉造成混淆。

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

HTTP referer restricted API 键将继续为 Places Library 工作,它是地图 JavaScript API 的一部分: https://developers.google.com/maps/documentation/javascript/places

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

  • 路线服务
  • 距离矩阵服务
  • 海拔服务
  • 地理编码服务

我们有同样的问题。我们使用客户端 Places Autocomplete 库。这还会继续与 http referrer 限制一起使用吗?