Dirar Houimli Dirar Houimli - 3 months ago 54
Javascript Question

Google Maps API error: MissingKeyMapError

I'm getting this error only in the web hosted version of my website and I'm using the Key, It works fine in local!
Help please!

<script async src="http://maps.googleapis.com/maps/api/js?=AIzaSyDudFyTGhbU2CvJtJNxdfkPcJfRQnZ1pbTg&libraries=geometry">

Answer

the API key is not being assigned because you are missing the GET parameter key in the url, in this case '?key='

<script async src="http://maps.googleapis.com/maps/api/js?key=AIzaSyDudFyTGhbU2CvJtJNxdfkPcJfRQnZ1pbTg&libraries=geometry">

If it still doesn't work, check out this guide from Google: https://developers.google.com/maps/documentation/javascript/get-api-key