Skip Navigation

[Résolu] google map Api key – restriction ip and referrer

Ce fil est résolu. Voici une description du problème et la solution proposée.

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 Il y a 5 mois et 2 semaines. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

This topic contains 7 réponses, has 2 voix.

Last updated by Christopher Amirian Il y a 5 mois et 2 semaines.

Assisted by: Christopher Amirian.

Auteur
Publications
#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: hidden link

can you help me - thx - best regards - alex

#2663759

Christopher Amirian
Supporter

Languages: Anglais (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

Languages: Anglais (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

Languages: Anglais (English )

Hi Alex,

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

#2664657

Christopher Amirian
Supporter

Languages: Anglais (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

Languages: Anglais (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

alexd-6 confirmed that the issue was resolved on 2023-11-20 07:06:27.
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.