应用程序配置:localhost不允许使用URL

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.

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.

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 :)