问题
I've been using Google Directions API for my iOS app, but now I want to restrict the API key to be used by my iOS apps (specified by their bundle IDs) only.
Is there any solution for this? Thanks
回答1:
Directions API is a web service. The restrictions that will work with an API keys for web services are IP restrictions.
It is supposed that web services requests are executed on your backend servers. If you need to restrict an API key, the workaround is to create an intermediate server. Your iOS application should send requests to the intermediate server, intermediate server should send requests to Google and pass responses back to your app. In this case you can restrict an API key by IP address of your intermediate server.
来源:https://stackoverflow.com/questions/40736854/can-i-restrict-google-direction-api-to-ios-apps-only