4

I need to use the Google Places API through PHP in a Wordpress site hosted on Flywheel.

It seems the option I need to use is the IP addresses (web servers, cron jobs, etc.).

My problem is that flywheel has a dynamic IP address system and after a couple of days the API stops working since the IP has changed.

I' trying to see if I can authenticate the site using something else but I have not been able to find it. I've looked at googleapis/google-api-php-client but the Places API is not part of the APIs the package can connect.

Do you know how If there is any other way to whitelist a site for a web server with a dynamic IP?

Juan Solano
  • 1,188
  • 1
  • 17
  • 32

1 Answers1

0

It's not necessary to use the API key restriction. You don't need to restrict it by an IP address. It's an optional feature per key.

I'll try to give you at least an option/suggestion because I'm not sure how you intent to use the Google Place API but you can basically create 2 separate keys:

  • One public API key for browser based calls (show map, suggestions, etc..). In this case I would use HTTP referrer for as restriction and add your websites where this key is running.
  • One private API key for server based calls (server2server, queue, cronjobs, etc..). Since you have a floating IP you would need to know the full range. In this case I would not "additionally" restrict it by the IP address and only use the secret.

Another suggestions in case your really really want to restrict this additionally:

  • Ask flywheel if they can give you a dedicated IP address. A quick google lookup showed some forums which indicate that they support it. Attention: I'm sure they will charge you for this additional money.
  • Move your cronjobs, queues, ... away from flywheel and host it somewhere, where you have control of the IP address. (e.g. AWS EC3 t3.nano with an elastic ip address - costs you ~$5/month)

Hope this helps and gives you some impressions about your options. Let me know if this answers your question or if you need and further information.

Christoph Kluge
  • 1,947
  • 8
  • 23