On the current app I'm working on right now we use two kinds of google maps APIs: places
and timezone
. Following on the documentation, I found that for timezone API we can't use the HTTP referrer
restriction type (but it works for places API). With HTTP referrer
for timezone
API, I'm getting the error API keys with referer restrictions cannot be used with this API.
which makes sense as for timezone API we need to restrict by IP addresses if follow to documentation.
But here the issue is appearing... When I adding the app server IP address to the list of allowed IPs for timezone
API it's still not working, and I'm getting an error like This IP, site or mobile application is not authorized to use this API key. Request received from IP address xx.xxx.xxx.xx, with referer: {my app domain}
, where xx.xxx.xxx.xx
is my IP not a server IP.
Probably it happens because of the call to the timezone
API which I made by javascript
var url = "https://maps.googleapis.com/maps/api/timezone/json?key={API_KEY}?location={Ylocation},{Xlocation}×tamp=" + d + "&sensor=false";
var ajaxObj = $.ajax({url:url, async:true, success:function(responseJson) {
Is that mean I need to make ajax call to the server (backend) and from there already make timezone
API call? If so, maybe there is another way to not refactor current logic?