Been trying to setup my Facebook app which I want to use for Logins to allow me to test it on my Mac's localhost. Facebook is throwing the error "App Domain: http://localhost is not a valid domain." when I try change App Domain of Site URL to localhost or 127.0.0.1
IS there any way to get the facebook login api to redirect the browser to my localhost after authentication?
Once you have your web app registered you can go to your app and click on add product. Add Facebook Login. Then enable Web OAuth Login and add your localhost in the textfield below and save, you should be able to access it. Attaching a sample screenshot of my facebook app.
A valid redirect URI is the URI within your application where Facebook will send you “stuff.” Meaning, the URI within your application where Facebook may send you an authorization code and an access token.
The way I do it is alias the site I'm working on to something like: http://sitename.loc, and then setup an app used specifically for testing with that as the domain.
An example of how to do this can be found here: https://stackoverflow.com/a/7493806/1056965
On your local machine you have to setup hosts file to point your site name on local ip address. For example if you have to setup authorization with fb on site example.com put this record in your hosts file
127.0.0.1 example.com
And just start your site localy and facebook oauth will redirect you on example.com and you will get valid token localy.
For setup hosts file on windows help is on this link Windows Hosts Setup Linux help link Linux hosts
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With