1

: emailuser_birthday user_education_history user_hometownuser_likes friends_birthday friends_education_history friends_hometown friends_likesFacebook應用程序不顯示我已經創建了下列權限的Facebook應用程序更新的權限

,當我點擊預覽登錄對話框,我看到: 所有權限

但是當我用來通過我的Javascript代碼訪問應用程序時,

<html> 
<body> 
<div id="fb-root"></div> 
<script> 
// Additional JS functions here 

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

// Additional init code here 
FB.getLoginStatus(function(response) { 
    if (response.status === 'connected') { 
    alert("Welcome"); 
    } else if (response.status === 'not_authorized') { 
    login(); 
    } else { 
    // not_logged_in 
    } 
}); 


}; 

function login() { 
FB.login(function(response) { 
    if (response.authResponse) { 
     // connected 
     testAPI(); 
    } else { 
     // cancelled 
    } 
}); 
} 

function testAPI() { 
    console.log('Welcome! Fetching your information.... '); 
    FB.api('/me', function(response) { 
    console.log('Good to see you, ' + response.name + '.'); 
    }); 
} 
// Load the SDK Asynchronously 
(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)); 
</script> 
</body> 
</html> 

我可以看到下只允許基本信息:

爲什麼在預覽框中的權限並不在實際登錄框反映?

回答

1

這是因爲您在登錄時(在您的代碼中)沒有設置權限。試試這個 -

FB.login(function(response) { 
    if (response.authResponse) { 
     // connected 
     testAPI(); 
    } else { 
     // cancelled 
    } 
},{scope:'email, etc...'}); 
相關問題