Knowledge base / Client ID (legacy)

Fix UnauthorizedURLForClientIdMapError on Google Maps

Google checked the page address against the authorised URL list for your Premium Plan client ID and didn't find a match. It also returns this error when the client ID itself is invalid or expired. Client IDs are retired, so use this error as the push to move the page to an API key.

How to tell this is your problem

  • The Maps script tag contains client=gme-…, not key=.
  • The console shows UnauthorizedURLForClientIdMapError.
  • The map works on one address and fails on another: the live site but not staging, https:// but not http://, or a new domain after a rebrand.
  • Or it fails everywhere, which points to the client ID itself rather than one URL.

This is what the console shows:

Google Maps JavaScript API error: UnauthorizedURLForClientIdMapError
https://developers.google.com/maps/documentation/javascript/error-messages#unauthorized-url-for-client-id-map-error

Why it happens

Google's error reference gives three causes: the client ID is invalid, it has expired, or the address loading the API isn't on the client ID's authorised URL list. In rough order of likelihood today:

  • The client ID has been retired. Google deprecated Premium Plan client IDs on 26 May 2025 and says they can no longer be used after 31 May 2026. If the map fails on every URL, this is almost certainly why. Go to the client ID migration guide.
  • The page moved. A new domain, a new subdomain or a switch to HTTPS that nobody added to the list.
  • Protocol or port mismatch. Google treats http:// and https:// as different URLs. An entry with a port, such as http://example.com:8080, doesn't authorise the same host without the port.
  • A path entry that is too narrow, or the wrong case. Paths are case sensitive. Authorising example.com/Maps doesn't cover example.com/maps.
  • Authorising www only. Subdomains of an authorised domain are covered, but not the other way round. example.com covers www.example.com. www.example.com doesn't cover example.com.

How client ID URL rules work

These rules come from Google's Premium Plan URL authorisation page. They differ from API key referrer rules, which catches people out during migration.

EntryCoversDoesn't cover
example.comwww.example.com, shop.example.com, example.com/any/pathexample.org
www.example.comwww.example.com/any/pathexample.com
https://example.comHTTPS pages on the domain and subdomainshttp://example.com
example.com/storesexample.com/stores/londonexample.com/Stores, example.com/contact
http://example.com:8080That host on port 8080http://example.com

Entries without a scheme create rules for both HTTP and HTTPS. Hosts don't need to be public, so intranet names and internal IP addresses are allowed.

The fix, step by step

Short term: authorise the URL

Only worth doing if the client ID still works on some URL. If it fails everywhere, skip to the long-term fix.

  1. 01Note the exact address of the failing page, including scheme, subdomain and any port.
  2. 02In Cloud Console, open the Client ID page for your Premium Plan project.
  3. 03Find the table headed Authorized URLs for Client ID gme-… and click Add URLs.
  4. 04Add the bare domain (for example example.com) so all subdomains are covered, unless you deliberately want to limit it.
  5. 05Reload the page in a private window and check the console.

Long term: replace the client ID with an API key

  1. 01In the Cloud project linked to your client ID, confirm an open billing account is attached, then create an API key under APIs & Services → Credentials.
  2. 02Set the key's application restriction to Websites. Translate each authorised URL into referrer patterns, as below.
  3. 03Restrict the key to the Maps APIs your page calls.
  4. 04Replace client=gme-… with key=… in the loader and remove any signature=.
  5. 05Clear page and CDN caches, then test.
Translating URLs to key referrers

A client ID entry of example.com silently covers every subdomain and path. An API key needs that spelled out. Add both example.com/* and *.example.com/*. Skip this and the migrated page fails with RefererNotAllowedMapError instead. Our referrer guide covers the patterns in detail.

HTML
<!-- Before -->
<script src="https://maps.googleapis.com/maps/api/js?client=gme-yourcompany&callback=initMap"></script>

<!-- After -->
<script async
  src="https://maps.googleapis.com/maps/api/js?key=AIzaSy...your-key&loading=async&callback=initMap"></script>

Common situations

  • Staging and preview sites. Hosts like staging.example.com are covered by an example.com entry, but agency preview hosts on another domain need their own entry, or their own restricted key after migration.
  • Site moved to HTTPS. If the list only had http:// entries, every page broke at once on the switch.
  • CMS or plugin with a client ID field. Older store locators had a separate client ID setting. Clear it and use the API key field, so only one loader runs. See duplicate loader problems.

Confirm it is fixed

Load the failing URL in a private window with the console open. The error should be gone and the map should render. If you migrated to a key and now see RefererNotAllowedMapError, the key works and only its referrer list needs widening.

Run a scan of the page. It shows which credential the loader sends, so you can confirm client= is gone from every Maps request, including ones injected by plugins.

Common questions

Why does the map work on www but not the bare domain?

Your list probably authorises www.example.com only. A domain entry covers its subdomains but not its parent. Add example.com, or better, migrate to an API key with both patterns.

How many URLs can I authorise on a client ID?

Google's current page doesn't state a limit. Because one domain entry covers all its subdomains and paths, most sites only need a handful of entries.

Is this the same as RefererNotAllowedMapError?

It's the client ID version of the same check. RefererNotAllowedMapError applies to API keys and uses different matching rules.

Will adding the URL fix it permanently?

No. Client IDs can no longer be used after 31 May 2026, so any fix to the URL list is temporary. Move to an API key.

Check whether this is your error

A scan tells you in about twelve seconds, from a clean session.

Related articles