title: Facebook produces "An error occurred. Please try later" when handling oauth request
body: <p>This has been discused on SOF, though, I didn't find anyone having exactly the same problem. Furthermore, it's been more than 2 days now, so I figured to ask.</p>
  
  <ol>
  <li>App is running in a sandbox. Update: the same is happening in sandbox-less environment.</li>
  <li>Doesn't work regardless if I use <code>admin</code>, <code>developer</code> or <code>tester</code> account.</li>
  <li>Doesn't work regardless of whether the user has authorized the app already or not.</li>
  </ol>
  
  <p>Just before calling <code>$fb-&gt;getLoginError()</code>, the <code>$fb</code> instance dump (Facebook PHP-SDK) looks like the following:</p>
  
  <pre><code>object(Facebook)#85 (7) {
    ["appId:protected"]=&gt;
    string(15) "[removed for SOF display]"
    ["apiSecret:protected"]=&gt;
    string(32) "[removed for SOF display]"
    ["user:protected"]=&gt;
    int(0)
    ["signedRequest:protected"]=&gt;
    NULL
    ["state:protected"]=&gt;
    string(32) "[removed for SOF display]"
    ["accessToken:protected"]=&gt;
    string(48) "[removed for SOF display]"
    ["fileUploadSupport:protected"]=&gt;
    bool(false)
  }
  </code></pre>
  
  <p>All the <code>[removed for SOF display]</code> information is present.</p>
  
  <p>The code itself:</p>
  
  <pre><code>$login_url      = $fb-&gt;getLoginUrl(array('scope' =&gt; $config-&gt;facebook['scope'], 'redirect_uri' =&gt; $redirect_uri ));
  
  echo '
      &lt;noscript&gt;javascript must be enabled.&lt;/noscript&gt;
      &lt;script type="text/javascript"&gt;top.location.href = \'' . addslashes($login_url) . '\';&lt;/script&gt;
  ';
  </code></pre>
  
  <p>The URL generated by getLoginUrl() is the following:</p>
  
  <pre><code>https://www.facebook.com/dialog/oauth?client_id=[removed for SOF display]&amp;redirect_uri=[removed for SOF display]&amp;scope=publish_stream%2C+email%2C+user_birthday%2C+user_interests%2C+user_likes
  </code></pre>
  
  <p>The most annoying thing is that Facebook is producing error <strong>An error occurred. Please try later</strong> without any additional information. I've even tried to set $login_url to something stupid like <code>http://google.com/</code> which didn't produce expected error. Just the same <strong>An error occurred. Please try later</strong>.</p>
  
  <p>I've been developing apps for quite a while and this is the first time I am having an issue as such.</p>