0

When I include the following code in my page with the Browser API key:

<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBvjzyCJmLPnsrBjMXy1RTaRqZzTCtqZgw"></script>

I get the error:

This page was unable to display a Google Maps element. The provided Google API key is invalid or this site is not authorized to use it. Error Code: InvalidKeyOrUnauthroizedURLMapError

In the Google Developers Console I went to APIs & auth->Credentials->Accept requests from these HTTP referres (web sites)... then entered *.mywebsite.com/*. What am I doing wrong here?

Bxx
  • 1,615
  • 1
  • 17
  • 30
  • possible duplicate of [Google Map error: InvalidKeyOrUnauthorizedURLMapError](http://stackoverflow.com/questions/29571750/google-map-error-invalidkeyorunauthorizedurlmaperror) – geocodezip Sep 16 '15 at 20:10

1 Answers1

1

I believe you're linking it incorrectly. try:

<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3.22&key=yourkey"></script>
devlin carnate
  • 8,309
  • 7
  • 48
  • 82
  • Still running into the same issue after making the change :( – Bxx Sep 16 '15 at 17:49
  • what if you remove the key and just use https://maps.googleapis.com/maps/api/js?v=3.22 as the source? – devlin carnate Sep 16 '15 at 17:55
  • That works but I will max out the free quota and will need to associate with the api key – Bxx Sep 16 '15 at 18:04
  • 1
    ok, then it suggests the problem is not with your code, but with how you have your key set up. there are some possible solutions listed here: http://stackoverflow.com/questions/29571750/google-map-error-invalidkeyorunauthorizedurlmaperror – devlin carnate Sep 16 '15 at 18:12
  • It looks like it was a javascript error on my part. Nothing to do with the google API script tag. My initial script tag was correct, but map initialization coding was incorrect. Thx for the link – Bxx Sep 16 '15 at 19:26