The Google Maps API should be easy to use, and it really is. What’s not easy is figuring out what’s wrong when it’s throwing the following error: Invalid Key or Referrer.
One would think that the answer is obvious: you either have an invalid key or you’ve specified an incorrect referrer. But as with most generalized error messages, neither one is the answer. Google’s policy for their Google Maps API is that they don’t require a token or public key if you’re not using Maps for business purposes (which is only used when you exceed their daily quotas). If you don’t have your credit card details saved in the API console and you try to use a public key for your Javascript Maps call, it returns “invalid key”. Google forgot to tell us this important detail.
To fix this problem, simple remove your key from the API call. Simply using this will do:
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3&sensor=false"></script>
Yes, it’s that mind-numbingly simple to fix. As is life.