title: Using facebook login for my website
body: <p>I am trying to incorporate the facebook login button into my website's homepage. I have connected it with an app, so i have the app id and secret, but i can't figure out how to check if the user is already registered to my site, so in my database, in order to preview his userprofile. I have used the javaScript sdk from facebook but when i press the facebook's login button, after the authorization, nothing happens and my website's homepage is shown again. Does anyone know how to get the user's email from the javascript sdk? I am using java servlets for my pages. I have used the code from the facebook documentation.</p>
  
  <pre><code>&lt;div id="fb-root"&gt;&lt;/div&gt;
  &lt;script&gt;
    window.fbAsyncInit = function() {
      FB.init({
        appId      : '8568345835', // App ID
        channelUrl : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel File
        status     : true, // check login status
        cookie     : true, // enable cookies to allow the server to access the session
        xfbml      : true  // parse XFBML
      });
  
      // Additional initialization code here
    };
  
    // Load the SDK Asynchronously
    (function(d){
       var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
       if (d.getElementById(id)) {return;}
       js = d.createElement('script'); js.id = id; js.async = true;
       js.src = "//connect.facebook.net/en_US/all.js";
       ref.parentNode.insertBefore(js, ref);
     }(document));
  &lt;/script&gt;
  
  &lt;div class="fb-login-button" data-scope="email"&gt;
  </code></pre>