var login = false;
 FB.getLoginStatus(function(response) {
          if (response.status === 'connected') {
              console.log('connected');
              login=true;
                // the user is logged in and connected to your
                // app, and response.authResponse supplies
                // the user's ID, a valid access token, a signed
                // request, and the time the access token
                // and signed request each expire
                var uid = response.authResponse.userID;
                var accessToken = response.authResponse.accessToken;
          }
          else{
              FB.login(function(response) {
               if (response.authResponse) {
                 console.log('Welcome!  Fetching your information.... ');
                 FB.api('/me', function(response) {
                   console.log('Good to see you, ' + response.name + '.');
                   if(login===false)
                   {
                       window.open("http://www.facebook.com/EnergyZuerich/app_332399760133904", "_top");
                   }
                   //window.location.href=window.location.href;
                   //FB.logout(function(response) {
                     //console.log('Logged out.');
                   //});
                 });
               } else {
                 console.log('User cancelled login or did not fully authorize.');
               }
             }, {scope: 'email'});
          }});


这种身份验证对我和我公司中的大多数其他人有效,除了一个人,它会导致一个无限循环。

Login Popup Show的显示时间很短(他已经通过身份验证)。然后弹出窗口消失,站点刷新,并且从头开始。

我用IE,Firefox和Chrome浏览器进行了测试,没有问题。他正在用Firefox尝试。

有人可以帮我吗?

最佳答案

用户可能禁用了cookie。

关于javascript - 登录Facebook无限循环,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/10681919/

10-12 06:22