I installed the gmap module thought I had everything configured properly but kept getting 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/introductio...
I finally realized that I was using a 'Google Maps API Server Key' when I needed to be using a 'Google Maps API Browser Key'! Perhaps some of the Google Map API Key instructions could be updated on the gmap homepage and README file. How about this...
===
In order to use 7.x-1.x and earlier versions of this module, you need a (free) Google Maps API Browser key. Here is how to get one:
1. Login at https://code.google.com/apis/console
2. Create project
3. Go to 'Services' and turn on 'Google Maps API v2'
4. Go to 'API Access' and 'Create New Browser Key' specifying your domain url(s)
5. Paste the Google API Browser Key here ./admin/settings/gmap
Hope that helps someone.
Jeff
Comment | File | Size | Author |
---|---|---|---|
#4 | gmap-issue-1549272.diff | 813 bytes | micheas |
Comments
Comment #1
carlodimartino CreditAttribution: carlodimartino commentedThis is not working for me any more from today. The Google warning pops up after 5 seconds or so and the map disappears. I've generated new keys but same problem.
Comment #2
brandy.brown CreditAttribution: brandy.brown commented@rectangle, make sure you have "Google Maps API v2" turned on under Services. If you have only v3 turned on, you will get errors.
Comment #3
carlodimartino CreditAttribution: carlodimartino commentedYes. I do have Google Maps API v2 turned on. I still get the error.
EDIT: http://drupal.org/node/818638#comment-5925902 solved my problem.
Comment #4
micheas CreditAttribution: micheas commentedInstructions rolled into diff.
Should apply cleanly.
Comment #5
deepakjoshi CreditAttribution: deepakjoshi commentedGoogle API Console >> All Services
Make sure you have Google Maps API v2 marked as on under Services.
If only v3 turned on then it will give Javascript popup error.
Google API Console >>API Access
Now 'Create New Browser Key' for your url (localhost or domain)
Use Google API Browser Key in drupal module at ./admin/settings/gmap
Comment #6
micheas CreditAttribution: micheas commenteddeepakjoshi: Are you commenting on my patch?
I really don't understand you post at all.
Comment #7
webservant316 CreditAttribution: webservant316 commentedI've seen others say that you need to include both 'yourdomain.com' and 'yourdomain.com/*' for the domain key to work. Maybe that is what he is saying. However, that is not my experience, nor is that what the google docs say here https://developers.google.com/console/help/#restrictingusage. Seems to me that my initial proposal to revise the docs still stands as simple and concise, plus there are links to the google docs right in their api console.
It may be that some installations need 'yourdomain.com/*' because of DNS or .htaccess complications. Dunno, but I don't need it for my install to work.
Comment #8
micheas CreditAttribution: micheas commentedwebservant316:
I agree with you that the issues of *.example.com/*, *.example.com are laid out in the Google.com control panel.
Not having them here seems to me to make maintaining the documentation easier, as when google makes a change to the requirements we don't have to go through the patching process to update the documentation.
Comment #9
webservant316 CreditAttribution: webservant316 commentedyep
Comment #10
micheas CreditAttribution: micheas commentedComment #11
betovargI can confirm the instructions from OP worked. My site is now showing maps correctly.
Thanx!
Comment #12
klucid CreditAttribution: klucid commentedI had this issue just moments ago. For whatever reason, I had to turn off the v3 service as well. It seems that having both services on was causing an issue.
Comment #13
brandy.brown CreditAttribution: brandy.brown commentedOK. I think I finally solved my problem with this by Creating a new project (I was trying to use an old project while just generating a new key) and then allowing all referrers. We'll see...
Comment #14
fonant CreditAttribution: fonant commentedCreating a new "Project" in the Google APIs Console was needed for me too.
Comment #15
japo32 CreditAttribution: japo32 commentedHI, this is what worked for me. It's the same as the first post, almost:
1. Login at https://code.google.com/apis/console
2. Create project
3. Go to 'Services' and turn on 'Google Maps API v2'
4. Go to 'API Access' and copied the API key under "Key for browser apps (with referers)"
5. Paste the Google API Browser Key here ./admin/settings/gmap
thanks
Comment #16
youssefr CreditAttribution: youssefr commentedThis works...
Comment #17
Summit CreditAttribution: Summit commentedHi,
For me the only thing what helped is to set the referrer to: "Any referer allowed".
With any other combination I got:
Greetings, Martijn
Comment #18
Sarai Leon CreditAttribution: Sarai Leon commented5. Paste the Google API Browser Key here ./admin/settings/gmap
Hey I'm just missing that step, I can't find that in the google api console. Can you tell me where it is?
Comment #19
karolus CreditAttribution: karolus commenteddeepakjoshi does have a point...
I'm using 7.x, but the underlying issue shouldn't be any different from the 6.x versions of this module.
Recently, I had to migrate a Drupal site to a new Web host, and although there were no changes to the site itself, besides its location, I would be getting the Google Map API key issues related to above this post.
First thought it may have to do with the SSL, but disabled forcing redirects to it, and ruled that out...
I generated a new key, careful to make sure v.2 was selected, but still the same issues. Putting the URL in the key in a variety of different formats (e.g. sitename.com
sitename.com/*) did the trick.
Comment #20
whatsonmap CreditAttribution: whatsonmap commentedTry adding
&sensor=false
to the end of the script src= line as so:
script src="http://maps.google.com/maps?file=api&v=2&key=YOURKEY&sensor=false"
Comment #21
Sandip Choudhury CreditAttribution: Sandip Choudhury commentedThanks Jeff, your instruction to update about google api key (https://code.google.com/apis/console) is working fine for me.
But please update this api link in the module also.
Again thanks for this good work.
Comment #22
podarokThanks!
updated README.txt for 7.x-2.x and 7.x-1.x branches with this instruction
will be tagged in next minor release update
Comment #23
Sandip Choudhury CreditAttribution: Sandip Choudhury commentedDrupal Community is so helpful !! I wish that someday I will also help in Drupal community. Currently learning Drupal and PHP.
Bravo ! Bravo ! Drupal Community.
Comment #24
podarokupdated project
http://drupal.org/project/gmap
page also
Comment #25
miccelito CreditAttribution: miccelito commentedSorry to re-open the issue..
Mentioned at project page...
1. Login at https://code.google.com/apis/console
2. Create project
3. Go to 'Services' and turn on 'Google Maps API v2'
4. Go to 'API Access' and 'Create New Browser Key' specifying your domain url(s)
5. Paste the Google API Browser Key here /admin/settings/gmap
All done but I get a promt message: "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 v3 on this site. If you are the owner of this application, you can learn about obtaining a valid key here..."
Don't know what could possible be wrong? (I'm using GMap 6.x-2.0 beta2)
Further, someone told that Google has sent out emails reminding that the formal deprecation period for v2 of the API ends in May, 2013, after which they suggest that v2 won't work at all.
If at Google console 'Services' turning on both 'Google Maps API v2' and 'Google Maps API v3' and at 'API Access' choosing "Referers: Any referer allowed" seems to solve it and no error promt showing.
Has anything changed recently?
Comment #26
Media Crumb CreditAttribution: Media Crumb commentedSame issue. No matter what I do I can't get this to work on D7. I've followed all the steps countless times
Comment #27
polmaresma CreditAttribution: polmaresma commentedI'm on GMAP Location 7.x-2.7-rc1 and still receive the Key message.
I tryed every combination of V2/V3 and allowed sites possible without luck.
On other projects I have the same configuration working, is it possible that Google locks new Keys for V2?
Thank's for all.
Comment #28
calefilm CreditAttribution: calefilm commentedI'm giving up. Same as #27
Comment #29
twseid58 CreditAttribution: twseid58 commentedusing API v3 only and including the list from #16 is what worked for me.
Comment #30
hot_sauce CreditAttribution: hot_sauce commentedConfirmed what twseid58 did - if you make sure your list of sites is accurate then the code should work in V3. I don't think that you can create new keys for V2 anymore. Also, its critical that you get the paths for your site correct. My hang up was on this one:
*.websitename.com/*
I kept the . in place after the first asterisk for some reason thinking this would work for sites without a www in front of them. Fixed that and everything worked fine.
TLDR: The instructions currently on the site work correctly, you just have to make sure you have the sites listed EXACTLY correct or Google will boot you.
Comment #31
quicksketchHi guys, I've included new instructions in the issue to rewrite the README.txt file at #1837224: Update README.txt for Drupal 7.x-2.x branch. Getting that issue fixed would also solve this problem.
Comment #32
2¢ CreditAttribution: 2¢ commented@twseid58 mentioned this in #29, but I feel it should be stated more boldly as it was part of my problem.
You cannot have both V2 & V3 on, only enable V3.
[adding 2¢] I had to use *mysite.com/* because I'm using .htaccess to rewrite to a drupal install in a subfolder (I like keeping my web root tidy).
Comment #33
B Leg CreditAttribution: B Leg commentedNo matter what I still can't get this working. I keep getting that popup with the unsolvable message.
I've created and re-created the API key dozens of times for both API versions, I've tried the referrer list and a bunch of others I made up, I've re-generated the key in the API Access panel, I've flushed my caches, I'm only using one API version at a time. It just doesn't work. What are some next steps for me to take here because I need this map to show up.
Comment #34
daschwan CreditAttribution: daschwan commentedI got it to work!!!!!!
Created a NEW project in Googele apis
1. Login at https://code.google.com/apis/console
2. Create a NEW project (The key word is NEW. when i used an old project it did not work!)
3. Go to 'Services' and turn on 'Google Maps API v3'
4. Go to 'API Access' and 'Create New Browser Key' specifying your domain url(s) (I used *mysite.com/* )
5. Paste the Google API Browser Key ( www.yoursite.com/admin/config/services/gmap )
And now it works just fine :)
Comment #34.0
daschwan CreditAttribution: daschwan commentedfix blockquote tag
Comment #35
kopeboy CreditAttribution: kopeboy commentedI can't get it to work on a Pantheon sandbox site (http://dev-mysite.gotpantheon.com/), using 7.x-2.9.
Can anybody help on how I should insert it in the referrals?
I tried with this but it's not working:
Also, the only available Service with "V3" is called "Google Maps JavaScript API v3", not Google Maps API V3, is it right?
Should I use the dev version or (like the module page says) am I ok with 2.9 to work with Google Maps API v3?
Comment #36
kopeboy CreditAttribution: kopeboy commentedOK, I ruled out the V3 option, that isnt the problem.
I also tried with a domain I actually own, and I couldn't get it to work. A new message a was getting was
"Google has disabled use of the Maps API for this application. See the Terms of Service for more information: http://www.google.com/intl/en_US/help/terms_maps.html."
but maybe that was caused by me changing the API keys too much too fast.Finally I got everything working with these referrals rule (working for a normal domain without subdomains too, ie: without "gotpantheon"):
https://mysite.gotpantheon.com
https://mysite.gotpantheon.com/
https://mysite.gotpantheon.com/*
*.mysite.gotpantheon.com/*
*mysite.gotpantheon.com/*
http://mysite.gotpantheon.com
http://mysite.gotpantheon.com/
http://mysite.gotpantheon.com/*
and enabling the service "Google Maps JavaScript API v3" only.
Comment #37
kopeboy CreditAttribution: kopeboy commentedComment #39
Vako CreditAttribution: Vako commentedGoogle has changed their page and the instructions are not working as described. I can't even find what needs to be acquired, can someone help please.
Comment #40
crutch CreditAttribution: crutch commentedThe key seems to be required again. Localhost has stopped showing maps.
---
http://stackoverflow.com/questions/19784661/google-maps-v3-api-for-local...
"(As Jeff Hoye pointed out, as of June 22, 2016, an API Key is required again.)
And then you forgot the "new" in this line:
var map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);
With those changes your map will be displayed."
Comment #41
daggar CreditAttribution: daggar as a volunteer commentedThe top three threads in the issue list are all related to the out-of-date Google API documentation. As I recommend on this other thread, the module might profit from an official, perpetually-open and hopefully-updated thread that tracks Google's API changes. The dev isn't to blame that Google rearranges vital controls, but it's frustrating for new users trying to do a new setup.
Comment #42
schnoodle CreditAttribution: schnoodle as a volunteer commentedYet again, this is incredibly outdated.
Currently, to get mine to work - As of 6/27/2017:
Voila. Should be working.
Comment #43
Pascal- CreditAttribution: Pascal- commentedFor those wondering, at the current date the following API key is working for me:
Google Maps JavaScript API
It's also working without an API key though.
Comment #44
buntstiftmuffin CreditAttribution: buntstiftmuffin commentedWell, I am confused. Got a client page on our server (without any API key!), gmaps work perfectly. Migrated to the client server, gmap is missing the api key.
I made a new project with a new key, but I don't know where to put it to.
I don't have this
www.yoursite.com/admin/config/services/gmap
I have drupal 8 and no gmap module installed...I placed the API code in the 'tracking code' field of the template (okno) - well doesn't work. Someone any idea?
Comment #45
System Lord CreditAttribution: System Lord commentedFinally! Same as #43! Glad that nightmare is over! Now, off to Best Buy for a new keyboard. Lowes for drywall patch. Treats and apologies for my dog!
What's odd is the warning I'm still getting in inspector console:
util.js:228 Google Maps API warning: SensorNotRequired https://developers.google.com/maps/documentation/javascript/error-messages#sensor-not-required
I wonder if it's module that kicks off that warning? It can't be coming from Google, right?
Pascal, you said it also works without the API key. I don't understand how that's possible. If Gmap isn't communicating with google api's then what difference does it make what service you/we enable? How does our site know what service we selected? Weird
Comment #46
picxelplay CreditAttribution: picxelplay commented#43 worked for me as well. All of a sudden maps stopped working (in and out of the GMap module). Tried regenerating keys, nothing. Tried recreated the project, nothing. Enabling "Maps JavaScript API" fixed it.
Comment #47
John_B CreditAttribution: John_B commentedGoogle now require us to enable billing before creating a new 'Service'. Until you have enabled billing it is not possible to enable the Maps JS API.
Comment #48
espurnesAs John_B says, you must enable billing (by adding a credit card) to use the google maps service. But it seems google give you 200$ credit to use the service. So for small sites with few queries to google services it seems it is still free.
I've not tested yet.
https://cloud.google.com/maps-platform/pricing/sheet/
Comment #49
espurnesI updated a patch on https://www.drupal.org/project/gmap/issues/2818471 that adds the API KEY in te gmap_geocode function.
To use the geocoding you must set an api key and use https in your site.
Comment #50
Vali Hutchison CreditAttribution: Vali Hutchison commentedI have GMAP 7.x-2.11 running on a site and Google Maps stopped working due to the API issue. I tried creating a 'free' API the old way but this gave a JS error. So then went for the billing account via https://cloud.google.com/maps-platform/#get-started and generated an API that way and now maps are working again on the site. Didn't need to patch the GMAP module.
Comment #51
John_B CreditAttribution: John_B commentedIt needs one of us to make a patch because the help text is misleading, and updated help text will save others time.
Comment #52
triad_interactive CreditAttribution: triad_interactive commentedI'm using Gmap 7.x-2.11 and have entered a new valid (and tested) API key that is attached to a new Google billing account. But my map view is still showing the "For development purposes only" overlay. I've reached out to Google support, and they said that the module is not referencing the key properly. Are there additional steps I have to take to get this working correctly?
Comment #53
crutch CreditAttribution: crutch commentedThere shouldn't be anything to do on the module side. It is more than likely the google account side of things (not very easy). I think they sent a different key once setting up or confirmed, I can't recall exact details at this point. It may take a few hours or longer for it to activate once setting up billing account. That is the only issue we experienced.
Comment #54
jonahruh CreditAttribution: jonahruh as a volunteer commentedtriad_interactive, Did you figure out how to get it working? I also set up a google billing account, got and restricted an API Key and still keep getting the 'for development purposes' error. I installed the Chrome extension that checks your keys and it says ERROR: You seem to be using a malformed key. I am simply pasting the key they gave me into the GMap module field for the key. Im not sure what else to try. Anyone have this issue and resolved it?
Thanks!
Comment #55
gayathri09 CreditAttribution: gayathri09 as a volunteer commentedI'm also having same issue. I configured billing account API key, still it's showing "for development purposes". any patch is available for module?
Thanks
Comment #56
Vali Hutchison CreditAttribution: Vali Hutchison commentedtriad_interactive and gayathri09 have you associated a credit card with your google API account? This is required I thinkeven if you don't then get charged so maybe this is the issue? See here for example:
https://stackoverflow.com/a/50977984/4193509
Comment #57
miguel.delcampo CreditAttribution: miguel.delcampo commentedOne week ago, I had to do requests to Google Maps API whithout APIKEY in my site web. Now I obtain the next code error: REQUEST_DENIED
Why I could to do correctly resquests one week ago? I see that the new Google policy is from 16th July.
Thanks.
Comment #58
danzVP06 CreditAttribution: danzVP06 commentedI'm also having the same issue, credit card is also connected to my billing account. Created Maps JavaScript API with no restriction and with referrers. The map is still not yet working. I just copied my API credentials and pasted in on the configuration side but I'm still getting an error. On the configuration side I'm getting this error:
On the display page, I'm getting "For development purposes only"
When using the Google Maps Platform API Checker, I get this error:
Maps Platform Report
ERROR: This site doesn't seem to be using an API key. Keyless usage will soon be deprecated. Please set up and secure a key for your project.
Comment #59
jonahruh CreditAttribution: jonahruh as a volunteer commentedWow, I finally got this working. Thanks Vali for the stackoverflow link. I enabled the Api's i needed for my project. It still didn't work and so i clicked on google support. It said i needed to fix a problem with my billing account. I clicked on the link provided and had to assign the project to my billing account. Now it is working!
I just created a second project for another site and it went up like a breeze. Assigning the Api's you need is the key.
Here are the directions again if you have set up an account and your map is still not working:
Go to this link: https://console.developers.google.com/apis/dashboard.
Then you select your project in the dropdown.
Go to library on the left pane.
Browse the available APIs and enable the one you need.
Also be sure to restrict your key.
Comment #60
rblackmore CreditAttribution: rblackmore as a volunteer commentedI'm trying to get a Google Maps Javascript API key working with Gmap 7.x-2.11 and so far I've had no success.
This is what I've done:
Result:
My maps display this error "Oops! Something went wrong. This page didn't load Google Maps correctly. See the JavaScript console for technical details."
Console log errors on map pages:
The gmap admin form doesn't have a ClientId field. Am I mis-reading the instructions or have I encountered a different problem, requiring the creation of a new issue?
Comment #61
rblackmore CreditAttribution: rblackmore as a volunteer commentedOK. After a load of troubleshooting, including running several drush up commands and update.php, this fixed my problem: Without uninstalling I deleted gmap and ran "drush dl gmap". That fixed everything. No idea why.
Comment #62
gisleThis issue is from 2012, and there is a lot of outdated stuff in the thread. I think it should be closed and a new one opened in its place. The API instructions that comes with the module is outdated. For instance, an API key is now required.
For what it is worth, here are the steps I had to comply with to get an embedded map working by means of this project:
1. Set up a project in the Google APIs console.
2. Generate an API key for the project.
3. Enable the following two APIs:
- Maps Embed API
- Maps JavaScript API
4. Add billing to the project (even if you will not permit Google to charge you).
Comment #63
amcc CreditAttribution: amcc commented#50 worked for me (in August 2019 i.e. just now)
Comment #64
liquidcms CreditAttribution: liquidcms commentedall my sites with gmap stopped working today. i had to go in and enable billing as per #50 above (even though it came back with the same api key i already had).
GMap Module 7.x-2.11+3-dev (2017-May-22) and a cache clear and maps started working again.
Comment #65
apadernoComment #66
earthangelconsulting CreditAttribution: earthangelconsulting commentedhello maintainers!
i am not sure if the D8 version of gmap is now dead in the water, or what, but either way.. i am assuming you must have some idea of what the current Google API instructions are, for this module, since you were porting it, as of two years ago?
is there any chance you could please please please post those here, and/or add them to a new recommended release of gmap, even if that's the only difference from the last one? ;-)
some of us will be maintaining D7 sites for another year or two at least, and having this module usable (even if you don't make any more changes to it) would be great... and trying to understand Google's documentation, or all the different API key types (look at this list! https://developers.google.com/maps/faq?csw=1#using-google-maps-apis) would REALLY help!
thanks!
Comment #67
crutch CreditAttribution: crutch commentedThere shouldn't be an issue with the module. We are running the current gmap on multiple sites. You will need to work on Google API https://console.cloud.google.com/apis/credentials and select the correct project to confirm the correct keys are active, etc. It may take a few minutes for it to update and start working or if you are new to payments then it may take a few hours (they said that to us on the phone when setting up payments #53 and it did take that long).
Comment #68
earthangelconsulting CreditAttribution: earthangelconsulting commentedthanks @crutch !
as you said, the problem isn't with the module, it's just with the instructions that come with it. and i realize that it isn't necessarily the gmap maintainer's job to stay on top of every single change that google makes to their API instructions, which seem to change all the time... as long as the module's requirements as to which type of API key are not changing.
that's the part that i am having the problem with... out of all these key types shown on page https://developers.google.com/maps/faq?csw=1#using-google-maps-apis, which of these is relevant? does it depend on exactly what you are using the gmap module for?
Comment #69
crutch CreditAttribution: crutch commentedAh I see, use Maps JavaScript API, https://developers.google.com/maps/documentation/javascript/overview but it's not needed to understand the whole of that page because the module does it for us.
We just need the js api key https://developers.google.com/maps/documentation/javascript/get-api-key
But first we must have a Google Cloud project in our Google Cloud Console https://developers.google.com/maps/documentation/javascript/cloud-setup then we can create and restrict the key to our website(s).
We can use a single Google account and key for multiple sites. Or maybe for a specific customer, the key could be set up under their Google account and they would be responsible for the bill (if they surpass the allowed monthly credited/free requests).
Once finished with the Google items, then add key to the module at /admin/config/services/gmap.
Comment #70
earthangelconsulting CreditAttribution: earthangelconsulting commented@crutch - thanks, that's very helpful! i will try that :-)