我一直在开发一个使用 Facebook 附加组件的应用程序,使 Facebook 用户能够登录并允许该应用程序访问个人资料图片等详细信息。
昨天,该应用程序运行良好,我的开发工作如常进行。
今天早上,我尝试登录以检查我的进度,但遇到了访问 token 错误消息。
个别局部 View 可以正常加载,但整个站点不会。在进一步调查中,我发现登录屏幕分配了一个新的访问 token ,但当站点试图调出母版页时,该 token 为空。
我的登录如下:-
<html>
<head>
<title>Log On</title>
</head>
<body>
<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({
appId : '***app no***',
status : true,
cookie : true,
xfbml : true,
oauth : true
});
FB.Event.subscribe('auth.login', function () {
window.location.reload();
});
};
(function(d){
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
d.getElementsByTagName('head')[0].appendChild(js);
}(document));
</script>
<div class="fb-login-button" data-scope="email">
Login with Facebook
</div>
</body>
</html>
这让我头疼。
返回的错误是(OAuthException)必须使用事件访问 token 来查询有关当前用户的信息。
希望这些信息足以让人们找到解决方案。
非常感谢
最佳答案
您还没有设置 channel url 即您的网站路径(可以是本地主机或服务器域)
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({
appId : '***app no***',
channelUrl : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel File for x-domain communication
status : true,
cookie : true,
xfbml : true,
oauth : true
});
此外,您还必须在 developer.facebook.com 中设置您的 url 路径,从那里获得您的应用程序 ID.....
关于asp.net-mvc - MVC App 不再通过 Facebook 登录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13748327/