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


当前回答

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

完成后,把它改回来。

其他回答

我建议在https://developers.facebook.com/apps上创建一个测试应用程序(仅适用于开发环境),并将:Website with Facebook Login属性设置为您的localhost:[port]设置。 这个选项可以很好地工作,不需要更改主机。 记住,一旦你上线,将appId改回你的生产应用。

编辑-在最新的fb版本中,你会在设置选项卡下找到它。

最后测试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

我不能使用其他的解决方案……对我来说有用的是安装LocalTunnel.net (https://github.com/danielrmz/localtunnel-net-client),然后在Facebook上使用生成的url。

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

完成后,把它改回来。

Facebook增加了测试版本功能。

首先,添加应用程序的测试版本:创建测试应用程序

然后,将Website下的Site URL更改为“http://localhost”,按保存更改

这就是全部内容,但要小心:应用程序ID和应用程序秘密密钥对于应用程序及其测试版本是不同的!