I\'ve recently been doing development upgrading our maps to v3 and during development I was using my own personal key. Everything was working fine. When it was time to go to
You are missing the v=3
before your key={yourkey}
Like this:
maps.googleapis.com/maps/api/js?v=3&key={your key}&sensor=false
I hit my head against the wall on this for a while. Including the version number, which the example does not do, fixed it for me.
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3.exp&key=YOURKEY">
^ That one has the ?v=3.exp
bit
Under referrers, we had *
. The fix was actually to leave it blank `` which means allow all.
I have been getting the invalid key message too, and after trawling all round the web, have found what MY problem was. It may affect others too. It had nothing to do with the key.
I discovered that I had an error in the 'initialize' function (in my case a missing comma at the end of a line in the mapOptions). This arose because I added a new (last) line, and failed to put a comma at the end of the preceding one. A good argument for always having a comma, even on the last line.
I can now switch the invalid key message ON or OFF my removing/replacing that comma. I conclude that any error in the map related JS may give rise to it.
Actually you want the Google Maps JavaScript API
to be enabled instead of Google Maps API v3
because the former is what you are actually using here. The latter is now divided into iOS and Android BTW.
Also you need to add your reference into your server key.
If it is local, it should be something like:
localhost/*