JavaScript API for Google Maps RefererNotAllowedMapError

We are trying to develop a geocorrect application for one of our customers and first we want to test it in our domain.

We signed a contract for the Google Maps JavaScript API, and we have a valid browser key, and our domain www.grupocamaleon.com has received permission to use this key.

But we cannot make even the simplest example to run without errors.

We have the following demonstration in our domain and with our key:

(1) http://www.grupocamaleon.com/boceto/aerial-simple.html

But this does not work, and the Firebug console says:

"Google Maps API Error: Google Maps API Error: RefererNotAllowedMapError (link to Google documentation on RefererNotAllowedMapError) Your site URL for authorization: (1)"

On my credentials page there is no way to add referrers for adoption, so decisions involving adding referrers are now impossible.

My account page:

enter image description here

Why are we getting this error? How can we fix this?

+112
javascript google-maps google-maps-api-3
Feb 09 '16 at 9:28
source share
27 answers

I know this is an old question, which already has several answers, but I had the same problem, and for me the problem was that I followed the example presented on console.developers.google.com and entered my domains in the format *.domain.tld/* . This did not work at all, and I tried to add all kinds of variations to it, for example domain.tld , domain.tld/* , *.domain.tld , etc.

What solved this for me was adding the actual protocol; http://domain.tld/* is the only thing I need to work on my site. I think I will need to add https://domain.tld/* if I were to switch to HTTPS.

Update: Google has finally updated the placeholder, http now http :

Google Maps API referrer input field

+155
Jul 25 '16 at 20:49
source share

Come on Google, you guys are smarter than the Credential API page allows. (I know, because I have two sons working there.)

The list of "referrers" is much more picky than it allows. (Of course, this should be more forgiving.) Here are some rules that took me hours to discover:

There may be other rules, but this is a tedious guessing game.

+20
May 03 '18 at 3:20
source share

According to the documentation, "RefererNotAllowedMapError" means

The current URL loading the Google Maps JavaScript API has not been added to the allowed list. Check the referrer for setting your API key in the Google Developers console.

I have a Google Maps Embed API configured for my personal / working use, and still have not specified any HTTP referrers. I do not register errors. Your settings should make Google think that the URL you are visiting is not registered or not allowed.

enter image description here

+18
Feb 09 '16 at 9:40
source share

I tried many referrer options and waited 5 minutes until I realized that the example of filling Google in the form field is wrong. They are showing:

 *.example.com/* 

However, this only works if you have a subdomain. or www. in front of your domain name. The following instantly worked for me (excluding the sample example from the Google example):

 *example.com/* 
+15
Jan 21 '17 at 19:21
source share

Just be reminded that if you simply change it, it may take up to 5 minutes for the settings to take effect.

+12
Jan 07 '17 at 4:53 on
source share

Make sure you have the correct APIS enabled.

I tried all of the above, asterisks, domain names, slashes, backslashes and all, even in the end, entering only one URL as a last resort.

None of this worked, and finally I realized that Google also requires you to specify which API you want to use (see screenshot)

enter image description here

I didn’t have the ones I needed to enable (for me it was a JavaScript Maps API)

As soon as I turned it on, everything worked fine, using:

http://www.example.com/ *

I hope this helps someone! :)

+10
Sep 03 '18 at 12:06
source share

According to Google documentation, this happened because the url by which you use the Google Maps API, not registered in the list of allowed referrers

EDIT:

From Google Docs

All subdomains of the specified domain are also authorized.

If http://example.com is authorized, then http://www.example.com is also authorized. The converse is not true: if http://www.example.com is authorized, http://example.com is not necessarily authorized

Therefore, please configure the domain http://testdomain.com , then your http://www.testdomain.com will start working.

+9
Feb 09 '16 at 9:39
source share

I found that even your HTTP Referreres are valid enough, the wrong set of API Restrictions causes Google Maps JavaScript API error: RefererNotAllowedMapError .

For example:

  • You are using the Javascript API for the key.
  • Add http://localhost/* to Application Restrictions/HTTP Referrences
  • Select the Maps Embed API instead of the Maps Javascript API
  • This raises a RefererNotAllowedMapError
+7
Jun 05 '18 at 6:26
source share

For several years, there have been many proposed solutions, and some of them no longer work, and some did not work, so my latest version works at the end of July 2018.

Installation:

The Google Maps JavaScript API should work correctly with ...

  • several domains calling API: example.com and example.net
  • arbitrary subdomains: user22656.example.com etc.
  • both secure and standard HTTP protocols: http://www.example.com/ and https://example.net/
  • structure with an undefined path (i.e. a large number of different URL paths)

Decision:

  • Actually, using the template from the placeholder: <https (or) http>://*.example.com/* .
  • Not omitting the protocol, but adding two entries per domain (one per protocol).
  • Additional entry for subdomains (with *. At the beginning of the host name).
  • I had the feeling that the RefererNotAllowedMapError error still appears when using the correct configuration (and enough timeout). I deleted the credential key, repeated the request (now getting InvalidKeyMapError ), created new credentials (using exactly the same setting), and it has been working ever since.
  • Adding a simple protocol and domain did not seem to include subdomains.
  • For one of the domains, the working configuration is as follows:

Screenshot from Google API configuration

(Like text :)

 Accept requests from these HTTP referrers (web sites) https://*.example.com/* https://example.com/* http://*.example.com/* http://example.com/* 
+5
Jul 30 '18 at 9:22
source share

enter image description here

Accept requests from these HTTP referrers (websites)

Writing the localhost directory path

+4
Apr 6 '16 at 9:52
source share

you will show a screenshot of your api credentials page, but you need to click "Browser Key 1" and go from there to add referrers.

+3
Feb 23 '16 at 22:00
source share

For deeper nested pages

If you have a project in a folder, for example or in subpages

http://yourdomain.com/your-folder/your-page you can enter this in

http://yourdomain.com/*/*

The important part /*/*/* depends on how far you have to go

It seems that * will not fit / or go deep in transit.

This will give you full access to the domain, well, if you do not have deeper nesting than this.

+3
Aug 31 '17 at 19:44
source share

I experienced the same error:

enter image description here

This link talks about how to set API key restrictions: https://cloud.google.com/docs/authentication/api-keys#adding_http_restrictions

In my case, the problem was that I used this restriction:

HTTP referrers (websites) Accept requests from these HTTP referrers (websites) (optional). Use * for wildcards. If you leave this field blank, requests will be accepted from any referrer. Be sure to add referrers before using this key in production. https://*.example.net/*

This means that URLs such as https://www.example.net or https://m.example.net or https://www.example.net/San-salvador/ will work. However, URLs such as https://example.net or https://example.net or https://example.net/San-salvador/ will not work. I just needed to add a second referrer:

https://example.net/*

This solved the problem for me.

+3
Oct 09 '18 at 13:39
source share
  1. What is your billing enabled

  2. That your site has been added to the Google console

  3. That your site is added to the links in your application.

  4. (make a wildcard for www and not a single www)

http://www.example.com/ * and http://example.com/ *

  1. That Javascript Maps is enabled and you are using the correct credentials

  2. That website was added to your DNS to include your Google console above.

  3. Smile after it works!

+3
Mar 29 '19 at 12:28
source share

I finally started working using this tip from Google: ( https://support.google.com/webmasters/answer/35179 )

Here are our domain and site definitions. These definitions apply to the Search Console check:

 http://example.com/ - A site (because it includes the http:// prefix) example.com/ - A domain (because it doesn't include a protocol prefix) puppies.example.com/ - A subdomain of example.com http://example.com/petstore/ - A subdirectory of http://example.com site 
+2
Feb 22 '18 at 20:14
source share

I am adding 2 website domains, the set "*" in the subdomain does not work, but for my websites I used a separate subdomain of "WWW" and not a subdomain using the same Google Map API key.

do not use "*" in the subdomain

Hope this helps.

+2
Nov 04 '18 at 13:26
source share

Wildcards (asterisks) are NOT allowed on subdomains.

  • WRONG: * .example.com / *
  • LAW: example.com/*

Forget what Google says about placeholder, this is not allowed.

+2
Dec 26 '18 at 23:27
source share

This is another crappy Google product with a terrible implementation.

The problem I ran into is that if you restrict the API key by IP address, it won’t work ... BUT this is far from Google to clarify this point ... That was before troubleshooting and research, which I discovered:

IP-restricted API keys can only be used with web services that are intended to be used by the server (for example, geocoding APIs and other web services APIs). Most of these web services have equivalent services in the JavaScript Maps API (for example, see the geocoding service). In order to use the client part of the Maps JavaScript API services, you will need to create a separate API key, which can be Protected using the HTTP link restriction (see API restriction). key).

https://developers.google.com/maps/documentation/javascript/error-messages

FFS Google ... A pretty important piece of information that would be nice to clarify when setting up ...

+2
May 29 '19 at 6:00 a.m.
source share

I tried my best to make this work, but here are some tips:

  • URLs set as link sources include http , e.g. http://example.com/*
  • Google Maps JavaScript API has been enabled
  • A payment has been configured for this account.

Once all of the above has been resolved, maps are displayed as expected.

+2
Aug 14 '19 at 6:57
source share

http://www.example.com/ * worked for me after several days and days of trying.

+1
Mar 13 '17 at 13:37 on
source share

None of these fixes worked for me until I found out that RefererNotAllowedMapError could be caused by the lack of an account associated with the project. Therefore, be sure to activate a free trial or something else.

+1
Oct 18 '18 at 23:53 on
source share

I tried using the Places API (autocomplete) , and I also had to enable the Maps Javascript API from the Google Cloud Console before the Places API would work.

+1
Aug 27 '19 at 13:19
source share

Check your division on the site. To load the Google Maps JavaScript API, use a script tag like this

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

I use this ad on my Wordpress site in functions.php file

 wp_enqueue_script("google-maps-v3", "//maps.google.com/maps/api/js?key=YOUR_API_KEY", false, array(), false, true); 

I installed the API key in this format and it works great

 http://my-domain-name(without www).com/* 

this ad is not working

 *.my-domain-name.com/* 
0
Dec 13 '16 at 11:47
source share

Removing restrictions (on None) worked for me.

0
Mar 20 '17 at 18:39
source share

In my experience

http://www.example.com

worked fine But, https is required / * at the end

0
Mar 29 '19 at 23:43
source share

The Chrome Javascript console suggested declaring the full address of the page in my list of HTTP links, in this case http://mywebsite.com/map.htm Even if the exact address is http://www.mywebsite.com/map.htm - I already had wildcard styles are listed as others have suggested, but that was the only way this would work for me.

0
Apr 04 '19 at 14:57
source share

It worked for me. There are two main categories of restrictions in the settings of the API key:

  • Application restrictions
  • API restrictions

Application Restrictions:

At the bottom of the Referrer section, add the URL of your website " http://www.grupocamaleon.com/boceto/aerial-simple.html ". The right side of the section provides examples of rules based on various requirements.

Application restrictions

API Limitations:

Due to API limitations, you must explicitly select the 'JavaScript Javascript API' from the drop-down list, as our unique key will only be used to call the Google Maps API (probably) and save it, as you can see below. click. I hope this works for you ..... worked for me

enter image description here

Check your script:

Also, the problem may arise due to incorrect key submission inside the script tag. It should be something like:

  <script async defer src="https://maps.googleapis.com/maps/api/jskey=YOUR_API_KEY&callback=initMap" type="text/javascript"></script> 
0
Sep 19 '19 at 5:25
source share



All Articles