google-maps-api-3 - Google API key - 什么是服务器 key 和浏览器 key

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

我在我的应用程序中使用谷歌地图,并使用以下格式的 URL,没有 API 键值,

<script type="text/javascript"
      src="https://maps.googleapis.com/maps/api/js?sensor=SET_TO_TRUE_OR_FALSE">
    </script>

现在我需要使用 API key 来跟踪请求,根据示例需要添加另一个 API key 查询字符串参数,
<script type="text/javascript"
      src="https://maps.googleapis.com/maps/api/js?key=API_KEY&sensor=SET_TO_TRUE_OR_FALSE">
</script>

但是,我收到了 2 把 key ,
一种用于服务器(IP地址限制)和一种用于浏览器应用(域级别限制)如下:

服务器 key :XXXX
浏览器 key :YYYY

我应该在我的应用程序中使用哪个键,我应该同时使用它们吗?找不到这方面的好文章。

最佳答案

这再次与 Google 刚刚弃用其 Web 服务 API 的浏览器 key 有关。

以下是当前定义:

Server keys

Create and use a server key if your application runs on a server. Do not use this key outside of your server code. For example, do not embed it in a web page. To prevent quota theft, restrict your key so that requests are only allowed from your servers' source IP addresses.

Browser keys

Create and use a browser key if your application runs on a client, such as a web browser. To prevent your key from being used on unauthorized sites, only allow referrals from domains you administer.



(来自https://developers.google.com/console/help/new/)

关于google-maps-api-3 - Google API key - 什么是服务器 key 和浏览器 key ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17715572/

相关文章:

android - 来自 LatLng 和 Radius 的 Google Places API LatLngBounds

javascript - Angular 2,与谷歌地图事件一起使用的子组件丢失上下文

javascript - 去除Google map 热图的光晕效果

android - 相机不跟随用户在谷歌地图中的当前位置

javascript - 我的 map 上没有获取 infoWindow

python - 使用 Google Maps API 获取企业名称

google-maps - Google Places API 结果与 Google map 不匹配

google-maps - 如何防止 Google Maps API v3 DirectionsService 生成的结果受到当前交通状况的影响?

android - 更改 Place Autocomplete Fragment 的前景色和背景色

ios - 适用于 iOS 的 Google Places API 与 Google Places Web 服务