문제

여기에서는 StackOverflow에서 다양한 문서와 질문을 살펴 보았으며 FB.Event.subscribe 이벤트 GetLoginStatus 중 하나를 실행하지 않는 이유를 알아낼 수 없습니다.

<div id="fb-root">
<script>
    (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));

    window.fbAsyncInit = function () {
        FB.init({
            appId: '{appID}', // App ID
            channelUrl: '{channelURL}', // Channel File
            status: true, // check login status
            cookie: true, // enable cookies to allow the server to access the session
            xfbml: true,  // parse XFBML
            oauth: true // enable OAuth 2.0
        });

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

        FB.Event.subscribe('auth.login', function (response) {
            console.log(response);
        });

        FB.Event.subscribe('auth.statusChange', function (response) {
            console.log(response);
        });

        FB.getLoginStatus(function (response) {
            console.log(response);
        });
    };

</script>
</div>
<div>
    <div class="fb-login-button" data-show-faces="true" data-width="400" data-max-rows="1"></div>
</div> 
.

도움이 되었습니까?

해결책

다른 누구도 필요로하는 경우에 나는이 다른 질문에 대한 내 질문에 대한 답변을 발견했다.

fb.event.auth.login, auth.logout 및 auth.statuschange 에 대해 작동하지 않음

Facebook에 들어가서 캔버스 URL을 My Localhost URL로 업데이트했으며 작동했습니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top