我使用ASP . net和Facebook Connect api。但是当我运行应用程序并按下连接按钮时,它返回到网站,而不是返回到测试本地服务器(http://localhost:xxxx/test.aspx) 那么我如何在本地测试Facebook(即我如何可以改变回调url) ?


当前回答

在www.facebook.com/developers/编辑你的应用程序,并将“站点URL”设置为“http://localhost/myapppath”。

完成后,把它改回来。

其他回答

最后测试201/06/07

只是补充一下@Erdal_G的精彩回答和我的成功经验:

Apparently, HTTPS is needed even in the local environment (I used the library https-localhost). [I don't know if this is mandatory] create a test app from the main app (https://developers.facebook.com/docs/development/build-and-test/test-apps/) Set the redirect OAuth URI to https://localhost:<MY_PORT>/auth/ and update also all other URIs in .../instagram-basic-display/basic-display/ settings accordingly. Finally, don't forget to use the client-id (aka app-id) and app-secret of the test app in the requests, which are different than the parent app

在www.facebook.com/developers/编辑你的应用程序,并将“站点URL”设置为“http://localhost/myapppath”。

完成后,把它改回来。

看来facebook又改变了应用开发页面,增加了一个叫做“服务器IP白名单”的功能。

进入你的应用程序,选择设置->高级选项卡 获取你的公共IP(谷歌会告诉你如果你谷歌“我的IP是什么”) 将您的公网IP添加到“服务器IP白名单”中,单击下方的“保存更改”

你不需要做任何困难的事情!

Facebook→设置→基本设置:在“App”中输入“localhost” 域”字段,然后点击“+添加平台”选择“网站”。 之后,在“站点Url”字段中写入您的本地主机Url(例如:http://localhost:1337/something)。

这将允许你在本地测试你的facebook插件。

创建2个应用程序

/初始化/ env_variables.rb

if Rails.env == 'development'
    ENV['FB_APP_ID'] = "HERE"
    ENV["FB_SECRET"] = "HERE"
else
    ENV['FB_APP_ID'] = "HERE"
    ENV["FB_SECRET"] = "HERE"
end