0

嗨,我正在处理 Facebook 连接并访问用户电子邮件和签到。问题是如果我不授予电子邮件地址或电子邮件的权限,那么 facebook 不会返回数据。如果电子邮件是共享的,那么它运行正常。无论用户是否发送电子邮件,我都想获取数据。

<div id='fb-root'></div>
<a id='fb-login' href='javascript:void(0);' onclick='facebookLogin();'>
<img src="/images/spacer.gif" class="fb_btn" alt="Login with Facebook">
</a>
<script language="javascript">

window.fbAsyncInit = function() {
    FB.init({
        appId: '<?php echo $this->app_id; ?>',
        status: true,
        cookie: true,
        xfbml: true,
        oauth: true
    });
};

function facebookLogin() {
    FB.login(function(response) {
        if (response.authResponse) {

            //alert('authenticated');
             window.location = "comingsoon/loginfacebook"; //or do whatever you want
        } else {
            //console.log('User cancelled login or did not fully authorize.');
            //alert('User cancelled login or did not fully authorize.');
            window.location = "comingsoon/loginfacebook"; //or do whatever you want
        }
    },{
        scope: 'email,user_checkins'
    }
    );
}

(function(d) {
    var js,
    id = 'facebook-jssdk';
    if (d.getElementById(id)) {
        return;
    }
    js = d.createElement('script');
    js.id = id;
    js.async = true;
    js.src = "//connect.facebook.net/en_US/all.js";
    d.getElementsByTagName('head')[0].appendChild(js);
} (document));

</script>
4

1 回答 1

0

除非您请求并接受相关范围,否则您无法获取数据。

于 2013-06-25T13:09:20.793 回答