title: Getting Phone number from the user of facebook through javascript sdk
body: <p>I need to get the email address of the user who login in my webapp through facebook. Everything is fine, but at some people using phone number instead of email address to login to their fb account. I need to get the phone number of the user who using phone number instead of email address. How can I get that please find the code below that I have tried so far.</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Facebook Login JavaScript Example&lt;/title&gt;
  &lt;meta charset="UTF-8"&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;script&gt;
    // This is called with the results from from FB.getLoginStatus().
    function statusChangeCallback(response) {
        alert("JSON "+JSON.stringify(response));
      console.log('statusChangeCallback');
      console.log(response);
      if (response.status === 'connected') {
        testAPI();
      } 
    }
    function checkLoginState() {
      FB.getLoginStatus(function(response) {
        statusChangeCallback(response);
      });
    }
  
    window.fbAsyncInit = function() {
    FB.init({
      appId      : 'xxx',
      cookie     : true,  // enable cookies to allow the server to access 
                          // the session
      xfbml      : true,  // parse social plugins on this page
      version    : 'v2.4' // use version 2.4
    });
  
    FB.getLoginStatus(function(response) {
      statusChangeCallback(response);
    });
  
    };
  
    // Load the SDK asynchronously
    (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'));
    function testAPI() {
      console.log('Welcome!  Fetching your information.... ');
      FB.api('/me?fields=name,email', function(response) {
          alert("response "+JSON.stringify(response));
        console.log('Successful login for: ' + JSON.stringify(response));
        document.getElementById('status').innerHTML =
          'Thanks for logging in, ' + response.name + '!';
      });
    }
  &lt;/script&gt;
  
  &lt;!--
    Below we include the Login Button social plugin. This button uses
    the JavaScript SDK to present a graphical Login button that triggers
    the FB.login() function when clicked.
  --&gt;
  
  &lt;fb:login-button scope="public_profile,email" onlogin="checkLoginState();"&gt;
  &lt;/fb:login-button&gt;
  
  &lt;div id="status"&gt;
  &lt;/div&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>