Google Browser Key Not Working with Add-On but Works with Google Generated iframe

Permalink Browser Info Environment
Your Google Map Browser API Key enabled add-on is getting the Google message:
"Oops! Something went wrong.
This page didn't load Google Maps correctly. See the JavaScript console for technical details."
I can find that your add-on adds the following code at the bottom of the page...
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyB8o2NNI0uCsA4HbIC2c8dvSSRGmss3lG4&libraries=places"></script>

Yet I can get a Google Map which is supplied by Google using the same key to display with no problems...
<iframe width="600" height="450" frameborder="0" style="border:0"
src="https://www.google.com/maps/embed/v1/place?q=place_id:ChIJq3POONmKWYgROzh24zdjr8A&key=AIzaSyB8o2NNI0uCsA4HbIC2c8dvSSRGmss3lG4" allowfullscreen></iframe>

Type: Pre-Sale
Status: Resolved
jfhencken
View Replies:
Advite replied on at Permalink Reply
Advite
Hi,

The key you refer to is only used to generate the location autocomplete field when creating a new map.
You will still need to add your own API key.

You may already have your own API key but just in case, please see the link below for details on how to get an API key.

https://www.concrete5.org/marketplace/addons/styled-maps/how-to-get-...

The error you received is known to happen if updating the add-on from a version that was pre Google maps API update (prior to v1.2.0 / before June 22).

Essentially, you can fix the issue by deleting the current map, clearing your cache and then re-create a new version of the map on the page.

You can view the documentation about this issue on the add-on page here,

https://www.concrete5.org/marketplace/addons/styled-maps/map-not-sho...

If this does not help fix your issue then please let me know and I will look further into it.

Regards,
Adam
jfhencken replied on at Permalink Reply 2 Attachments
jfhencken
I do have the key. AIzaSyB8o2NNI0uCsA4HbIC2c8dvSSRGmss3lG4 It is valid and active.

I know this to be true because the key works for the iframe code that Google provides using the same key - the iframe map from Google loads and displays and works:
<iframe width="600" height="450" frameborder="0" style="border:0"
src="https://www.google.com/maps/embed/v1/place?q=place_id:ChIJq3POONmKWYgROzh24zdjr8A&key=AIzaSyB8o2NNI0uCsA4HbIC2c8dvSSRGmss3lG4" allowfullscreen></iframe>


This is the same key I place in the "Google Maps API Key" field in your add-on. Please see attached photos...

What am I missing?
Advite replied on at Permalink Reply 1 Attachment
Advite
Hi,

I just applied your API key to a test version of the Styled Maps add-on and it shut down all the maps on the page with the 'Oops! Something went wrong' screen.

I then switched out your API key with another key I have and it all went back to working again.

Additionally, I tried to run a jsfiddle of the iframe you posted but it sends back this error;

The Google Maps API server rejected your request. This IP, site or mobile application is not authorized to use this API key. Request received from IP address 203.7.36.27, with referer:https://fiddle.jshell.net/_display/...


It seems this may have to do with the API libraries associated with your key.

A Google Maps API key can have a number of different libraries associated with it depending on what the key is going to be used for.

The Styled Maps add-on makes use of the Google places API library so that library must be assigned to the API key that is to be used.

You can add API libraries to your key from the library tab inside the API manager. (please see attached image).

Could you please try adding the 'Google places API web service' to your key and then try it again to see if that fixes the issue.

Alternatively, you can create a new key by following the steps in the link below and then trying the new one with the add-on to see if this resolves your issue.

https://www.concrete5.org/marketplace/addons/styled-maps/how-to-get-...

Following the steps in the link above should yield a key that has the correct library associated with it as we will be creating the key from the Google places API key page.

Hopefully, we're on the right track here.

Let me know how it goes.

Cheers,
Adam.
Advite replied on at Permalink Reply
Advite
(*In reference to my first reply)

Disregard the comment about that key being used to generate the locations on the form.

Quite a number of the characters at the beginning of your key are identical to the one used in the add-on.

At first glance I figured you were referencing the autocomplete API key and not your own.
jfhencken replied on at Permalink Reply
jfhencken
I followed your directions again and this time I got a key that works.

Thank you for your help!

Google really does not make it easy to understand the API key procurement process.
Advite replied on at Permalink Reply
Advite
Awesome!

I know, the Google API libraries are a little bit confusing and not quite clear that you can assign them to your key.

Glad to hear that it is all working now as it should.

Regards,
Adam

concrete5 Environment Information

# concrete5 Version
Core Version - 5.7.5.8
Version Installed - 5.7.5.8
Database Version - 20160412000000

# concrete5 Packages
Background Image and Overlay (0.9.7), Styled Maps (1.2.1).

# concrete5 Overrides
languages/es_PY/LC_MESSAGES/messages.mo, languages/es_PY/LC_MESSAGES, languages/es_PY, languages/sv_SE/LC_MESSAGES/messages.mo, languages/sv_SE/LC_MESSAGES, languages/sv_SE, languages/de_DE/LC_MESSAGES/messages.mo, languages/de_DE/LC_MESSAGES, languages/de_DE, languages/cs_CZ/LC_MESSAGES/messages.mo, languages/cs_CZ/LC_MESSAGES, languages/cs_CZ, languages/da_DK/LC_MESSAGES/messages.mo, languages/da_DK/LC_MESSAGES, languages/da_DK, languages/el_GR/LC_MESSAGES/messages.mo, languages/el_GR/LC_MESSAGES, languages/el_GR, languages/ja_JP/LC_MESSAGES/messages.mo, languages/ja_JP/LC_MESSAGES, languages/ja_JP, languages/it_IT/LC_MESSAGES/messages.mo, languages/it_IT/LC_MESSAGES, languages/it_IT, languages/fr_FR/LC_MESSAGES/messages.mo, languages/fr_FR/LC_MESSAGES, languages/fr_FR, languages/pt_BR/LC_MESSAGES/messages.mo, languages/pt_BR/LC_MESSAGES, languages/pt_BR, languages/fi_FI/LC_MESSAGES/messages.mo, languages/fi_FI/LC_MESSAGES, languages/fi_FI, languages/tr_TR/LC_MESSAGES/messages.mo, languages/tr_TR/LC_MESSAGES, languages/tr_TR, languages/ru_RU/LC_MESSAGES/messages.mo, languages/ru_RU/LC_MESSAGES, languages/ru_RU, languages/es_PY/LC_MESSAGES/messages.mo, languages/es_PY/LC_MESSAGES, languages/es_PY, languages/sv_SE/LC_MESSAGES/messages.mo, languages/sv_SE/LC_MESSAGES, languages/sv_SE, languages/de_DE/LC_MESSAGES/messages.mo, languages/de_DE/LC_MESSAGES, languages/de_DE, languages/cs_CZ/LC_MESSAGES/messages.mo, languages/cs_CZ/LC_MESSAGES, languages/cs_CZ, languages/da_DK/LC_MESSAGES/messages.mo, languages/da_DK/LC_MESSAGES, languages/da_DK, languages/el_GR/LC_MESSAGES/messages.mo, languages/el_GR/LC_MESSAGES, languages/el_GR, languages/ja_JP/LC_MESSAGES/messages.mo, languages/ja_JP/LC_MESSAGES, languages/ja_JP, languages/it_IT/LC_MESSAGES/messages.mo, languages/it_IT/LC_MESSAGES, languages/it_IT, languages/fr_FR/LC_MESSAGES/messages.mo, languages/fr_FR/LC_MESSAGES, languages/fr_FR, languages/pt_BR/LC_MESSAGES/messages.mo, languages/pt_BR/LC_MESSAGES, languages/pt_BR, languages/fi_FI/LC_MESSAGES/messages.mo, languages/fi_FI/LC_MESSAGES, languages/fi_FI, languages/tr_TR/LC_MESSAGES/messages.mo, languages/tr_TR/LC_MESSAGES, languages/tr_TR, languages/ru_RU/LC_MESSAGES/messages.mo, languages/ru_RU/LC_MESSAGES, languages/ru_RU

# concrete5 Cache Settings
Block Cache - Off
Overrides Cache - Off
Full Page Caching - Off
Full Page Cache Lifetime - Every 6 hours (default setting).

# Server Software
Apache

# Server API
cgi-fcgi

# PHP Version
5.5.33

# PHP Extensions
bcmath, bz2, calendar, cgi-fcgi, Core, ctype, curl, date, dom, ereg, exif, filter, ftp, gd, gettext, hash, htscanner, iconv, imap, intl, ionCube Loader, json, libxml, mbstring, mcrypt, mhash, mysql, mysqli, mysqlnd, openssl, pcre, PDO, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, pspell, Reflection, session, SimpleXML, soap, sockets, SPL, sqlite3, standard, tidy, tokenizer, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip, zlib.

# PHP Settings
max_execution_time - 30
log_errors_max_len - 1024
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - 60
max_input_vars - 4000
memory_limit - 512M
post_max_size - 128M
sql.safe_mode - Off
upload_max_filesize - 128M
mysql.max_links - Unlimited
mysql.max_persistent - Unlimited
mysqli.max_links - Unlimited
mysqli.max_persistent - Unlimited
pcre.backtrack_limit - 1000000
pcre.recursion_limit - 100000
pgsql.max_links - Unlimited
pgsql.max_persistent - Unlimited
session.cache_limiter - <i>no value</i>
session.gc_maxlifetime - 7200
soap.wsdl_cache_limit - 5

Browser User-Agent String

Mozilla/5.0 (Windows NT 6.1; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.