1

I am using the GMaps.js library and the code I am using is working 100% fine (running locally on localhost) - the 'webapp' I have created also uses the Google Maps Geocoding API.

I cannot see where I add my API keys anywhere within my code - although I am kinda confused as it currently works? Surely it should only work with a valid API key.

https://hpneo.github.io/gmaps/

<!DOCTYPE html>
<html>
<head>
<link href='example.css' rel='stylesheet' type='text/css' />
<link rel="stylesheet" type="text/css" href="style/style.css">
<script type="text/javascript" src="gmaps.js"></script>
<script type="text/javascript">
  map = new GMaps({
    div: '#map',
    lat: 52.4801,
    lng: -1.8835,
    zoom: 7
  });
</script>
</head>
<body>
<div id="map"></div>
</body>
</html>
Zabs
  • 13,852
  • 45
  • 173
  • 297
  • Clearly, form the source code, it doesn't. – Jaromanda X Jan 11 '16 at 12:07
  • I'm confused a little... the Google Maps Javascript API & Geocoding API both mention API keys (unless i'm mistaken which is very possible) and both the mapping & geocoding aspects of my app appear to work correctly. This will be going in a live environment at some point so will be expecting larger volumes of requests... but cannot see the API key input – Zabs Jan 11 '16 at 12:10
  • yes, there is such a thing as an API key - not sure when it is needed (large volume of requests probably) - that library has zero support for it – Jaromanda X Jan 11 '16 at 12:11

3 Answers3

3
 <script async defer src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY_HERE" type="text/javascript"></script>

Replace the placeholder text in the above snippet with your gmaps api key and insert in your header above the gmaps.js script.

1

By viewing the example codes, no API key is used. So I would guess you don't need one. Although you could supply google with a API key when embedding the maps api

Nicklas Ridewing
  • 2,410
  • 2
  • 14
  • 26
1

Ok - i have found the answer here: When is a Google Maps API key required?

In a nutshell version 3 doesn't require an API (v2 did) but it is recommended from what other developer are saying in regards to setting them up.

Community
  • 1
  • 1
Zabs
  • 13,852
  • 45
  • 173
  • 297