14500+ website owners are using this wordpress map plugin

Buy Now - $89

Causes of RefererNotAllowedMaperror and steps to fix it

The RefererNotAllowedMapError is a common error that might arise when you attempt to utilize various Google Maps APIs, such as the Google Maps JavaScript API or the Google Maps Geocoding API. This error essentially points out that the particular website or domain initiating the API request isn’t included in the list of authorized referrers for the specific API key being employed. This error acts as a sort of gatekeeper, ensuring that only pre-approved sources can access the requested services through the API key.

Causes of RefererNotAllowedMaperror

The RefererNotAllowedMapError can be attributed to a few key reasons:

  • Incorrect API Key Association: The API key in use might not be correctly associated with the appropriate project. To leverage a Google Maps API, the API key must be linked to a project that possesses the necessary permissions and access for utilizing the specific API.
  • Unauthorized Referrers: When making an API request, it’s vital to specify the list of permitted websites or domains that can utilize the API key. If the requesting website or domain isn’t included in this list of allowed referrers, the RefererNotAllowedMapError will be triggered as a security measure.
  • API Key Issues: In cases where the API key lacks the essential permissions or is invalid, the RefererNotAllowedMapError may be encountered. It’s crucial to ensure that the API key is properly configured with the required authorizations to utilize the desired API functionality.

Steps to fix the RefererNotAllowedMapError

  1. Click the project drop-down menu at the top of the page, and select the project that you want to modify the authorized referrers.
  2. Click the hamburger menu and select APIs & Services > Credentials.
  3. Click the name of the API key that you want to modify.
  4. Click the Edit button in the restriction section > In the Key Restrictions section, select the Websites referrers option.

    Google Maps API Key Restrictions
    Google Maps API Key Restrictions
  5. To allow any referrer on a specific domain, you can use a wildcard at the beginning and end of the domain name:
    • Example: *.example.com/*
      This will allow any referrer on the https://www.example.com/ domain, such as https://www.example.com/page1, https://sub.example.com/page2, etc. to use the Google Maps API.
    • To allow a specific referrer, you can enter the exact URL:
      Example: https://www.example.com/page1
      This will allow only the specified referrer to use the Google Maps API.
    • To allow any referrer with a specific subdomain, you can use a wildcard at the beginning and end of the subdomain:
      Example: https://maps.*.com/*
      This will allow any referrer with the maps subdomain, such as https://maps.example.com/page1, https://maps.other.com/page2, etc. to use the Google Maps API.
    • To allow multiple referrers on a specific domain, you can use a wildcard at the beginning and end of the domain name, and separate each referrer with a comma:
      Example: *example.com/*
      This will allow any referrer on the https://example.com, https://example.com/page1 domain to use the Google Maps API.
    • To allow a range of referrers, you can use a wildcard at the beginning and end of the domain name, and specify a range of subdomains using a hyphen:
      Example: https://maps-*.example.com/*
      This will allow any referrer with a subdomain that starts with maps- on the https://maps-sitename.example.com/, https://maps-sitename-one.example.com/page1 domain to use the Google Maps API.
  6. In the Add Website field, enter the list of allowed websites for the API key. You can use the wildcard character (*) to match multiple referrers.
  7. Click the “Save” button to update the Key restrictions for the API key.

Conclusion

The RefererNotAllowedMapError arises from a specific cause: the referrer’s absence on the list of authorized referrers for the API key. To effectively address this error and restore proper functionality, consider the following steps:

  1. Review Application Restrictions: Ensure that the API key being used has appropriate application restrictions configured. Double-check that the domain of the referrer making the API request is explicitly listed within the allowed referrers.
  2. Use the Correct API Key: Verify that the correct API key is being utilized by the referrer. Confirm that the API key has the necessary permissions and is accurately associated with the intended project.

By implementing these measures, you can resolve the RefererNotAllowedMapError, ensuring seamless communication with the Google Maps API while maintaining security and access control.

Install Plugin Now!

This plugin is exclusively available at codecanyon.net. You'll get free updates and full support to use this plugin.