21
votes

I am getting the error RefererNotAllowedMapError from some PC's when I load a page on my site.

RefererNotAllowedMapError

The current URL loading the Google Maps JavaScript API has not been added to the list of allowed referrers. Please check the referrer settings of your API key on Google Cloud Console.

See API keys

It works OK on FireFox from 3 out of four of the machines I have tested.

Generally this would mean that the domain is not added as a referer in my API console but it definitely is, and it definitely works on other machines.

Anyone else had this issue or able to provide some guidence?

9
I have the same problem with my web client for a rest api using a google map. for me only firefox has a problem with showing the map and shows me an ""RefererNotAllowedMapError: developers.google.com/console/help/new/#apikeybestpractices"" error - anyone any idea how to solve this? - Freddy
I recreated by API key and it started working again across all browsers. - bwash70
@Freddy same happen with me,,,only firefox show this message, even i allow the domain. - Hamza Zafeer

9 Answers

20
votes

Recreating the API key at console.developers.google.com fixed the issue for me.

11
votes

Try to add all type of urls like:

http://stackoverflow.com/*

http://www.stackoverflow.com/*

*.stackoverflow.com/*

Definitely it will work.

2
votes

For me to use Places API I had to turn on Maps JavaScript API

1
votes

This gives error because your Google map API key is not a browser key. Create new key as 'browser key'. This option is available when you create a new key.

1
votes

Note the DOT at the beginning of the expression, it's a char!

*.stackoverflow.com/* // this will not work with http://stackoverflow.com

You will also have to add:

*://stackoverflow.com/* // now it will cover all domain variation

1
votes

I had a similar issue where I was trying to use the API but had it restricted to Map product only. It generated the same error even though http referrer box had nothing in it (open for all). The problem went away after recreating a new key without any product restriction.

0
votes

Creating an new Browser Key fixed it for me. https://console.developers.google.com/projectselector/apis/credentials

RefererNotAllowedMapError Error The current URL loading the Google Maps JavaScript API has not been added to the list of allowed referrers. Please check the referrer settings of your API key on the Google API Console.

See API keys in the Google API Console. For more information, see Best practices for securely using API keys.

0
votes

The only thing that worked for me was to create a brand new key w/no restrictions, including no API restrictions.

This won't be a working solution in the production environment, but it allows us to move ahead w/development.

0
votes

The solution to every/such Maps Javascript API error varies for different scenarios for different developers. A list of errors with detailed description is given by google here

Nevertheless please refer the below snap: Maps Javascript API restrictions

  1. As you can see above under Application restrictions just by selecting the HTTP referrers won't do. You have to add a URL(i.e the URL of the website from which the api will be called to render the map).
  2. Now the exact page(in my case the contact us page) which is gonna make the request to the api needs to be mentioned in the url and not just the domain.
  3. Please go through the examples given in the documentation on the right
  4. Adding a /* after the domain url like http://www.telesuprecon.com/* will make the request possible from any page within your website.