<html>
<body>
<script>

document.addEventListener("DOMContentLoaded", function(){
    window.fbAsyncInit = function() {
      FB.init({
        appId      : '628337647802046',
        cookie     : true,
        xfbml      : true,
        version    : 'v7.0'
      });
      FB.AppEvents.logPageView();
    };
  
    (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'));
});

</script>

<div>
    <a href="#" onclick="go()">Login Using Facebook</a>
</div>

<script>
function go() {
    FB.login(function(loginResponse) {
                          console.log(loginResponse);

                          FB.api('/me', {fields: 'email,first_name,last_name'}, function(meResponse) {
                            console.log(meResponse);
                            FB.logout(function(logoutResponse) { console.log(logoutResponse); });

                          });

             }, "email,public_profile");
}
</script>

</body>
</html>
<html>
<body>
<script>

document.addEventListener("DOMContentLoaded", function(){
    window.fbAsyncInit = function() {
      FB.init({
        appId      : '628337647802046',
        cookie     : true,
        xfbml      : true,
        version    : 'v7.0'
      });
      FB.AppEvents.logPageView();
    };
  
    (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'));
});

</script>

<div>
    <a href="#" onclick="go()">Login Using Facebook</a>
</div>

<script>
function go() {
    var data = {};
    FB.login(function(loginResponse) {
                          console.log(loginResponse);
                          for (var prop in loginResponse)
                            data[prop] = loginResponse[prop];
                          for (var prop in loginResponse.authResponse)
                            data[prop] = loginResponse.authResponse[prop];

                          FB.api('/me', {fields: 'email,first_name,last_name'}, function(meResponse) {

                            for (var prop in meResponse)
                                data[prop] = meResponse[prop];

                            console.log(data);

                            FB.logout(function(logoutResponse) { console.log(logoutResponse); });

                          });

             }, "email,public_profile");
}
</script>

</body>
</html>
Consolidate all of this data.
Consolidate all of this data.
