title: Facebook App Authentication with the PHP SDK
body: <p>I'm creating a Facebook app (as an iFrame inside FB) and trying to use the PHP SDK for authentication as well as any calls I need to make to FB.</p>
  
  <p>I'm having some issues authenticating and can't figure out where I'm going wrong - it's either loading my site outside the FB chrome or inside the FB chrome but user is 0 and infinitely loops.</p>
  
  <p>If I set this as my loginURL:</p>
  
  <pre><code>$fb-&gt;getLoginUrl(array('scope' =&gt; $scope, 'redirect_uri' =&gt; $appUrl));
  </code></pre>
  
  <p>I get to the permissions page and then it will load my app outside the FB chrome. I get the state and code here, shouldn't the php sdk pick this up and ask for an access_token from this?</p>
  
  <p>If I put response_type = 'token' like so:</p>
  
  <pre><code>$fb-&gt;getLoginUrl(array('scope' =&gt; $scope, 'redirect_uri' =&gt; $appUrl, 'response_type' =&gt; 'token'));
  </code></pre>
  
  <p>Then it goes to my app inside the FB chrome but constantly loops and user = 0. Also, I get something like this in my url: </p>
  
  <p><code>#state=043f5cde02feb4e3a527bb2638d542d7&amp;access_token=AAAEEdf0kQssBAGCz3TS8bZBN5CnOwi6gewBwjauEMpKTHRm2T8hZBpBYZAPJFWZCh5rjFQSgXtZCV0ZAIts9FxZBZCnZBv7OQ5DVURvpCAZBvrPlNpHDsPsLtB&amp;expires_in=4313</code></p>
  
  <p>so the access_token is there, but I can't access it.</p>
  
  <p>Any idea where I'm going wrong?</p>