I am getting error
Google has disabled use of the Maps API for this application. The provided key is not a valid Google API Key, or it is not authorized for the Google Maps Javascript API v3 on this site. If you are the owner of this application, you can learn about obtaining a valid key here: https://developers.google.com/maps/documentation/javascript/tutorial#Obtaining_Key
I have generated an API from api-console and using it for my local/local-host website but each time I am getting the above error. How can I show google maps on my localserver?
I have the similar problem as you today and I think I solved it.
First I am assuming that you have a google map api key already. I think what you need to do is to to go API Console - Google Code and click on API access
on the left. You can see your api key and just below the key, Referers:
shows your allowed referers. What you need to do is click Edit allowed referers...
and then add
localhost/*
to allowed referers.
I am using a MAMP to host my html, and I monitor the request my browser sent to google for api and I get this header:
showing Referer as localhost/*
It takes several minutes for Google to process after you changed your Referer but it works fine for me afterwords.
The answer by @Fei helped me. The issue I ran into is including multiple referrals. The following worked well for me. Enter a return before adding each record (as opposed to a comma or another delimiter).
don't know if this is the same problem but for me it turned out to be not the referrer.
I changed the url for map.google.com to the url below and the referrer as either "any referrer allowed" or one of the whitelisted patterns https://developers.google.com/console/help/#whitelistingbyhost.
I Removed the version and the file params from the url (even if the version was 3 it was still going through a v2 authorization)
<script src="http://maps.google.com/maps?sensor=false&key=${YOUR_KEY}" type="text/javascript"></script>
By what people say you would not need the key but could not get it working without it.
I had the same problem. I did not correctly whitelist my domain.
It shoud be whitelisted as follows:
Go to: https://console.developers.google.com/
Go to: Credentials.
Click on 'edit allowed referers' of your Browser API Key.
Add the following referrers:
yourdomain.com
*.yourdomain.com
Or look at this link to whitelist your domain correctly: https://developers.google.com/console/help/#whitelistingbyhost