Embedded Google Maps not working with Google App Engine

Standard

This one was actually pretty easy to solve, but was interesting anyway.

Developing locally I was OK using http requests for my script files as my local server has now issues with using either http or https for requests. However, App Engine has other ideas. In my scripts file I was including the below reference:


http://maps.googleapis.com/maps/api/js?key=My%20API%20Key

This worked no problem on my machine, but when I published to Google App Engine I saw the below:

GMaps_AppEngine.PNG

Once I changed the script to use HTTPS:


https://maps.googleapis.com/maps/api/js?key=My%20API%20Key

I also needed to add my new site to the list of allowed referrers, by going to the Google Cloud Dashboard > APIs and Services > Selecting my project from the dropdown > clicking Maps Javascript API > Credentials > Editing the credential and adding in a record for my site.

Then I was presented with what I wanted to see:

GMaps_AppEngine1.PNG

Advertisements