0

I'm trying to use a Google Maps key in my webform, but it keeps coming back saying that the key is wrong (in the developers console).

I've gone to the Google console and regenerated the API key. That won't work. I've also looked at the referrers and set them (when I run it it comes up as http://localhost:12345/myform.aspx - so I've added a referrer of http://localhost:12345/*) with no avail. I've also checked the referrer in the developers console (F12) which comes up as http://localhost:12345/myform.aspx so there's no issue there.

Am I missing something blindingly obvious?

EDIT - code is <script src="http://maps.google.com/maps/api/js?v=3&key=LONG_KEY_HERE;sensor=false"></script>

Returning

Google Maps API error: InvalidKeyMapError https://developers.google.com/maps/documentation/javascript/error-messages#invalid-key-map-error

user25730
  • 517
  • 2
  • 6
  • 24
  • 1
    can you share your code, we cant help just reading situations. You can hide your developer keys ;) – Cracker Aug 05 '16 at 06:21
  • Have added the code which has the key in. – user25730 Aug 05 '16 at 06:27
  • Can you check whether you applied term of use or not on that page https://console.developers.google.com/iam-admin/projects. If it is ok also, check w3 schools tutorial http://www.w3schools.com/googleapi/google_maps_basic.asp – Cracker Aug 05 '16 at 07:02
  • What do you mean by "terms of use"? I've gone into the page and it has me listed as the owner, but this is at work and I don't want it to always be my account. I want the map to be used by anyone (provided the referrer is right of course). – user25730 Aug 05 '16 at 07:08
  • When you click your api key, pop-up appears to accept the conditions. But in that case you can use the method on w3schools' tutorial. I hope that helps. – Cracker Aug 05 '16 at 07:21
  • All set up as it should be. Very odd. – user25730 Aug 05 '16 at 07:31

2 Answers2

0

You don't need to use a key if you are running it in localhost. Try using google maps without the key

<script type="text/javascript" 
   src="https://maps.googleapis.com/maps/api/js?sensor=SET_TO_TRUE_OR_FALSE">
</script>

Google Maps v3 API key won't work for local testing

Community
  • 1
  • 1
Joyson
  • 3,025
  • 1
  • 20
  • 34
0

Somehow, it's now started working. Three days after generating an API key.

That's progress for you!

(oh, and I removed the sensor part at the end. I did try it without it before and it didn't work, but for some reason it did today. I blame it on the fact that it was Friday when I tried it and Google had just decided to clock off early for the weekend)

user25730
  • 517
  • 2
  • 6
  • 24