Skip Navigation

[Gelöst] google map Api key – restriction ip and referrer

Dieser Thread wurde gelöst. Hier ist eine Beschreibung des Problems und der Lösung.

Problem:

I get this error when using maps:

if the API-Key with ip-restriction active - it will show "Google API Key is good" - with second url-referrer API-Key - "REQUEST_DENIED - API keys with referer restrictions cannot be used with this API."

Solution:

Please make sure you set the referrer restrictions correctly on your Google Console.

Relevant Documentation:

https://toolset.com/course-lesson/creating-a-maps-api-key/

This support ticket is created vor 12 Monaten. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Heute stehen keine Supporter zur Arbeit im Werkzeugsatz-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.

Dieses Thema enthält 7 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von Christopher Amirian vor 11 Monaten, 3 Wochen.

Assistiert von: Christopher Amirian.

Author
Artikel
#2663077
Bildschirmfoto 2023-11-10 um 15.42.29.jpg
Bildschirmfoto 2023-11-10 um 15.42.10.jpg
Bildschirmfoto 2023-11-10 um 15.41.59.jpg

Hi,

i have a radius based search, that work fine, if the google api ist restricted on ip, but in frontend it shows in "Location Field" with Error of Api (see in console) -> Screenshot

i have two API-Keys one with ip-restiction (which work) and one with url-restriction (optional) in Settings of Toolset Maps. (Screenshot).

Both API-Keys are working.

if the API-Key with ip-restriction active - it will show "Google API Key is good" - with second url-referrer API-Key - "REQUEST_DENIED - API keys with referer restrictions cannot be used with this API."

What the hack - i cant find the fault.

this is the page: versteckter Link

can you help me - thx - best regards - alex

#2663759

Christopher Amirian
Supporter

Sprachen: Englisch (English )

Hi Alex,

"If Google Maps API key is restricted by domain, that may not work for users with multiple domains or subdomains. To solve this, you can enter a second API key for Google Maps, in the Toolset settings. When added, this second key is used exclusively for server-side requests. This means it is never exposed in HTML and does not need restrictions. If you want extra security, you can restrict it, but only by IP addresses, not by domains."

On your case, try to add the domain without the subfolder and see if it works. Also test by adding with the trailing slash or without it.

In general that restriction is related to Google itself and Toolset doe snot have any say on this.

Thanks.

#2664051
Bildschirmfoto 2023-11-13 um 11.23.50.jpg
Bildschirmfoto 2023-11-13 um 11.23.05.jpg

Hi,

the first key is restricted to IP - the second, now is not restricted - in Toolset-Settings its now green. - But on Front in View the Field for center-location "of" gives the error from google. And Subdomains are all ready for use for GoogleMaps API.

best regards - alex

#2664161

Christopher Amirian
Supporter

Sprachen: Englisch (English )

Hi there,

I'd appreciate it if you could give me the URL/User/Pass of your WordPress dashboard after you make sure that you have a backup of your website.
It is absolutely important that you give us a guarantee that you have a backup so if something happens you will have a point of restore.

Make sure you set the next reply as private.

Also tell us which page to check to see the Javascript error.

Also please give us permission to change the admin language to English to know where to check.

Thanks.

#2664615

Christopher Amirian
Supporter

Sprachen: Englisch (English )

Hi Alex,

Thank you. Asked for a second opinion and will get back to you.

#2664657

Christopher Amirian
Supporter

Sprachen: Englisch (English )

Hi there,

The second-tier support asked me to check with unrestricted key and see if it works ok. If yes, then there is nothing Toolset can done and you need to make sure you set the restriction correctly as the error is coming from Google.

I checked and indeed that is the case.

Pleas make sure you set the referrer restrictions correctly on your Google Console. For more information:

https://toolset.com/course-lesson/creating-a-maps-api-key/

Thanks.

#2664663

Hi thx -

i reply in Private Message above the API Keys with restriction details.

thanks for helping, alex

#2665003

Christopher Amirian
Supporter

Sprachen: Englisch (English )

Screenshot 2023-11-15 at 18.10.06.png

Hi there,

It seems that there is a misunderstanding. I mentioned that the issue is not related to Toolset and you need to set the restrictions in Google.

If you check now, I used your unrestricted key and everything works.

Toolset does not have any control over Google denying the access.

Hope I could explain better.

#2666443

hi Christopher,

thx a lot, but this is was i tried before i wright you - now it works, thanks and best regards - alex