2015-11-16 48 views
0

我想從Facebook的我用戶的Java腳本SDK中的用戶的電子郵件ID爲獲取電子郵件ID不定值

<script> 

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

    $(document).ready(function() { 
    $('#fb_button').click(function() { 
    FB._https = (window.location.protocol == "https:"); // Required because FB Javascript SDK tries to submit https to http 
    FB.init({appId:"{app_id}", cookie:true, status:true, xfbml:true, oauth:true , version:'v2.5'}); 
    FB.login(function(response) { 

    if (response.authResponse) { 
    console.log('Welcome! Fetching your information.... '); 
    console.log(response); // dump complete info 
    access_token = response.authResponse.accessToken; //get access token 
    user_id = response.authResponse.userID; //get FB UID 


    FB.api('/me', function(response) { 
     user_email = response.email; //get user email 
     alert(user_email); 
    }); 
    } 
    else{ 
    alert('no response'); 
    } 
}, { 
    scope: 'email' 

    }); 

    }); 
}); 


(function() { 
    var e = document.createElement('script'); 
    e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js'; 
    e.async = true; 
    // document.getElementById('fb-root').appendChild(e); 
    }()); 
    </script> 

返回響應,但警報 不定值我複製粘貼相同代碼在另一個網站與不同的app_id它返回相同用戶的電子郵件ID。我也嘗試過PHP SDK,但結果相同。可能這個問題是重複的,但我嘗試了幾乎所有這些問題的答案。

任何人有任何想法什麼錯嗎?

在此先感謝

+0

但我用經過驗證的帳戶 – ashith

+0

我是否neeed提交應用評論? – ashith

+0

不,對於您不需要提交應用程序以供查看的電子郵件。你的流量不正確,請糾正你的流量。 –

回答