Google maps API key issues

If you have questions about using mojoPortal, you can post them here.

You may want to first review our site administration documentation to see if your question is answered there.

This thread is closed to new posts. You must sign in to post in the forums.
11/6/2018 10:23:38 AM
Gravatar
Total Posts 10

Google maps API key issues

Hi all,

We are having issues displaying Google maps on our site (maps display with "For development purposes only" watermark) and we are seeing the following in the browser console

      util.js:224 Google Maps JavaScript API warning: NoApiKeys https://developers.google.com/maps/documentation/javascript/error-messages#no-api-keys

 

My client has provided an API key from their Google Cloud account and I have added this to the API section in Mojoportal as well as the <add key="GoogleMapsAPIKey" value=".... section in the web.config for the site but the issue persists.

I also installed the Google API checker chrome extension and it reports the following

      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.

Am i missing any steps or has anyone else seen similar issues that can offer help?

 

This used to work fine but I appreciate that Google changed their API licensing approach which I guess has caused this.

Regards

Andy

11/6/2018 1:00:48 PM
Gravatar
Total Posts 2183

Re: Google maps API key issues

Hi Andy,

What version of mojoPortal are you running?

If it's pre-2.7, you'll need to upgrade. Short story: mojo wasn't using the api key but 2.7 does and also provides a method (iframe embed) for not using the key.

Long story: when mojo originally implemented Google Maps, the api key was required. Google removed the api key requirement at some point and mojo no longer used it for connecting to the maps api. Google then decided they wanted to require it again but didn't make any breaking changes and mojoPortal wasn't updated to use the api key. Google decided to start charging for use of their service (sort of, you have to give them a credit card even if you're a small site that will never hit their quota) and they started placing the developer purposes banner on the maps when the key wasn't used. We re-implemented the key in mojo but before we made the 2.7 release we figured out how embed maps without using an api key, using an iframe embed. The api method provides a lot more functions but the iframe embed method is a lot easier and is sufficient for most sites. Stay tuned for when Google changes things again. They're good at that, it keeps them relevant (as if they need help with that, lol). ;-)

Thanks,
Joe

11/6/2018 1:13:00 PM
Gravatar
Total Posts 10

Re: Google maps API key issues

Hi Joe,

Thanks for the update, I appreciate it.

Just checked and this is Version 2.4.0.4 MSSQL of MP..............so..................uh............old :)

We inherited support for this and the Google change has literally killed the main purpose of the site for the customer which isnt good so I am going to have to try and fast track this upgrade and would hope to be able to just use the API key to remove any development if possible.

So if we jump to 2.7 at the very least you think that would do what we want?

Don't want to seem n00b (well, I am I guess) but is the upgrade a straightforward one i.e. run an exe etc?

Cheers

Andy

11/6/2018 3:35:19 PM
Gravatar
Total Posts 2183

Re: Google maps API key issues

Hi Andy,

Understood, we can help you with the upgrade, if you like. Open a ticket with us and we can discuss.

Thanks,
Joe

11/13/2018 5:36:31 AM
Gravatar
Total Posts 10

Re: Google maps API key issues

Hey Joe,

Sorry to bother again, just to confirm..........version 2.7 should resolve the API key issue (we have one from the customer) through inputting it into the administration API area?

Regards

Andy

11/13/2018 1:31:01 PM
Gravatar
Total Posts 2183

Re: Google maps API key issues

Hi Andy,

If you upgrade to 2.7 you will be able to use the API Key AND be able to use a new method that doesn't require the API Key. The API Key gives you a bit more control over what is displayed on the map but for most purposes the new method without the API is sufficient.

Thanks,
Joe

1/9/2019 9:32:53 AM
Gravatar
Total Posts 10

Re: Google maps API key issues

Hey Joe,

Hope you had a good Christmas and NY :)

I have managed to run the upgrade scripts against one of our test servers for this solution and while the site initially looks to work fine, I am seeing the occasional blip in functionality around mapping. I haven't even got near the Google API issue yet

The error we are seeing is as below.

2019-01-09 12:09:50,438 INFO (null) - (null) - (null) - mojoPortal.Web.Global - Application Started. 
2019-01-09 12:10:21,842 ERROR 195.89.171.5 - en-US - /map - mojoPortal.Web.Global -  Referrer(https://**our site url**/map) useragent Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36 
System.ArgumentException: Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.
   at System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument)
   at System.Web.UI.WebControls.TextBox.LoadPostData(String postDataKey, NameValueCollection postCollection)
   at System.Web.UI.WebControls.TextBox.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection)
   at System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
 

Do you have any thoughts or suggestions that might help?

Regards

Andy

1/9/2019 1:18:34 PM
Gravatar
Total Posts 2183

Re: Google maps API key issues

Hi Andy,

Christmas was good. I hope the same for you!

Are you having trouble with the maps or are you just finding this error in the logs?

Do you have any other controls on the page with the map?

Thanks,
Joe

1/10/2019 9:53:35 AM
Gravatar
Total Posts 10

Re: Google maps API key issues

Hi Joe,

Thanks for the reply.

This is specifically an area that is not part of the base MojoPortal solution but a piece of dev work to add a control to it that filters some values in a JavaScript data table.

However, it works absolutely fine when the solution is using MP 2.4 (the previous version) and breaks with the "<pages enableEventValidation=" error previously mentioned after MP is upgraded to version 2.7 so I am trying to work out what has changed within MP that would cause that issue.

The site works absolutely fine when accessed over http but only displays the issue when accessed using https (as it will be on live)

Again, on MP 2.4 this works fine

 

Regards

Andy

1/22/2019 7:53:23 AM
Gravatar
Total Posts 10

Re: Google maps API key issues

Hi Joe,

Ok, besides the issues that we are facing with the upgrade, I quickly tested the Google maps functionality and have noted that we are still getting the "developer" watermark on any use of Google maps

I have placed our API key in both the site settings and the web.config as well as making sure that our site is included in the API configuration on Google's side

Can you help or advise please?

 

Thanks

Andy

1/31/2019 4:25:38 AM
Gravatar
Total Posts 10

Re: Google maps API key issues

Hi Joe,

Are you able to offer some assistance on the above please?

Regards

Andy

You must sign in to post in the forums. This thread is closed to new posts.