Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to give referrer url for localhost in google map api?

I am using google map geocode api for getting city,country,and state from zip code. I have restricted the API key to only respond to requests from allowed URLs.

It works fine except when I try to give referrer url for localhost it doesn't work. I am getting error "RefererNotAllowedMapError";

I don't understand how to give url for edit because every time the url of edit changes. Please share solutions if there is a way to allow the API to be accessed from localhost.

like image 494
vikash Avatar asked Sep 05 '25 13:09

vikash


2 Answers

I had that problem today, just typed "localhost" on the credentials part and it worked. enter image description here

like image 180
Bruno Simoes Avatar answered Sep 08 '25 23:09

Bruno Simoes


Try to create an API key again. I would suggest you to follow Get a Key/Authentication.

NOTE:

Google Maps APIs are available for Android or iOS apps, Web browsers, and via HTTP web services. APIs in each platform require a specific type of key. The Google Maps JavaScript API will only work with a Browser key. APIs of the same platform can use the same key.

Also, check Registering authorized URLs to validate if you are entering a correct format URL.

For example:

http://localhost or http://localhost:[PORT_NUMBER]

Hope this helps!

like image 44
abielita Avatar answered Sep 08 '25 22:09

abielita