I am using fb login for my web application but in return I receive fb Id and name only. I do want email id in return data.
(function (d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
window.fbAsyncInit = function () {
FB.init({
appId: '935846336454759',
cookie: true, // enable cookies to allow the server to access
// the session
status: true,
xfbml: true, // parse social plugins on this page
version: 'v2.3', // use version 2.3
oauth: true // enable OAuth 2.0
});
FB.getLoginStatus(function (response) {
statusChangeCallback(response);
});
};
function FBLogin() {
FB.login(function (response) {
if (response.authResponse) {
getUserInfo(); //Get User Information.
} else {
alert('Authorization failed.');
}
}, {
scope: 'public_profile,email',
return_scopes: true
});
}
function getUserInfo() {
FB.api('/me', function (resp) {
console.log(resp);
});
}
<--on button click FBLogin() method calls -->
<button value="facebook" class="facebook" onclick="FBLogin()"> </button>
In Response in i m getting something like below:
Object{name:"Harmeet Kamboj",id:"8279848306534449"}