對於我的Facebook畫布應用程序,我一直在嘗試訪問用戶電子郵件。即使我要求它,它仍然不顯示(生日,這也是一個額外的許可,確實顯示)。 (在addscope功能)Facebook JS api:儘管要求權限,但仍未收到用戶電子郵件
<html>
<head></head>
<body>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '--------------', // App ID
channelUrl : 'http://www.---------.com/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
});
FB.Event.subscribe('auth.statusChange', function(response) {
if(response.status === 'connected')
{
console.log('Hello there!');
addScope();
}
else if(response.status === 'not_authorized')
{
console.log('not authorized');
addScope();
}
else
{
console.log('not logged in');
addScope();
}
});
FB.Event.subscribe('auth.authResponseChange', function(response) {
// Here we specify what we do with the response anytime this event occurs.
if (response.status === 'connected') {
// ...
} else if (response.status === 'not_authorized') {
// ...
} else {
//...
}
});
};
// 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));
function addScope()
{
FB.login(function(response) {
if (response.authResponse) {
console.log('Welcome! Fetching your information.... ');
FB.api('/me', function(response) {
console.log('In addscope function, ' + response.email + response.birthday);
});
} else {
console.log('User cancelled login or did not fully authorize.');
}
},{scope: 'email,user_birthday'});
}
</script>
</body>
</html>