Skip Navigation

[Closed] Restricted API key for Maps not accepted

This support ticket is created 2 years, 3 months ago. 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.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 7 replies, has 2 voices.

Last updated by Minesh 2 years, 2 months ago.

Assisted by: Minesh.

Author
Posts
#2569127
Schermata 2023-03-09 alle 09.49.54.png

Hi there,

I'm using Toolset Maps so I've created API keys for my website. Here https://toolset.com/course-lesson/creating-a-maps-api-key/?utm_source=toolsetmapsplugin&utm_campaign=toolsetmaps&utm_medium=views-integration-settings-for-api-key&utm_term=our%20documentation#api-key, I read that it's possible to set restrictions to protect the Key, so I've added restrictions.
The problem is the moment I insert the restricted key an error appears (see screenshot) and the only way I can use API is by inserting a non-restricted API key, which then gets flagged by Google Cloud Platform that warns me this is not a safe behaviour.
Could you please help me understand how this works?

thanks

#2569167

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Can you please share screenshot of your google map API settings that show me how exactly you are restricting the API key?

#2569173
Schermata 2023-03-09 alle 11.43.24.png

There you go, thank you

#2570185

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

As shared the details here:
- https://toolset.com/course-lesson/creating-a-maps-api-key/#problems-with-displaying-markers-on-google-maps

I think you should create a restriction with IP and please note that to enable IP restriction it may take 30 mins.

Please check the following answer as well:
- https://stackoverflow.com/questions/42167695/api-key-browser-api-keys-cannot-have-referer-restrictions-when-used-with-this-ap/42451277#42451277

#2571847

Hi Minesh,

thank you for your reply.
SO I've restricted one API key by IP. I've inserted this in the first field in Toolset>Maps>Google Map API key, and the other API key restricted by domain in the second field. It's still showing the error "REQUEST_DENIED - API keys with referer restrictions cannot be used with this API".
What am I supposed to do? I cannot switch them cause the one restricted by domain is not accepted in the first field..
If I remove the second one another error shows up: "REQUEST_DENIED - This IP, site or mobile application is not authorized to use this API key. Request received from IP address 35.214.254.216, with referer: -there's a link here with the Key-".
So I'm now wondering: which IP address should I insert when creating the key? I used my website IP address, but maybe that's wrong?!.

Could you tell me exactly where to insert which key please?

Thank you

#2572503

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

It may take sometime with google to restrict the IP entries - can you please check back after sometime.
OR
You can check with google map support to check why IP based restriction is not working.

Here are some hints - where it says "IP address restrictions only work for web services, not the Google Maps JavaScript API v3".
- https://stackoverflow.com/questions/48134596/google-maps-key-restrictions-by-ip-address-not-working

Maybe it will be great if you can get in touch with google map support and check with them what is the best practice in your case and how you can restrict it and by creating what restriction.

#2574343

Thank you Minesh.
I've followed all the guidelines provided by Google Cloud Platform but still it wasn't working.
Their support is not available for free so I'll have to check with the CLient.

Thank you

#2574809

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Sure - please update us with the answer from google support. We are interested to know.

The topic ‘[Closed] Restricted API key for Maps not accepted’ is closed to new replies.