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

后端 未结 11 948
梦谈多话
梦谈多话 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 10:55

    I had a number of reports from clients about problems with Google maps on their sites. I checked and got "Invalid key" errors.

    Strangely, Google used to give out keys with a space before and after the API key. In the past, when I left the spaces off, the key broke. It was frustrating to remember to leave those spaces.

    Now, I trim() my current API Key (with or without spaces) before submitting it to Google Maps and it works.

提交回复
热议问题