ios - iOS 应用程序的 Google Cloud Platform API key 限制如何运作?

标签 ios google-maps-api-3 google-cloud-platform google-translate google-speech-api

根据:

https://cloud.google.com/speech/docs/common/auth

我们可以为 GCP 资源(例如谷歌地图、语音、翻译)创建一个 API key ,这些资源受“iOS 应用程序”限制为特定的包 ID。原则上这很好,但 GCP 如何实际实现这一点? GCP 如何确定客户端的包 ID,因为只有客户端只向 GCP 发出标准 HTTP 请求——大概它不会在 header 中报告其包 ID?

我想为 API key 启用此功能,但不想突然关闭我的 iOS 客户端,因为不知何故它没有报告其包 ID。

最佳答案

我认为 Google Translation API 只是通过请求 header 键 x-ios-bundle-identifier 中的值来识别您的应用。

我尝试使用 Postman 发送带有以下参数的成功请求。


  • GCP API key 配置

GCP API Key config

  • postman 请求

Postman request

关于ios - iOS 应用程序的 Google Cloud Platform API key 限制如何运作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40278140/

相关文章:

python - 通过 Python 的 gRPC API 服务器无法工作

ios - 如何在 Skscene 中呈现 UIAlert

iphone - "Unrasterize"UIView层

javascript - 谷歌地图拖动矩形来选择标记

javascript - 使用 Excel 道路表在 Google 中突出显示道路

javascript - 谷歌云功能部署失败

ios - 如何在 swift (iOS) 中创建单选按钮和复选框?

ios - 如何对从 AppStore 更新应用程序版本执行一些操作

google-maps-api-3 - 谷歌地图不显示

google-cloud-platform - 可以获得 Google Cloud Functions 的静态 IP 地址吗?