即使使用正确的网站网址,Facebook登录也无效

时间:2013-10-03 10:40:16

标签: facebook facebook-login

我在tomcat中部署了我的Web应用程序。应用程序通过URL加载正常:
http://domain.com/portal-app/ (domain.com = 10.124.23.33:8081我无法在网址中输入ip:port。)我还在我的应用设置页面中粘贴了相同的网址。 但是在加载主页时我仍然在控制台上收到错误。我也没有得到js警报。当我点击“登录”按钮并输入用户名和密码时,它只会在Facebook弹出窗口中抛出相同的消息。任何有关这方面的帮助将非常感激。

  

“应用程序配置不允许使用URL:应用程序的设置不允许使用一个或多个给定的URL>>它必须与网站URL或Canvas URL匹配,或者>>> ;域必须是应用程序域之一的子域。“

我曾多次在应用设置中验证网址。我在浏览器和Facebook中使用的应用程序URL都是相同的。相反,我只是复制粘贴的网址。 这是代码

<html>
<body>
<div id="fb-root"></div>
<script>

//Load the SDK asynchronously
(function(d){
 var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
 if (d.getElementById(id)) {return;}
 js = d.createElement('script'); js.id = id; js.async = true;
 js.src = "./js/all.js";
 ref.parentNode.insertBefore(js, ref);
}(document));

window.fbAsyncInit = function() {
  FB.init({
    appId      : '488834651123456',
        channelUrl : 'http://domain/portal-app/channel.html',
    status     : true,
    cookie     : true,
    xfbml      : true
  });

  FB.getLoginStatus(function(response) {
        alert(response.status);
        if (response.status === 'connected') {
          alert("hi");
        } else if (response.status === 'not_authorized') {
          FB.login(function(response) {
                if (response.authResponse) {
                    alert("hi");
                } else {
                    // The person cancelled the login dialog
                }
            }, {scope: 'user_about_me,user_birthday,user_groups,user_hometown,user_interests,user_likes,user_location,read_stream'});
        }else {             
              FB.login(function(response) {
                    if (response.authResponse) {
                        alert("hi");
                    } else {
                        // The person cancelled the login dialog
                    }
                }, {scope: 'user_about_me,user_birthday,user_groups,user_hometown,user_interests,user_likes,user_location,read_stream'});                 
        }           
      });
};

</script>
    <fb:login-button show-faces="true" width="200" max-rows="1"></fb:login-button>
</body>
</html>

1 个答案:

答案 0 :(得分:0)

看起来channelUrl缺少.com,并且在初始化函数中应该是http://domain.com/portal-app/channel.html