I am trying to allow users to register and login on my site using facebook, the following code works and I can see the users name and ID in the response.
However, I am unsure how to get the email address of the user. I have checked that my app is live on facebook developers dashboard and the permissions and features section includes email.
FB.getLoginStatus(function(response){
if(response.status === 'connected'){
FB.api('/me', function(response){
console.log(response);
});
}
});
window.fbAsyncInit = function(){
FB.init({
appId:'326746698293638',
cookie:true,
xfbml:true,
version:'v7.0'
});
};
(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 = "https://connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document,'script','facebook-jssdk'));