Facebook App: localhost no longer works as app domain
You can still test your app without deploying it on a remote sever like heroku.
The trick is to update the etc/hosts
file this way:
127.0.0.1 mydomain.com
Then on the Facebook App's settings, type [http://] mydomain.com, without the "[" and "]"
It worked for me this way
- Go to your App's settings page in http://developers.facebook.com
- Click on the dropdown arrow on the top left (next to the name of your app) and click "Create Test App" and give it a name
- In the Settings > Basic of that new Test App set the App Domains as "localhost"
- Also set the Website Site URL as "http://localhost:8888" (or whatever port you are using).
- IMPORTANT: this app has different App ID and App Secret from your online application. So, last step: make sure that you update the code that sits in your localhost with the Test App's App ID and App Secret. On the contrary, the code that sits in the live server should be using the main App's ID and Secret.
The protocol seems to keep changing, and the accepted answer didn't work for me today. In case it helps other searchers, this is what did work for me:
- All changes were made on the Settings page under the Basic tab
1.) In the center under the first box of options, click "+ Add Platform" and choose "Website" (or whatever is appropriate for your app.)
2.) In the box that comes up for the website you just added: Site URL: http://localhost:3000/
3.) In the box above that (Settings => Basic): App Domain: localhost
4.) At the bottom right - click "Save Changes"
5.) Make sure you have the app ID copied and pasted correctly into your code. (The ID is in the first box on that page if you need it again.)
For everybody who is fidgeting with this in 2017. The interface changed again. I wanted to comment this to the answer but I don't have enough reputation. The localhost url of your app now has to be copied to three places. Currently, (October 26th, 2017) the sequence is:
1.) Click "Settings" in the left menu.
2.) In the center under the first box of options, click "+ Add Platform" and choose "Website" (or whatever is appropriate for your app.)
3.) In the box that comes up for the website you just added copy your localhost site url (f.e. http://localhost:3000/)
4.) In the box above that "App Domain" copy the same URL
5.) At the bottom right - click "Save Changes"
6.) In the left menu under "Products" click "Facebook Login" (or add it via "+ Add Products" if it is not available)
7.) You are now in the Facebook Login settings. Copy the same url to the field "Valid OAuth redirect URIs"
This should work.