gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 10:27:43 25 4
gpt4 key购买 nike

我在我的应用程序中使用谷歌地图,并使用以下格式的 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com