Google Autocomplete Referrer #560
-
Google sees Google Places Autocomplete requests as coming from https://localhost, which means you really can't restrict access by referrer. If you used https://localhost as a referrer anyone could use your key to do google maps/places lookup and we would pay for it. There used to be a google-plugin-googleplaces that might have solved the problem, but it is archived. Does anyone have an idea about how to get Autocomplete working in Cordova, without allowing the world to use your billing key? references: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 10 replies
-
Any service that restricts their API key to a domain is not a good fit in webview apps in general (not just Cordova). If the API key is known, anybody can make an app with any domain as the webview asset loader, and potentially use your key, not just Typically google APIs have a native client for android & iOS that will restrict an API key to the bundle ID on iOS, or the build key fingerprint for android. You'll need to find a plugin (or build one) that interfaces with the native mobile libraries instead of using the web API. |
Beta Was this translation helpful? Give feedback.
It's because domain restriction is only valid for websites using the JS SDK of the service.
e.g. a domain API key restriction will apply to the Autocomplete JS api.
The android API key restriction will apply to the Autocomplete Android API
The iOS API key restriction will apply to the Autocomplete iOS API.
So if you have 3 clients, a web portal, an iOS app and an Android app. You need 3 API keys, one for each platform.
And in Cordova's case, you'd need a way to integrate the Android & iOS SDKs of the Autocomplete API, which is where the plugin is necessary.