Javascript 在使用Facebook登录时获取邮件Id?
如何在使用facebook选项登录时获取邮件id。我创建了一个示例项目,可以获取用户名,但无法获取邮件id 我的代码如下 我创建了一个应用程序ID,并在下面的代码中实现它Javascript 在使用Facebook登录时获取邮件Id?,javascript,c#,Javascript,C#,如何在使用facebook选项登录时获取邮件id。我创建了一个示例项目,可以获取用户名,但无法获取邮件id 我的代码如下 我创建了一个应用程序ID,并在下面的代码中实现它 window.fbAsyncInit = function () { FB.init({ appId: '###############', cookie: true, // enable cookies to allow the server to acc
window.fbAsyncInit = function () {
FB.init({
appId: '###############',
cookie: true, // enable cookies to allow the server to access
// the session
xfbml: true, // parse social plugins on this page
version: 'v2.5' // use version 2.2
});
FB.getLoginStatus(function (response) {
statusChangeCallback(response);
});
};
function statusChangeCallback(response) {
console.log('statusChangeCallback');
console.log(response);
if (response.status === 'connected') {
testAPI();
} else if (response.status === 'not_authorized') {
document.getElementById('status').innerHTML = 'Please log ' +
'into this app.';
} else {
document.getElementById('status').innerHTML = 'Please log ' +
'into Facebook.';
}
}
function testAPI() {
var id, eid, Username;
console.log('Welcome! Fetching your information.... ');
FB.api('/me', function (response) {
console.log('Successful login for: ' + response.name);
document.getElementById('status').innerHTML =
'Thanks for logging in, ' + response.name + '!' + response.id + ' ' + response.phoneno + ' ' + response.country;
Username = response.name;
eid = response.email;
id = response.id;
});
$.ajax({
type: 'POST',
contentType: "application/json; charset=utf-8",
url: 'LoginWithFB.aspx/fbacctdeta',
data: "{Username:'" + Username + "',eid:'" + eid + "',id:'" + id + "'}",
async: true,
success: function () {
alert(data);
}
});
}
只有在Facebook通过开发者选项完成应用程序审查后,您才能获取邮件Id和其他信息 用于获取客户信息
FacebookClient fb = new FacebookClient();
dynamic info=fb.Get("\me");
对不起,我听不懂?我检查了,但是没有选项获取邮件IDit,包括名字、姓氏、电子邮件地址、位置、,当前用户的图像url等。现在,您可以使用此电子邮件或名称验证您的用户或注册新用户等。只有在验证您的应用程序时,您才能使用电子邮件Id。我认为在此发布问题是浪费时间。没有用。如果我的问题不理解,请告诉我。