How to solve Google Maps Javascript API v2 “Invalid key” error

Recently I had to work with the Google Maps JavaScript API v2 (I know, it is deprecated, but isn’t my project and I can’t just update it to the v3) and I was getting spammed by this 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 v2 on this site. If you are the owner of this application, you can learn about obtaining a valid key here: http://code.google.com/apis/maps/documentation/javascript/v2/introduction.html
#Obtaining_Key

I tried everything Google suggested and I couldn’t make it work at all, then I discovered that this few lines in the “Allowed referrers” will get the problem solved instantly:

sitename.com
sitename.com/*
http://www.sitename.com
http://www.sitename.com/*
*.sitename.com
*.sitename.com/*

This pattern will make you get back to work in few seconds.

Enjoy!

Advertisements

5 thoughts on “How to solve Google Maps Javascript API v2 “Invalid key” error

Your opinion is important!

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s