Как я могу получить идентификатор почты в логине с опцией facebook. Я создал образец проекта, и я могу получить имя пользователя, но я не могу получить идентификатор почты.Получение идентификатора электронной почты для входа в систему с помощью Facebook?
Мое кодирование является следующим.
Я создал идентификатор приложения, и я реализую его в следующем коде.
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);
}
});
}
Я думаю, что это пустая трата времени размещения вопросов в этом.Нет использования.Если мой вопрос не понимает, тогда скажите об этом. –