我今天大部分时间都在试图解决这个问题。我正在开发一个Facebook应用程序,以用户身份登录,然后访问他们的朋友列表。
登录功能在我的本地主机上没有问题,但是当我部署我的应用程序并通过iframe中的Facebook访问它时,它不起作用。我得到了Login按钮但是当我点击它时,我得到一个弹出窗口,它只是闪烁,如果我刷新页面,那么它就不会登录。
我当然会在两个实例之间相应地更新App Id,以匹配我在FB中配置的两个应用程序。我的代码是来自Facebook Developers部分的基本代码,显然包含我的AppId和我的域名,用于channel.html文件的位置。
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
// init the FB JS SDK
FB.init({
appId : 'MY_APPID', // App ID from the app dashboard
channelUrl : '//MY_DOMAIN/channel.html', // Channel file for x-domain comms
status:true, // check login status
cookie:true, // enable cookies to allow the server to access the session
xfbml:true, // parse XFBML
oauth:true // Look for social plugins on the page
});
// Additional initialization code such as adding Event Listeners goes here
};
// Load the SDK asynchronously
(function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<!-- End Fb-->
我的Facebook应用设置设置如下:
Sandbox Mode
- On
Listed Platforms
- Website with Facebook Login, App on Facebook
我在控制台中没有出现任何错误,并且在Facebook应用程序设置和我的应用程序之间进行了双重/三重检查。
我在网上有一个很好的搜索,但帮助其他人的所有解决方案都没有让我到处或与我的问题无关。我也尝试调整设置,看看我是否能获得运气但无济于事。
没有错误的事实使得很难尝试找出问题的来源。
是否有人对可能的调查领域或如何调试问题有任何建议?
非常感谢您的帮助。
非常感谢,
格雷格