-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do we access Google Places API key from iOS and Android? #55
Comments
I made a trivial index.html fix, and on the But the suggested URL for iOS ... |
"Google Maps JavaScript API error: RefererNotAllowedMapError " error from trying to use api from within React Cordova iOS, but works fine in Android |
iOS (using chrome debug tools, after safari debug tools failed me my simplifying the http request so much I though there was no x-requested-with header): |
Android: |
So for iOS we could use the x-requested-with:org.wevote.cordova I think I'll wait a week to see if I get a response on my StackOverflow question. |
I think this was closed by accident. |
Thank you @SailingSteve! Is there a workaround, or does this prevent us from auto completing addresses in iOS and Android? Please let me know if you need additional access to our Google API account. |
@DaleMcGrew no, the auto-complete works perfectly in Android, there is a problem with iOS. |
From the Google API Key page: https://wevote.us/* The "file_url//android_asset" line works nicely for Android. |
With the config above, this works for Cordova on iOS and Android. |
This is working now |
How is this supposed to be a restriction? I could use a stolen API key in any app without any problem |
Thank you @crisz for raising this question. When we run use the Google API key from our website, we can restrict the key to only be used from our domain. How can we have a similar restriction in our iOS and Android apps? |
Too bad looks like This is a big problem, since ios generates a HEX code for each installed application, and that code is included in the referrer like:
But, as mentioned above, a wildcard in that position won't work:
It looks like a bug, who wants to open an issue in google issue tracker? |
As per today (10 Feb 2019) the following http referrers allows to show a Google map in a cordova app: iOS:
Android:
cordova simulate (eg: simulate ios --target=chrome)
NOTE: SailingSteve answer is correct but it took me a while to understand the "Styling Markdown" has changed the double underscore into bold text... I hope it helps |
For iOS 13.1 it's probably |
Ooops, fixed the styling markdown on my earlier comment. Thanks. |
I can now set up an iOS specific and another Android Specific Google API key that is tied to the App's bundle. @SailingSteve I will send you the updated keys. They can be injected in this file for each specific bundle: src/index.html Search for: |
Research how to configure Google Places API key for the Cordova app, given the API restrictions limit us based on referring website. Until we figure this out, we lose the "auto-complete" feature when a voter changes their address in the Settings area: https://wevote.us/settings/address
...we are using "google.maps.places.Autocomplete" to offer suggested addresses.
The text was updated successfully, but these errors were encountered: