2013-06-25 32 views
0

您好我正在Facebook連接和訪問用戶的電子郵件和簽入。問題是 如果我不授權給電子郵件地址或電子郵件,那麼Facebook沒有返回數據。如果電子郵件共享,那麼它運行正常。無論用戶是否收到電子郵件,我都希望獲取數據。Facebook不返回數據,如果sope字段不共享

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

回答

0

除非您請求並接受相關範圍,否則無法獲取數據。

+0

它是mendatory,如果我需要的電子郵件地址和用戶不共享電子郵件,那麼我不會收到數據? – Sheraz

+0

是的,它是........ – faffaffaff