Skip to content
This repository has been archived by the owner on Nov 9, 2023. It is now read-only.

It is necessary to use a google Maps API KEY? #479

Closed
yammadev opened this issue Mar 11, 2016 · 18 comments
Closed

It is necessary to use a google Maps API KEY? #479

yammadev opened this issue Mar 11, 2016 · 18 comments

Comments

@yammadev
Copy link

I was testing an application, and by chance I saw the browser console and It had a warning:

"Google Maps API warning: No ApiKeys"

I've followed the link and it just says:

The script element that loads the API has no API key. Please make sure you include a valid API key as a key parameter. You can generate a new API key on the Google Developers Console. 

I've been using simply:

 <script src="http://maps.google.com/maps/api/js"></script> 

If I upload my code to a server, I'll have some problem if I don't have that key?

@hpneo
Copy link
Owner

hpneo commented Mar 14, 2016

Apparently is a new warning from Google Maps, but creating a Google Maps API Key is simple and free: https://developers.google.com/maps/documentation/javascript/get-api-key

@hpneo hpneo closed this as completed Mar 14, 2016
@parijke
Copy link

parijke commented Jun 27, 2016

same issue here.... the weird thing is that it runs ok from my desktop but it complains about the api key on the hosting server

I do not know where I have to insert the api key?

@parijke
Copy link

parijke commented Jun 27, 2016

Even weirder. Yhe same errors are in the javascript console. Only locally it even shows the map, but remote it says Oops something wrong

@parijke
Copy link

parijke commented Jun 27, 2016

"Google Maps API warning: NoApiKeys https://developers.google.com/maps/documentation/javascript/error-messages#no-api-keys" util.js:211:12
"Google Maps API warning: SensorNotRequired https://developers.google.com/maps/documentation/javascript/error-messages#sensor-not-required" util.js:211:12

@sachinsky
Copy link

parijke

Hey did you find the solution for this??? if so then please share the documentation

@parijke
Copy link

parijke commented Oct 5, 2016

Yes, I had te create an API key and add it to the url like

<script type="text/javascript" src="https://maps.google.com/maps/api/js?key=this-is-the-generated-api-key"></script>

@parijke
Copy link

parijke commented Oct 5, 2016

<script type="text/javascript" src="https://maps.google.com/maps/api/js?key=thisismyAPIkey"></script>

@sachinsky
Copy link

Thank you for the reply
I wanted to know if i replace the existing key with the new one does it will effect my website, where do i have to paste this in drupal.

<script async defer src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap" type="text/javascript"></script>

and sir what about the sensor=false

@sezerkarakaya
Copy link

@sachinsky,
Google is not recommend to use sensor=false, otherwise when site is open you' ll see the warning on the console.

@sonamdewangan
Copy link

Hi ,
I am facing an issue
Google Maps JavaScript API error: RefererNotAllowedMapError.
I have already followed below instruction in developer guide
https://developers.google.com/maps/documentation/javascript/error-messages#referer-not-allowed-map-error

Please help me out for this ??

@sonamdewangan
Copy link

parijke

Can u give me any solutions for this ?
I have checked followed steps of guide.
still m getting the issue Google Maps JavaScript API error: RefererNotAllowedMapError

@hpneo
Copy link
Owner

hpneo commented Jul 8, 2020

@sonamdewangan Did you do the part where you restrict the key? https://developers.google.com/maps/documentation/javascript/get-api-key#restrict_key

Something that happened to me a lot was that I thought I added the referer but I needed to confirm adding it.

@sonamdewangan
Copy link

@hpneo
Yes I added the key

<script type="text/javascript" src="https://maps.google.com/maps/api/js?key=AIzaSyDmzl5yH5G4rMpZQGMQKFR7A7YbkgA9FaI"></script>

and added the refferer and checked for like
https://velocity-fun-1342-dev-ed.lightning.force.com/*
Or /.lightning.force.com/

And currently testing without refferer
so getting issue :
Geocoding Service: You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started

Now it is asking for billing account.

@hpneo
Copy link
Owner

hpneo commented Jul 8, 2020

You need to follow that guide: https://developers.google.com/maps/gmp-get-started#create-billing-account and then enable the Geocoding API for that API key.

@sonamdewangan
Copy link

Ok @hpneo
I will follow the above guide .
And Thank you for your response and help.

@hotsimmy
Copy link

my code is blow
but it can't work
could you help me?

<script defer src="https://maps.googleapis.com/maps/api/js?v=3&sensor=true&key=thisismykey&callback=initMap"> </script> <script type="text/javascript"> function initMap(){ srcLocation = new google.maps.LatLng(19.075984, 72.877656); dstLocation = new google.maps.LatLng(12.971599, 77.594563); //alert(srcLocation); var distance = google.maps.geometry.spherical.computeDistanceBetween(srcLocation, dstLocation); alert(distance+"JJ"); document.getElementById("map").value=distance; //document.write(distance/1000); // Distance in Kms. } //initMap(); </script>
hh

@hpneo
Copy link
Owner

hpneo commented Nov 17, 2020

Which error are you getting?

@hotsimmy
Copy link

hotsimmy commented Nov 18, 2020 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants