Forum Replies Created

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • in reply to: Split: API restricted and IP address #58543
    Adam
    Participant

    That’s great news! Glad to hear it!

    I’m confused on what you mean by the requests being routed to where the WordPress install is. As far as I know, typically a WordPress site will be running on the same IP. I haven’t had a chance to look into why the site is setup the way it is, but that could have something to do with why I had the wrong IP in the first place.

    in reply to: Split: API restricted and IP address #58516
    Adam
    Participant

    Hi Cici,

    I’ve actually managed to fix the issue, thanks to Google’s support team. Apparently I had the wrong IP address all along… I was using the IP my server’s cpanel gave me, which is also the same IP I get back when pinging the website – I was positive it was correct. There must be some sort of weird setup going on with this server where the website responds with one IP, but the server-side code actually runs using a different IP – not sure.

    These are the instructions Google gave me to get the correct IP:

    If you open the network tab of the developer console (in Chrome : right click page > select ‘inspect’ > click ‘network’ in the pane that appears on screen), then enter a zip code and press find location, then click the ‘XHR’ tab in the network tab, the most recent request should be the zip code you just entered. Click on it and then to the right click ‘response’. Here you will find the response form the server, which for me was as follows:

     

    {“error_message”:”This IP, site or mobile application is not authorized to use this API key. Request received from IP address xx.xx.xxx.xxx, with referer: https:\/\/maps.googleapis.com\/maps\/api\/geocode\/json?language=en&region=us&key=AIzaSyDFm……….MU9b0&address=78705″,”results”:[],”status”:”REQUEST_DENIED”}

     

    Thanks a lot for your help and patience! Great support you provide here!

    in reply to: Split: API restricted and IP address #58508
    Adam
    Participant

    Right, it’s the server’s direct address. Yes I’m on version 5.03 of the plugin.

     

    I’ve opened a support case with Google, will report back with anything useful.

    in reply to: Split: API restricted and IP address #58505
    Adam
    Participant

    Update: I’ve looked through the code and it does appear that the request is being sent from the server-side. I’ve logged the response I get from Google and it says “API keys with referer restrictions cannot be used with this API.” even though the restriction I’m using is an IP address…

    in reply to: Split: API restricted and IP address #58497
    Adam
    Participant

    Hi Cici,

    Unfortunately I don’t have one setup right now, but I could set one up if you need it. I could send you the production link to our SLP form if that helps?

    in reply to: Split: API restricted and IP address #58490
    Adam
    Participant

    Hi Cici,

    I’ve read your Google Geocoding Key documentation and it’s definitely setup according to this documentation.

    To clarify my post above, if I go to this url (https://maps.googleapis.com/maps/api/geocode/json?components=postal_code:T1S%7Ccountry:CA&key=) and put my Geocoding key in the key parameter, it will block the request because the IP my computer is using is different than the server IP which isn’t allowed to use it. So assuming the server is doing something similar, the SLP should get results back, right? However, if I add my own IP to the list of restricted IPs, going to that same URL will return results correctly and the SLP works properly. This tells me that the Geocoder request is being sent from the frontend, instead of the server. Is there a configuration I could be missing somewhere? Shouldn’t the request be sent from the server?

    I could unrestrict the API key but that leaves it open to be used by anyone and run up our costs.

     

    Hopefully that makes sense, let me know if there’s anything that’s still confusing.

    • This reply was modified 5 years, 11 months ago by Adam.
    • This reply was modified 5 years, 9 months ago by Cici.
    in reply to: Split: API restricted and IP address #58489
    Adam
    Participant

    Hi Cici,

    The issue has actually come back… My Google Maps API key is restricted by IP address, which according to Google, is the only restriction you’re allowed to use with the Geocoding API. I have the IP set to the server IP but it doesn’t seem to allow requests unless I add in my own public IP address. So since the Geocoding API request isn’t coming from the server, is there a way I can set it up to do that? How can I get this to work with an API key restricted by IP?

     

    Really appreciate the help you’ve provided. I will leave a great review for you right now!

    in reply to: Split: API restricted and IP address #58436
    Adam
    Participant

    Fixed the issue. I was restricting my key by IP address because that’s what Google says is the only restriction you can use on a Geocoder API key. I switched the restriction to the http referrers and put the site address in with a /* at the end. This combined with the plugin update has resolved my issue.

Viewing 8 posts - 1 through 8 (of 8 total)