Google Map API Key annoyance

If you tried to get a key for your localhost, you might get the following error when you tried to load the map:

googlemaperror
In order for a key to work on your localhost, you need to register an unique host name. So, go back to the registration page and pick a really unique name. Pick anything you know will be unique. Then edit your /etc/hosts file and add your unique name to localhost. For example:

127.0.0.1    localhost    myrealuniquehostname

Assuming you did everything else correctly, you should be able to see the map display without the pop up error above.

4 Comments »

  1. For windows users, windows/system32/drivers/etc hosts file
    or use a Unix system ;-) and safe yourself the hassle of it not working
    cheers Tim

  2. [...] When working with any of Google’s API’s you are asked to specify a directory that a key will be generated for, if you work with a site on a local testing server you probably have come across the “this key is in use” when you specify localhost as explained in this post the key is to specify a unique host name. [...]

  3. zencin said

    Thanks for pointing out the equivalent file on Windows .

  4. [...] Google non permetteva l’utilizzo della chiave. Leggendo un pò in giro ho trovato questo post dove spiega come ricevere una chiave di Api GoogleMap anche per i server locali. Praticamente, se [...]

RSS feed for comments on this post · TrackBack URI

Leave a Comment