https://developers.facebook.com/docs/reference/javascript/FB.login/v3.2
Ask for the email
permission in the login process:
FB.login((response) => {
// handle the response
}, {scope: 'email'});
Also, you need to ask for the fields you want to get:
FB.api('/me', {fields: 'name,email'}, (response) => {
console.log(response.name + ', ' + response.email);
});
Make sure the user even has an Email, it´s not required. And make sure you actually get asked for the email
permission in the login popup.
Side Note: I would just use console.log(response)
, so you can see the whole object instead of some undefined
values.