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));