title: Facebook login with either PHP or Javascript SDK not working
body: <p>as the title states, I am having some trouble getting the user logged in on my Facebook application.</p>
  
  <p>When the user is logged out, and they click <code>log in</code>, the page reloads and then displays a Facebook logo with the text <code>Go to Facebook.com</code> below it, and when I try using the Javascript SDK, I do get the login page in a popup box, but once I press <code>Login</code>, the popup redirects to a <code>XD Proxy</code> page, where I get stuck, and I have to manually close the popup to have the callback execute.</p>
  
  <p>In both cases I get this error in the Chrome console,</p>
  
  <p>Error I get in console, when using the Javascript SDK:</p>
  
  <blockquote>
    <p><strong>Unsafe JavaScript attempt to access frame with URL
    <a href="https://www.facebook.com/dialog/permissions.request?etcetc" rel="nofollow">https://www.facebook.com/dialog/permissions.request?etcetc</a>...
    from frame with URL
    <a href="http://subdomain.mysite.com/folder/?etcetc" rel="nofollow">http://subdomain.mysite.com/folder/?etcetc</a>...
    Domains, protocols and ports must
    match.</strong></p>
  </blockquote>
  
  <p>Error I get in console, when using the PHP SDK:</p>
  
  <blockquote>
    <p><strong>Unsafe JavaScript attempt to access frame with URL
    <a href="http://apps.facebook.com/my_app/" rel="nofollow">http://apps.facebook.com/my_app/</a> from
    frame with URL
    <a href="https://www.facebook.com/login.php?etcetc" rel="nofollow">https://www.facebook.com/login.php?etcetc</a>...
    Domains, protocols and ports must
    match.</strong></p>
  </blockquote>
  
  <p>Here is my code,</p>
  
  <p>PHP:</p>
  
  <pre><code>&lt;?php
  require 'libs/facebook/src/facebook.php';
  
  $facebook = new Facebook(array(
    'appId'  =&gt; 'APP ID',
    'secret' =&gt; 'SECRET',
  ));
  
  $user = $facebook-&gt;getUser();
  
  if ($user) {
    try {
      $user_profile = $facebook-&gt;api('/me');
    } catch (FacebookApiException $e) {
      error_log($e);
      $user = null;
    }
  }
  
  if ($user) {
    $logoutUrl = $facebook-&gt;getLogoutUrl();
    echo "&lt;a href='".$logoutUrl."'&gt;Login&lt;/a&gt;";
  } else {
    $loginUrl = $facebook-&gt;getLoginUrl();
    echo "&lt;a href='".$loginUrl."'&gt;Login&lt;/a&gt;";
  }
  ?&gt;
  </code></pre>
  
  <p>I am using version 3.0 of the PHP SDK.</p>
  
  <p>After the PHP failed, I tried using the Javascript SDK instead, to handle the login and logout,</p>
  
  <p>Javascript: </p>
  
  <pre><code>FB.init({
      appId       : 'APP ID',
      status      : true, // check login status
      cookie      : true, // enable cookies to allow the server to access the session
      xfbml       : true // parse XFBML
  }); 
  
  FB.getLoginStatus(function(response) {
  
      if (response.session) {
  
          $('#login').hide();
          $('#logout').show();
  
      } else {
  
          $('#logout').hide();
          $('#login').show();
  
      }
  });
  
  
  $("#logout").live('click', function(){
      FB.logout(function(response) {
          window.location.reload();
      }); 
  });
  
  $("#login").live('click', function(){
      FB.login(function(response) {
          window.location.reload();
      }); 
  });
  </code></pre>
  
  <p>Any help would be greatly appreciated, thank you!</p>