Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERROR: Google Maps API error: MissingKeyMapError

The following JavaScript error suddenly appeared:

Google Maps API error: Google Maps API error: MissingKeyMapError

like image 953
Muhammad Saad Ansari Avatar asked Oct 05 '22 13:10

Muhammad Saad Ansari


People also ask

How do I get rid of this page Cannot load Google Maps correctly?

You can do that by accessing Application restrictions, then navigate to “HTTP referrers” then type in your domain's name. After making the necessary changes, click Save. Copy the API key because you will need it to get the map back on your website.


2 Answers

Yes. Now Google wants an API key to authenticate users to access their APIs`.

You can get the API key from the following link. Go through the link and you need to enter a project and so on. But it is easy. Hassle free.

https://developers.google.com/maps/documentation/javascript/get-api-key

Once you get the API key change the previous

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

to

<script src="https://maps.googleapis.com/maps/api/js?libraries=places&key=your_api_key_here"></script>

Now your google map is in action. In case if you are wondering to get the longitude and latitude to input to Maps. Just pin the location you want and check the URL of the browser. You can see longitude and latitude values there. Just copy those values and paste it as follows.

new google.maps.LatLng(longitude ,latitude )
like image 124
Dulith De Costa Avatar answered Oct 22 '22 01:10

Dulith De Costa


As per Google recent announcement, usage of the Google Maps APIs now requires a key. If you are using the Google Maps API on localhost or your domain was not active prior to June 22nd, 2016, it will require a key going forward. Please see the Google Maps APIs documentation to get a key and add it to your application.

like image 78
mizba Avatar answered Oct 22 '22 01:10

mizba