在开源项目中包含 Google 地图 API 密钥吗?
是否可以将您的 Google 地图 API 密钥放入源代码中并发布?
其他人可能会获取并滥用它,但我不希望每个开发人员/用户都获得自己的 API 密钥并将其输入到某个地方。 如果密钥所有者负责,我应该为该项目创建一个新的 Google 帐户吗? (该项目是 Objective-C 中的桌面应用程序和一个小型开发人员工具。)
让这变得方便的最佳方法是什么?
Is it okay to put your Google Maps API Key into your source code and publish it?
Others could take it and misuse it, but I don't want every developer / user to get their own API key and type it in somewhere. If the owner of the key is responsible, should I create a new Google account for the project? (The project is a desktop application in Objective-C and a small developer tool.)
What would be the best way to make this convenient?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为这是不合法的,但即使是合法的,这在技术上也是不可能的,因为 Google 地图 API 密钥与您的域名绑定在一起。 Google 将检查 HTTP 请求的引荐来源网址以验证密钥。
无论如何,密钥并不是秘密:只需使用 Google 地图查看网站的来源即可揭示 API 密钥。
I don't think it's legal, but even it were, it's technically impossible, because the Google Maps API Key is tied to your domain name. Google will check the referrer of the HTTP request to validate the key.
The key isn't secret anyway: simply viewing the source of a website using Google Maps reveals the API key.