1

FB의 로그인을 사용할 수있는 로그인 시스템을 만들고 싶습니다. 그래서 FB 객체와 SDK를 내 페이지에 설치 한 다음 auth.authResponseChange 이벤트에 가입하고 익명의 기능을 추가하여 기록되었거나 기록되지 않았거나 승인되지 않은 경우 물건을 처리했습니다.auth.authResponseChange 이벤트에서 response.status를 처리 할 때의 문제

기록 될 때 제대로 작동합니다. 로그인하지 않았거나 권한이 없으면 아무것도하지 않습니다. 나는 익명의 함수를 입력하지 않는다고 생각한다. 왜냐하면 나는 if 앞에 console.log()를 넣었 기 때문에 아무것도하지 않는다. 저도 같은 문제를 가지고,하지만 당신은 이벤트 대신 'authResponseChange'의 'auth.statusChange'에 가입 할 경우 가치가 당신이 알 수에 대해 그는 '연결되어있는 경우

// Facebook stuff 
window.fbAsyncInit = function() 
{ 
    FB.init({ 
    appId  : 'my id blabla', // App ID 
    channelUrl : 'my channel.html bla bla', // Channel File 
    status  : true, // check login status 
    cookie  : true, // enable cookies to allow the server to access the session 
    xfbml  : true // parse XFBML 
    }); 

    FB.Event.subscribe('auth.authResponseChange', function(response) 
    { 
    console.log("Running function"); 

    if(response.status === "connected") 
    { 
     console.log("Connected and authorized"); 
    } 
    else if (response.status === 'not_authorized') 
    { 
     console.log("Not authorized"); 
    } 
    else 
    { 
     console.log("Not connected"); 
    } 
    }); 
}; 

// 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 = "//connect.facebook.net/en_US/all.js"; 
    ref.parentNode.insertBefore(js, ref); 
}(document)); 

답변

0

: 여기

내 코드입니다 '을 페이스 북으로 보내고 앱을 승인했거나 fb에 연결되었지만 승인되지 않은 경우.

당신이 사용자에 (not_autorized 또는 not_connected 연결됨) 세 가지 중 무엇을 페이스 북, 당신은 알고 있습니다하지 조언 FB.getLoginStatus를 사용 또한합니다.