Google Maps V3 API Key Invalid - but my personal dev key works

后端 未结 11 896
梦谈多话
梦谈多话 2020-12-31 10:24

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

相关标签:
11条回答
  • 2020-12-31 11:01

    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
    
    0 讨论(0)
  • 2020-12-31 11:01

    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

    0 讨论(0)
  • 2020-12-31 11:03

    Under referrers, we had *. The fix was actually to leave it blank `` which means allow all.

    0 讨论(0)
  • 2020-12-31 11:07

    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.

    0 讨论(0)
  • 2020-12-31 11:08

    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/*

    0 讨论(0)
提交回复
热议问题