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
If you are testing locally, make sure to add your local ip to the server key:
xxx.xxx.xxx.xxx
if you want the maps api to be available across the whole domain add this to the browser key:
*.mydomain.com/*
Hope this helps.
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.
Now adding a map from Google has become more problematic than it was before. On the page https://leafletjs.com/ you will find another more convenient library with maps.
Add v=3;
before your key.
maps.googleapis.com/maps/api/js?**v=3;**key={your key};sensor=false
I think you must check the referrers. The given example on the API console site is:
Example: *.example.com/*. *One URL or pattern per line.*
Try to include the full referrer names without using wildcards. The wildcard usage seems a bit strange. More people struggle with that, see this post. You can find a description of the possible whitelist configuration on the Google APIs Console Help page.
(You mentioned that your personal key has the same referrers as your company key. I wonder if this is possible as you could use different keys for the same app in this case.)
I was able to resolve this issue by simply generating a new browser key. I generated, threw it in the browser, the map loaded. Then I went in and copied my referrers over from the previous key. Saved. Refreshed. And it still worked. I honestly think it was a bug on Google's end and the day we were generating the original keys it was spitting out invalid keys.