title: URLs Not Allowed: Facebook PHP login
body: <p>I keep getting the following error</p>
  
  <blockquote>
    <p>Given URL is not allowed by the Application configuration.: One or
    more of the given URLs is not allowed by the App's settings. It must
    match the Website URL or Canvas URL, or the domain must be a subdomain
    of one of the App's domains.</p>
  </blockquote>
  
  <p>when I try to login a user with my PHP code snippet (see below). My Facebook settings are as follows:</p>
  
  <pre><code>App Domains: myappname-mynamespace.rhcloud.com www.myappname-mynamespace.rhcloud.com
  
  Site URL: http://myappname-mynamespace.rhcloud.com/
  
  Canvas Page: http://apps.facebook.com/myappname
  
  Canvas URL: http://myappname-mynamespace.rhcloud.com/
  
  Secure Canvas URL: https://myappname-mynamespace.rhcloud.com/
  </code></pre>
  
  <p>I've read similar questions <a href="https://stackoverflow.com/questions/3610858/facebook-login-given-url-not-allowed-by-application-configuration">here</a>, <a href="https://stackoverflow.com/questions/14474122/given-url-is-not-permitted-by-the-application-configuration">here</a>, <a href="https://stackoverflow.com/questions/16345777/given-url-is-not-allowed-by-the-application-configuration">here</a>, <a href="https://stackoverflow.com/questions/7184632/given-url-is-not-allowed-by-the-application-configuration">here</a> and <a href="https://stackoverflow.com/questions/16933115/given-url-is-not-allowed-by-the-application-configuration-when-using-the-facebo">here</a> and they all seem to say the same thing: my Site URL (Website with Facebook Login) is incorrect. </p>
  
  <p>But my Openshift URL is like this</p>
  
  <pre><code>http://myappname-mynamespace.rhcloud.com
  </code></pre>
  
  <p>so that's what I put in Facebook Site URL field. I have the following PHP code (<code>index.php</code>) in the root of my <a href="https://www.openshift.com/" rel="nofollow noreferrer">Openshift</a> gear:</p>
  
  <pre><code>&lt;?php 
      require 'php-sdk/facebook.php';
      $facebook = new Facebook(array(
          'appId'  =&gt; 'xxxx',
          'secret' =&gt; 'xxxx'
      ));
  ?&gt;
  &lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
      &lt;meta charset="utf-8" /&gt;
      &lt;title&gt;Facebook PHP&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;h1&gt;Hello World!&lt;/h1&gt;
  &lt;?php
      // get user from facebook object
      $user = $facebook-&gt;getUser();
  
      if ($user): // check for existing user id
          echo '&lt;p&gt;User ID: ', $user, '&lt;/p&gt;';
      else: // user doesn't exist
          $loginUrl = $facebook-&gt;getLoginUrl(array(
              'display' =&gt; 'popup',
              'redirect_uri' =&gt; 'http://apps.facebook.com/myappname'
          ));
          echo '&lt;p&gt;&lt;a href="', $loginUrl, '" target="_top"&gt;login&lt;/a&gt;&lt;/p&gt;';
      endif; 
  ?&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>What am I doing wrong?</p>
  
  <p>When I enter my Facebook app's URL (<code>http://apps.facebook.com/myappname</code>), <code>Hello World!</code> and my login link is display on top of my Facebook's app's iframe. However when I click on the login link, I get the above mentioned error. Any assistance will be greatly appreciated!</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I entered the following urls in my browser and <code>Hello World</code> and the login link were both displayed.</p>
  
  <pre><code>http://myappname-mydomainname.rhcloud.com/
  https://myappname-mydomainname.rhcloud.com/
  </code></pre>