36

Hi I wan't to create a facebook app to use it for the auth in my new site locally installed(my machine),but from yesterday I don't succeed to install it and use it, all time I have this very strange error when I wan't write a domain in the "App Domains" :

This must be derived from Canvas URL, Secure Canvas URL, Site URL, Mobile Site URL, Page Tab URL or Secure Page Tab URL. Check and correct the following domains

the domain of my application is http://localhost/project/app_dev.php/ it dosn't work I change it by a real url such as : http://www.exemple.com/,but I had the same error,and just I notice that I see this error when I create an app with new look of facebook (yesterday)...

Damjan Pavlica
  • 31,277
  • 10
  • 71
  • 76
user3001795
  • 515
  • 1
  • 5
  • 8

6 Answers6

95

In my case the problem was I hadn't completed the "+ Add Platform > Website" section. Once I did that the contents of App Domains became valid and the error went away.

facebook app settings screen

ob1
  • 1,792
  • 15
  • 20
  • My answer always had that info at the bottom, may be you didn't read that part. I've rearranged the text for a better flow. – Spundun Sep 04 '14 at 20:45
  • Facebook keeps changin – Dr Deo Nov 06 '16 at 09:12
  • 1
    This works flawlessly! Thanks!! To add clarity to the above answer, you have to click "+ Add Platform", choose "Website" then enter "localhost" in the Website section. Only then will Facebook allow "localhost" in the "App Domains" section. – Cliff Dec 28 '16 at 23:58
71

I had this same problem yesterday, the stackoverflow answers that helped me the most were Make local development work with Facebook/Google APIs and Canvas URL / Secure Canvas URL error message ( Also checkout How to handle OmniAuth callbacks in multiple environments?)

The Facebook developer UI has changed a bit. I'm writing this answer to consolidate all the info that helped me.

1. Make local.host Point to Your Computer

First thing you need to do is (as answered in the first link), facebook won't take localhost as a valid callback site, because it confuses localhost with a top level domain (com org etc.) in other words there is not dot . in your domain name. So change your /etc/hosts to add the entry

127.0.0.1   local.host

Now youcan access your app at http://local.host/... (this will take effect as soon as you save /etc/hosts file, no need to restart anything)

2. Add local.host as the Site URL on the facebook Dev Console

The second thing you need to do is add local.host as the site url on the facebook page

Now don't use your production app. Add a dummy app on your https://developers.facebook.com account Because your production app will have to set the site URL to your production URL and not local.host

Configure the dummy app as shown in the screenshot. But that website section(shown in the screenshot) won't be visible on the Basic settings page from the beginning.

First you will have to click + Add Platform button at the bottom, and select Website.

Notice I added http://local.host:3000/. That's where my ruby server runs in dev mode.

Facebook Dev Console Screenshot

Also, be sure to use App Id and App Secret for the dummy app when running your webapp in dev mode.

HTH.

Community
  • 1
  • 1
Spundun
  • 3,936
  • 2
  • 23
  • 36
  • 1
    This was the only solution that worked for me. All the other solutions mentioned placing 'localhost' in the App Domain. But, that produced an error. Facebook must have made it no longer work recently. – dbasch Jun 02 '14 at 16:33
  • Facebook really need to put a bit of thought into their documentation about this. It seems to be intentionally confusing right now. Anyway, this has worked for me too. – frumbert Aug 05 '15 at 02:44
  • 1
    I was able to do this without the `.` in localhost. I think Facebook fixed that aspect of this issue – Matt Koala May 18 '16 at 05:20
8

My problem was that logging in with facebook wasn't working for my app.

It turned out that I just needed to fill in the "Valid OAuth redirect URIs" field on the "Advanced" tab.

e.g. http://example.com/auth/google/callback

Brett Pennings
  • 1,489
  • 14
  • 19
8

I'd a similar problem, Facebook have changed now on left pane file login (After selecting you app from top left corner) -> Valid OAuth redirect URIs

Sven Schoenung
  • 30,224
  • 8
  • 65
  • 70
Naveen
  • 491
  • 5
  • 6
1

If you work on desktop app like WPF or winforms and use a WebBrowser Control to log in with the Facebook SDK. You have to set to yes the Embedded Browser OAuth Login in Advance Tab of your facebook apps setting. hope I help

1

Chose "Add platform" at the bottom and give your localhost url. "http://localhost:port/".

After this step. Facebook allows you to add localhost:port as your domain url.

After these 2 steps you can test "login with facebook" without any trouble.

r3doc
  • 69
  • 6
  • This should be the accepted answer. As a reference see https://www.facebook.com/help/community/question/?id=589302607826562 – lboullo0 May 11 '17 at 13:33