kristianmandrup/gmaps-autocomplete-rails

How to use Google Places API Key?

stefanocdn opened this issue · 1 comments

Hi, I read the documentation but cannot find a way to use a Google API Key (to increase the number of requests), is there a way to do it?

I know I could add key param inside the URL

<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=XXXX&amp;sensor=false"></script>

But is that safe to embed an API Key on the client side?

Read the Google API docs ;)

https://developers.google.com/maps/documentation/javascript/get-api-key#get-an-api-key

<script async defer src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap"
  type="text/javascript"></script>

You now have to use HTTPS, to ensure it is safe and the key (and your location?) is not intercepted.