Facebook doesn't care what the actual IP address is on your server, but it will check that the domain name of the link page matches the domain registered in facebook. The trick to getting it working during development is to find a way to use your domain name, even if you just work on your local development machine.
If you have full control over your DNS records, you can add a host record (for example, "test.yourdomain.com") that either points to the real IP address of your development machine (if it is a static ip), or simply up to 127.0.0.1
If you donโt have access to your DNS, then the easiest way to get around this during development is to simply add an entry to your computerโs file ("/ etc / hosts" on OSX and most other Unix machines), specifying the domain that you registered on facebook on the local host computer. so you would add a line like this:
127.0.0.0 test.yourdomain.com
to the end of your hosts file. This means that if you log in to test.yourdomain.com now in your web browser, it will solve your local machine.
Now - in the "website" section of your Facebook application setup, make sure you add your domain name to the "website domain" section of this parameter - this will mean that Facebook will accept requests coming from any subdomain in other words, it will accept requests from "www.yourdomain.com" (your production server) and "test.yourdomain.com" (your local development machine).
Now you should just be able to develop your local machine using the URL "test.yourdomain.com" in your browser, not "localhost", and everything should work.
OH is another thing - redirecting uri to facebook will also need to have a port number if your development server is not running on port 80, but it includes this port number when matching the domain url (to be honest, I think this is a facebook API error ) This means that if your development server (for example) is running on port 8080, you need to add ': 8080' to the end of the host name in the redirect URI, but if your production server works on port 80, then you should not put ": 80" in the uri redirect, because otherwise it will only work when people explicitly include the port number in the URL that they used to view yours (unlikely on a working server). All this in practice means that you just need to have a conditional condition so that when generating the facebook authentication URL you include only the port number, if it is not port 80.
jportway Jun 14 2018-11-12T00: 00Z
source share