simplemap icon indicating copy to clipboard operation
simplemap copied to clipboard

Maps API called into admin page multiple times pulls in server key rather than browser key

Open russback opened this issue 5 years ago • 2 comments

Description

The console is showing this error: You have included the Google Maps JavaScript API multiple times on this page. This may cause unexpected errors.

In the source code:

Craft.registeredJsFiles["https://maps.googleapis.com/maps/api/js?key={BROWSER_KEY}"] = true;
  | Craft.registeredJsFiles["https://maps.googleapis.com/maps/api/js?libraries=places&key={SERVER_KEY}"] = true;

The map field is showing an error due to a referrer issue as the browser key is restricted to particular referrers, and the server key is restricted to IP. As the server key is being called on the frontend that causes a failure. You can't set a restriction on both referrer and IP, so the only option I have is to remove the restriction on IP but I've seen keys scraped in the past that have lead to huge billing issues.

Additional info

  • Craft version: 3.5.0
  • Maps version: 3.9.0.2

russback avatar Dec 21 '20 09:12 russback

Hey. Has this plugin been abandoned?

russback avatar Apr 21 '21 11:04 russback

We encountered the exact same issue today. Is there a solution to this problem other then removing the restrictions from the APIs?

Additional info

  • Craft Version: 3.7.65
  • Maps version: 3.9.4

holmey avatar Feb 21 '23 20:02 holmey