Google API密钥 - 什么是服务器密钥和浏览器密钥 [英] Google API keys - What is server key and browser key

查看:613
本文介绍了Google API密钥 - 什么是服务器密钥和浏览器密钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在我的应用中使用Google地图,并使用以下格式的网址,而无需使用API​​键值。

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

现在我需要使用API​​密钥跟踪请求,根据需要添加的示例另一个API键查询字符串参数,

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

但是,我收到了2个密钥,
一个用于服务器(IP地址限制)对于浏览器应用程序(域级限制)如下:

服务器密钥:XXXX
浏览器密钥:YYYYY



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

解决方案

尝试浏览器键,找到了这篇文章,但它写在2012年, / p>

https ://groups.google.com/forum/#!topic / android-gcm / Ir-dNtPRKcU



在网上找到这个:
2.点击创建新的服务器密钥,服务器密钥或浏览器密钥都可以工作,使用服务器密钥的好处是它允许您将IP地址列入白名单,出现以下屏幕:



http://developer.android.com/google/gcm /gs.html



希望这会对你有所帮助!


I ma using google maps in my app, and use the URL as following format without the API key- values,

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

Now I need to use the API key to track the requests, according to the examples it needs to add another API key query string parameter,

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

But, I received 2 keys, One for servers (IP address restrictions) and one for browser apps (domain level restrictions) are as follows:

Server Key: XXXX Browser Key: YYYYY

Which key should I use in my app, should I use both of them? Could not find a good article on this.

解决方案

Try the browser key, found this post, but it's written on 2012,

https://groups.google.com/forum/#!topic/android-gcm/Ir-dNtPRKcU

Found this on web: "2.Click Create new Server key. Either a server key or a browser key should work. The advantage to using a server key is that it allows you to whitelist IP addresses. The following screen appears:"

http://developer.android.com/google/gcm/gs.html

Hope this will help you!

这篇关于Google API密钥 - 什么是服务器密钥和浏览器密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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