Google Maps Javascript API Error "RefererNotAllowedMapError"

Show form entries on a Google Map in WordPress with GravityView Maps!

This article is about GravityView, the best way to display entries on a map in WordPress. It geocodes and displays Gravity Forms form submissions on a map.

Google Maps JavaScript API RefererNotAllowedMapError; site URL not authorized, link to error documentation provided

If your map is not displaying and your browser console shows the "Google Maps JavaScript API error: RefererNotAllowedMapError" it means the URL loading the Maps JavaScript API is not on the list of allowed referrers. Please check the referrer settings of your API key in the Google Cloud Platform Console.

1. Remove restrictions on the API key to debug

Removing any restrictions can help identify whether they're causing unexpected issues.

First, go to the Credentials page of your Google Cloud Platform Console.

If you see a Maps API key under the "API Keys" header, click on the name of it to edit:

API key with a warning symbol and date of creation, highlighting a potential error

For "Application restrictions", set to "None"

Application restrictions options: None selected, Websites, IP addresses, Android apps, iOS apps

Under "API restrictions", set to "Don't restrict key"

API restrictions settings with options to restrict or not restrict the key

Click Save

Save and Cancel buttons with a note on settings delay

Please note, It can take up to 5 minutes for your new settings to take effect, so you might have to wait a few minutes before refreshing the View and seeing the map.

2. Wait five minutes β²οΈπŸ˜’

3. If it works, you have identified that the referrer is the issue πŸ‘

Don't stop now! You won't want to leave the "API restrictions" and "Application restrictions" settings there; this will mean that others will be able to use your Maps API key anywhere, potentially costing you money.

Now, we restore an "Application restriction" setting

  1. Set "Application restriction" to "Websites"

    Application restrictions options with "Websites" selected

  2. Click "+ Add"

    Website restrictions section showing how to add site restrictions for an API key

  3. Set "Referrer" to *.yoursite.com/* 

    Make sure to replace "yoursite.com" with your domain (without www.!). This will allow the API to run on all the variations of your website (www.example.com, example.com, subdomain.example.com).

    Dialog box to add a website with input field for domain and buttons for Cancel and Done

  4. If you have another site you want the maps to work on, click on "Add" button again to add another site.
  5. Save the settings again
  6. Wait five minutes
  7. If your site still doesn't work, try using the "IP addresses" restriction and entering the IP address of your server. Then (yep) wait another five minutes πŸ™„

If everything still works on your site, set "API restrictions"

  1. Under "API restrictions", select "Restrict key"
  2. Check the "Geocoding API", "Maps Javascript API", and "Places API" checkboxes (see image below)

    API key restriction showing Maps, Places, and Geocoding APIs selected

  3. Save the settings
  4. Wait another five minutes! πŸ˜†

These settings should continue to workβ€”if they don't, check all the boxes in the list, save, and wait five minutes. If it works again, then deselect one checkbox at a time and see which one makes things not work!

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us