Francisco
Francisco

Reputation: 183

Rails using Google Places web API (key not working)

I am trying to use Google Places address autocomplete in a rails app. I am using this example from google and trying it out on JSFiddle works fine. I change to my API Key and then doesnt work.

I tried in my rails app in development and in production getting the same result.

As soon as i write something the text box freezes and a little 'i' appears. (not clickable)

I created and tried 'browser api key' and 'server api key' with no luck.

I set my domain as requested * .mydomain.com/* and it didnt work

I enabled - Google Maps JavaScript API - Google Static Maps API - Google Maps Embed API - Google Places API Web Service - Google Maps Geocoding API - Google Maps Geolocation API

I added to my layout/application.html.erb file

I am searching through all questions but cant find my case, please help me find a solution or point me in the right direction. Thanks!

Update: In browser console i see Google Maps API error: RefererNotAllowedMapError https://developers.google.com/maps/documentation/javascript/error-messages#referer-not-allowed-map-error Your site URL to be authorized: 'mysite'

I have authorized the link exactly as shown in console but its not accepting it.

Upvotes: 0

Views: 286

Answers (1)

Francisco
Francisco

Reputation: 183

Solved. I somehow managed to mix up my API keys in loading 1.&libraries=places and in
2.=initAutocomplete" while I was authorizing my url.

thanks to all specially to @power for reminding me to check the console logs. I know its dumb, but I keep forgetting...

Upvotes: 1

Related Questions