Google Maps API & Whitelisting Local

When using the Google Maps API in Local, you apparently need to whitelist either the hostname or the IP address you’re running the local server with in the Google API. Problem is, I can’t figure out what IP address to whitelist. I get the “Referrer Not Allowed” error in the console after whitelisting my own personal IP address.

Does Local use some other IP address that I should be whitelisting so that I can develop this Maps-integrated app in Local?

If you use the Local domain – example.local does that get you any closer? Maybe there’s caching involved, so keep that in mind.
Can you provide a screenshot of the errors that you are seeing?

The Local Virtual Machine is created on a host-only network with VirtualBox. By default, I think it’s 192.168.95.100. If you open the Hosts file, you should be able to see what IP address is that Local sites are using. That being said, since it is a Host-only network, I wouldn’t think that this IP would satisfy Google Maps restrictions, but maybe?

Ok, I was able to get this working… Apparently it’s better to just switch your API key to restrict by hostname rather than IP address. I’ve added https://domain.local to the whitelist and things are working now.

Also, something worth noting is that you have to whitelist both protocols if you plan on accessing from https.

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.