2012-05-21 4 views
1
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'}); 
      }}); 

이 인증은 나에게 매우 효과적이며 무한 루프가 발생하는 한 사람을 제외한 대부분의 사람들에게 적합합니다.페이스 북의 무한 루프 로그인

잠시 동안 로그인 팝업 쇼가 열렸습니다 (이미 인증 됨). 그런 다음 팝업이 사라지고 사이트가 새로 고침되고 처음부터 시작됩니다.

IE, Firefox 및 Chrome에서 테스트했으며 아무런 문제가 없었습니다. 그는 Firefox에서 시도 중입니다.

누군가가 도와 줄 수 있습니까?

+0

이것은 PHP와는 아무런 관련이 없습니다. Javascript입니다! – Philip

+0

로그인 데이터를 PHP로 반환합니다. 그러나이 질문과 관련이 없기 때문에 태그를 제거했습니다. – MrTouch

답변

2

사용자가 쿠키를 사용하지 않도록 설정했을 수 있습니다.

+0

실화 ... 그것에 대해 생각해 봤어야 했어. ^^ – MrTouch

관련 문제