0

I'm using the Facebook SDK to implement login.

// Here we run a very simple test of the Graph API after login is
// successful.  See statusChangeCallback() for when this call is made.
function testAPI() {
    console.log('Welcome!  Fetching your information.... ');
    FB.api('/me', function(response) {
      console.log('Successful login for: ' + response.name);
      console.log(response);
      document.getElementById('status').innerHTML =
        'Thanks for logging in, ' + response.name + response.email + response.id + '!';
    });

    FB.api('/me/permissions', function(response) {
      console.log(response);

    });

}

<fb:login-button scope="public_profile,email" onlogin="checkLoginState();">
</fb:login-button>

The login is successful and the code above displays the name and id of the user. However, email is showing undefined. It is strange because when I inspect the response object returned for the permissions query, I see user_friends, email, and public_profile have all been granted. Why is email undefined then?

sharataka
  • 5,014
  • 20
  • 65
  • 125

1 Answers1

0

Some possible reasons:

No Email address on account

No confirmed email address on account

No verified email address on account

derek
  • 9,358
  • 11
  • 53
  • 94
  • Since you mentioned "when I inspect the response object returned for the permissions query, I see user_friends, email, and public_profile have all been granted.", I exclude the possibility that you did not include email permission. – derek Nov 01 '15 at 00:45