title: Auto login with PHP facebook connect + JS
body: <p>since all the changes facebook made in the past year lot of things are changed.
  there are some solutions over the web but they do not work any more.
  (LIKE THIS ONE: <a href="https://stackoverflow.com/questions/7135474/using-the-php-or-javascript-facebook-sdk-how-can-i-keep-the-user-logged-in-to-m/11611015#comment15398973_11611015">Using the PHP or JavaScript Facebook SDK, how can I keep the user logged in to my website?</a>)</p>
  
  <p>I have implemented facebook connect with PHP facebook SDK on my website.
  the problem is with users that already approved my App and that also logged in to their facebook.
  In this case I want them the auto login with no need to press the connect button again.
  I guess that there is a way to do it using php+js but I couldn't find how and believe me I tried several things. the problem is that the php user check </p>
  
  <pre><code>$user  = $facebook-&gt;getUser(); 
  </code></pre>
  
  <p>doesn't recognized facebook session and I think that maybe I can trigger it with JS.
  so I tired adding this code for the page in JS and the ALRETS are working saying user is connected but NO session pass to PHP, so PHP SDK doesn't recognize user is connected :</p>
  
  <pre><code>&lt;div id="fb-root"&gt;&lt;/div&gt;
      &lt;script&gt;
        window.fbAsyncInit = function() {
          FB.init({
                appId  : '&lt;?=FACEBOOK_APP_ID?&gt;',
                status : true, // 
                cookie : true, // 
                xfbml  : true, //
                oauth  : true
          });
  
        // Additional initialization code here
   //--------&gt; this isn't need to work its only a check
  FB.getLoginStatus( function(response) {
      //console.log(response);
      if (response.status === 'connected') {
          var accessToken = response.authResponse.accessToken;
          alert(accessToken);
      } else if (response.status === 'not_authorized') {
          //login function
      } else {
          //login function
      }
  }, true);
  
  FB.Event.subscribe('auth.authResponseChange', function(response) {
      //console.log('The status of the session changed to: '+response.status);
      alert(response.status);
  });
  
   //--------&gt; END OF CHECK!!
        };
        // 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/&lt;?=$fb_api_lang?&gt;/all.js#xfbml=1";
           ref.parentNode.insertBefore(js, ref);
         }(document));
      &lt;/script&gt;
  </code></pre>
  
  <p>if anyone found a solution for this problem and could share it will be much appreciated.</p>