Need to replace Google Maps API key when deploying from http://localhost to live site

dbabbage - February 16, 2009 - 04:25
Project:Google Maps location
Version:6.x-1.0-beta1
Component:Code
Category:feature request
Priority:minor
Assigned:dbabbage
Status:closed
Description

Google does not require a Google Maps API key for localhost. However, the Google Maps location module may be written to require this on all occasions in order to function. To be confirmed.

#1

dbabbage - February 16, 2009 - 04:26
Title:Modules may require key for http://localhost» Google Maps location may demand key for http://localhost

#2

litrik - February 16, 2009 - 07:58

Google does require a key for localhost.

See http://mapki.com/wiki/FAQs#Key_Issues (your own URL):

If you want to test interaction with a server script, you can use Apache (or some other web server) on your computer and connect to it with http://localhost/. You would then apply for a key to http://localhost/ and use it like any other page.

and http://code.google.com/apis/maps/faq.html#keysystem

If you are developing on localhost, you will need to register a key for http://localhost.

PS: There is no key required when using file: URLs (which is not the case here).

#3

dbabbage - February 17, 2009 - 06:55

Ah right, I was mislead by this and didn't read the other page properly obviously. And the localhost key is not always identical so I guess hardwiring it may not be ideal—but then since no other identifying information is provided at the point of getting the key, perhaps it doesn't matter if everyone was using the same localhost key. Hmm.

#4

litrik - February 17, 2009 - 07:17

Every API key is tied to a Google account. See http://code.google.com/apis/maps/signup.html

You must have a Google Account to get a Maps API key, and your API key will be connected to your Google Account.

If the same key is being used for "localhost"s all over the planet, I guess Google will pull the plug on that Google account rather quickly. Sharing a Google Maps API key looks like a bad idea.

#5

dbabbage - February 17, 2009 - 09:30

Yes, I realised it was tied to the Google account after my last post, and after some tests. Since there is no limit to the number of maps queries made by any one key, I doubt Google would be concerned about a few different localhost requests being made with the same key—the usage numbers for this module are small anyway. However, I still don't intend handing out a key linked to my Google account...

#6

computer_jin - March 30, 2009 - 22:09

Hi,
I am having issue before many days can any one help me how can i solve this or how can i disable google map api because its giving me the error on my site "google map api used for this website registered for different website".

Any one is there who solved this already ???

thanks,

#7

litrik - March 31, 2009 - 06:08

#8

dbabbage - April 8, 2009 - 22:08
Title:Google Maps location may demand key for http://localhost» Need to replace Google Maps API key when deploying from http://localhost to live site
Category:task» feature request
Status:postponed (maintainer needs more info)» postponed

Changed to more accurate title. Sensible feature at add at some point in the future to allow both a localhost and live site key to be stored, perhaps, but it won't be a high priority to add.

#9

dbabbage - July 3, 2009 - 03:32
Status:postponed» fixed

In order to use a separate key for your localhost installation, just add the following code to your settings.php file for that installation:
$conf['gmaplocation_key'] =  '...';
Replace the ... with the Google Maps API key you've been issued for http://localhost and it will override that stored in the database for your live site. This enables you to migrate your database between live and dev sites without experiencing difficulties with the Google Maps API key.

This solves the originally requested feature problem, without cluttering the module interface with a localhost key option—which many people would not use as many development sites are not run at http://localhost. Therefore, this issue will now be closed.

#10

System Message - July 17, 2009 - 03:40
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.