Facebook SDK登录错误“此页面不可用”

时间:2019-12-03 03:23:04

标签: facebook facebook-javascript-sdk facebook-sdk-4.0

我在使用Facebook SDK时遇到问题,登录时出现错误“此页面不可用”,但有时我可以成功登录。我在许多社区中搜索了答案,但仍然没有结果,请帮助我

// Button
<div class="fb-login-button" data-size="large" data-button-type="login_with" data-auto-logout-link="false" data-use-continue-as="true" scope="public_profile,publish_video,user_videos" onlogin="checkLoginState()">Login Facebook</div>

//JS
(function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s); js.id = id;
    js.src = "https://connect.facebook.net/en_US/sdk.js";
    fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));

window.fbAsyncInit = function() {

    FB.init({
        appId      : xxx,
        cookie     : true,
        xfbml      : true,
        version    : 'v3.3'
    });

    FB.getLoginStatus(function(response) {
        statusChangeCallback(response);
    });
};

function statusChangeCallback(response) {
    if (response.status === 'connected') {
        console.log('logined!');
    } else {
        console.log('not login!');
    }
}

function checkLoginState() {
    FB.getLoginStatus(function(response) {
        statusChangeCallback(response);
    });
}

屏幕截图:enter image description here

0 个答案:

没有答案