title: Facebook API Error Code: 191
body: <p>I would really appreciate some help. I've searched around, and I feel like I've tried everything but to no avail.</p>
  
  <pre><code>API Error Code: 191
  API Error Description: The specified URL is not owned by the application
  Error Message: Invalid redirect_uri: Given URL is not allowed by the Application configuration.
  </code></pre>
  
  <p>These are my settings:</p>
  
  <pre><code>App Domains: localhost
  Canvas URL: http://localhost/friendsmash/
  Secure Canvas URL: *empty*
  App Available to Public: No
  Valid OAuth redirect URIs: http://localhost/friendsmash/
  </code></pre>
  
  <p>Edit:</p>
  
  <p>I get the error when I try to go to the canvas URL. In other words, I put:</p>
  
  <pre><code>http://localhost/friendsmash/
  </code></pre>
  
  <p>in my browser. It redirects me here: <a href="https://www.facebook.com/dialog/oauth?client_id=592670390826338&amp;redirect_uri=https%3A%2F%2Fapps.facebook.com%2Ftestappertest%2F&amp;state=8712a908d02c6b6fc3fa9c19c9747296&amp;scope=email%2Cpublish_actions" rel="nofollow">https://www.facebook.com/dialog/oauth?client_id=592670390826338&amp;redirect_uri=https%3A%2F%2Fapps.facebook.com%2Ftestappertest%2F&amp;state=8712a908d02c6b6fc3fa9c19c9747296&amp;scope=email%2Cpublish_actions</a></p>
  
  <p>Then, I see the error. When I go to the canvas page instead, I get a blank page. As for the code, I am following this tutorial: <a href="https://developers.facebook.com/docs/games/canvas/canvas-tutorial" rel="nofollow">https://developers.facebook.com/docs/games/canvas/canvas-tutorial</a></p>
  
  <p>I censored the app id and secret. Anyway, this is the relevant part of the code:</p>
  
  <pre><code>&lt;?php
  require 'server/fb-php-sdk/facebook.php';
  
  $app_id = 'XXXXXX';
  $app_secret = 'XXXXXX';
  $app_namespace = 'testappertest';
  $app_url = 'https://apps.facebook.com/' . $app_namespace . '/';
  $scope = 'email,publish_actions';
  
  // Init the Facebook SDK
  $facebook = new Facebook(array(
      'appId'  =&gt; $app_id,
      'secret' =&gt; $app_secret,
  ));
  
  // Get the current user
  $user = $facebook-&gt;getUser();
  
  // If the user has not installed the app, redirect them to the Login Dialog
  if (!$user) {
      $loginUrl = $facebook-&gt;getLoginUrl(array(
          'scope' =&gt; $scope,
          'redirect_uri' =&gt; $app_url,
      ));
      print('&lt;script&gt; top.location.href=\'' . $loginUrl . '\'&lt;/script&gt;');
  }
  ?&gt;
  </code></pre>