Skip to content

What does 'RefererNotAllowedMapError' or 'This API key is not authorized to use this service or API' mean?

Short answer

Your Google Maps API key has restrictions, and this request doesn't match them. Either your site's URL isn't in the key's allowed HTTP referrers (RefererNotAllowedMapError), or the API you're calling isn't in the key's API restrictions (ApiTargetBlockedMapError). Add the exact referrer or API. Don't remove restrictions, because Maps keys ship in public code and unrestricted ones get abused.

Last updated 2026-11-25 · Reviewed by ProofForge

The exact error

text
Google Maps JavaScript API error: RefererNotAllowedMapError
The current URL loading the Maps JavaScript API has not been added to the list of allowed referrers.

ApiTargetBlockedMapError: This API key is not authorized to use this service or API.

Why it happens

  • Production domain (or www) missing from the key's website restrictions.
  • You started calling a new API (Places, Geocoding) that isn't in the key's API list.
  • The API isn't enabled for the project (ApiNotActivatedMapError).

How to fix it

  1. In Google Cloud console → APIs & Services → Credentials, edit the key.
  2. Under Application restrictions → Websites, add https://example.com/* and https://www.example.com/*.
  3. Under API restrictions, add only the APIs the page uses.
  4. Use a separate, IP-restricted key for server-side web services like Geocoding.
text
Website restrictions:
  https://example.com/*
  https://www.example.com/*
API restrictions:
  Maps JavaScript API
  Places API

Check it's fixed

The map loads on your domain, and the same key fails from another origin.

Check your live app

A free, read-only public-surface scan. It cannot diagnose private sessions or every cause described above.

Read-only. No writes or row contents.

FAQ

Is it OK that my Maps key is visible in the page?

Yes for the Maps JavaScript API, as long as it's restricted to your referrers and APIs.

Why does it take a while to work?

Key restriction changes can take a few minutes to apply.

My key leaked and has no restrictions. What now?

Add restrictions, or regenerate it, and check billing. See /leaked-keys/google-maps.

Sources

Related

Read as Markdown · Scan methodology