-2

I am testing my application in localhost. When I clicked on fb login I got an error

> Given URL is not allowed by the Application configuration.: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains.

I referred this question but it's about online application. Here I want to test it locally. What should I give in App Domains?

My application name say http://localhost/fblogin. and what should be redirect_url?

I tried to give App Domain : http://localhost/fblogin but it gives me error like

> App Domains: `https://localhost/fblogin` should not contain protocol information.
Community
  • 1
  • 1
404 Not Found
  • 1,223
  • 2
  • 22
  • 31
  • _“should not contain protocol information”_ – and what’s your problem understanding that? Don’t know what a protocol is, and that a domain name is something different than a URL …? – CBroe Oct 15 '13 at 11:02
  • The domain name would just be `localhost`, nothing else. – CBroe Oct 15 '13 at 11:23

2 Answers2

2

I was only able to test facebook apps locally by setting up a virtual host URL. In case you're un-familiar with virtual hosts the basic effect is that when you direct any browser on your computer some URL of your choice (it could be www.yahoo.com if you want) it points to local a directory instead of looking for that URL on the internet. This way you'll be able give facebook the http:// URL it wants while staying local. I was able to set up a virtual host on my Mac using the following tutorial.

Ben Pearce
  • 6,884
  • 18
  • 70
  • 127
  • Testing via `localhost` is not a problem, as long as nothing is involved that requires Facebook to actually request data from your domain (as f.e. Open Graph objects) – using it to test functionality like login works totally fine, I use it that way all the time when developing apps. – CBroe Oct 17 '13 at 06:42
2

I suggest you add a development subdomain and point it to your localhost.

In Mac OSX edit /etc/hosts in the terminal

sudo vi /etc/hosts

Then add the following line to the end of the file (replace "mydomain.com" accordingly)

127.0.0.1 dev.mydomain.com

Then save, hit the ESC key

:wq

Then flush the cache

dscacheutil -flushcache

Now add that domain to your facebook app domains

MyFacebookApp -> Settings -> Basic -> App Domains

Now instead of using

http://localhost:3000 

to test your app, try

http://dev.mydomain.com:3000 

(assuming port 3000)

Should work :)

Will
  • 271
  • 1
  • 3
  • 12
  • i have tried it long back but for me it didn't work :( – 404 Not Found Apr 16 '14 at 12:47
  • Maybe I can help,... are you still interested? Are you on OSX or Windows? – Will Apr 16 '14 at 14:49
  • yes i am interested... i am using ubuntu and i have already setup my host file with 127.0.0.1 dev.mydomain.com and i am accessing it from the same url which is dev.mydomain.com – 404 Not Found Apr 17 '14 at 05:37
  • sorry for the delay in my response.. I just moved and didn't have an Internet connection. If you are able to access your local webapp via dev.yourdomain.com , Now you have to configure that subdomain in the App domains field in the facebook app settings page. Make sure you include yourdomain.com too in that field... can you send a screenshot? so I can help you further.. – Will Apr 19 '14 at 16:45
  • which screen you want? – 404 Not Found Apr 21 '14 at 06:33
  • app settings at developers.facebook.com – Will Apr 22 '14 at 18:42
  • After doing quite a bit of reading on SO, this is the only thing that worked for me. Thanks. Clever solution for local development. – abhillman Apr 14 '15 at 04:27