Developer forum

Forum » CMS - Standard features » Fixing Google API keys

Fixing Google API keys

Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi there,

I just set up a new site using a new domain name and now I am getting errors when doing Google maps related work in the backend. The problem is described here well: https://churchthemes.com/page-didnt-load-google-maps-correctly/

Could it be that DW doesn't use the Google API for backend related items?

Note, when testing, don't use a dynamicweb.com or other known domain as Google seems to allow existing domains still to use key-less APIS.

Imar

Google.png

Replies

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Imar,
Could not get it reproduced. Could you share you site url where it is reproduced?
By default the Google API key value is empty but it is possible to edit it manually and save the key to the Global settings file in the path:
/Globalsettings/Settings/GoogleAPIKeys/Maps
and restart the website. Could you check if it helps?
Regards, Dmitrij
 

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

It probably works for you because you're on a (Dynamicweb?) domain that Google has been seeing for years. They don't require keys on existing domains - yet.

Your GlobalSettings reference put me on the right track though. Here's where ShowOnMaps.aspx (which renders the map in the backend) reads from:

public string GoogleMapsAPIKey
{
  get
  {
    return SystemConfiguration.Instance.GetValue("/Globalsettings/Settings/GoogleAPIKeys/Maps");
  }
}

And here's where Maps_cpl writes to when storing the maps key in Settings:

<dwc:InputText runat="server" id="GoogleMapsAPIKey" Name="/Globalsettings/Settings/GoogleMaps/GoogleMapsAPIKey" label="Google Maps API key" />

I think this may have gone unnoticed for a while as Google usually doesn't complain....

 

 
Oleg Rodionov Dynamicweb Employee
Oleg Rodionov
Reply

Hi Imar,

So, do you have good results now when apply your API key with the path mentioned by Dmitriy above? As far as I understande, it should be saved with Maps_cpl as well or ShowOnMaps.aspx should take API key from the second path, right? Please, confirm.

BR, Oleg QA

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

It works when I manually create Globalsettings/Settings/GoogleAPIKeys/Maps and add the key there. However, that field is then not visible / editable under Settings and the one that's there does nothing.

So, while I can work around it there's still a bug that needs to be fixed.

You can repro it by assigning a key under Settings. Then edit a user's geo location and look at the source. You'll see that your key is not sent to Google's JavaScript URL.

 
Oleg Rodionov Dynamicweb Employee
Oleg Rodionov
Reply

Hi Imar,

Please, have a look at my attached test's proof taken on local solution under DW94 without/with Google Maps API key. I do not see any issues. The key defined with approriate section in GlobalSettings is available via backend settings, can be edited and processed by the Maps feature in user backend successfully.  

BR, Oleg QA

Screen1.1.png Screen1.png Screen2.png Screen3.png Screen4.png Screen5.png
 
Oleg Rodionov Dynamicweb Employee
Oleg Rodionov
Reply

New TFS 48922 has been created. ShowOnMaps.aspx will use /Globalsettings/Settings/GoogleMaps/GoogleMapsAPIKey defines with 'Settings-CP-Maps-Google Maps API key' can be edited and storred.

BR, Oleg QA 

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

So were you able to reproduce the problem? If not, let me kow and I can provide further details.

Thanks!

 
Kristian Kirkholt Dynamicweb Employee
Kristian Kirkholt
Reply

Hi Imar

The problem regarding #48922 "Change google maps api setting " has now been resolved in Dynamicweb version 9.5+

To upgrade please choose this version from download:

http://doc.dynamicweb.com/releases-and-downloads/releases

Let me know if you need any more help regarding this

Kind Regards
Dynamicweb Support
Kristian Kirkholt

 

You must be logged in to post in the forum