Skip to main content

Google Maps Javascript API Tutorial is Rubbish

I am working on creating a Google-maps based project. As such, I was using the Google Maps Javascript API Tutorial to activate an API key and create a 'Hello World' style test script.

I continuously received one of the following errors:

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:

Google has disabled use of the Maps API for this application. See the Terms of Service for more information:

Having not used the API to make a single call, the notion that I had somehow violated the Google TOS was particularly infuriating, as was the notion that I had not enabled the Google Maps API, which I had done, as outlined in the API Tutorial:

The issue, at least in my case, turned out to be the sample code that Google provides in the same tutorial. The sample is as follows:

    <style type="text/css">
      html, body, #map-canvas { height: 100%; margin: 0; padding: 0;}
    <script src="" type="text/javascript">
    <script type="text/javascript">
      function initialize() {
        var mapOptions = {
          center: { lat: -34.397, lng: 150.644},
          zoom: 8
        var map = new google.maps.Map(document.getElementById('map-canvas'),
      google.maps.event.addDomListener(window, 'load', initialize);
<div id="map-canvas">

In the script above, the developer is prompted to replace API_KEY with their actual API Key. However, this will cause a TOS violation if you have followed the Tutorial. To resolve the issue, add the following to your API Key:

So the entire line of script, with an actual API Key, would look something like this:

<script src="
&sensor=false" type="text/javascript"> 
This will allow the map to render as described in the tutorial.