Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Google Cloud Platform API key restriction for iOS apps work?

According to:

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

We can create an API key to a GCP resource (e.g. Google Maps, Speech, Translate) restricted by "iOS apps" to a particular bundle ID. In principle this is great, but how does GCP actually implement this? How does GCP determine the client's bundle ID since only the client is only making standard HTTP requests to GCP -- presumably it's not reporting its bundle ID in the header?

I'd like to enable this for an API key but don't want to suddenly shut down my iOS client because somehow it's not reporting its bundle ID.

like image 721
Glen Low Avatar asked Oct 27 '16 06:10

Glen Low


1 Answers

I think Google Translation API just identifies your app by value in request header key x-ios-bundle-identifier.

I tried using Postman to send a successful request with following parameters.


  • GCP API Key config

GCP API Key config

  • Postman request

Postman request

like image 123
Charlie Hung Avatar answered Sep 25 '22 21:09

Charlie Hung