title: Facebook javascript connect with localhost domain
body: <p>I am trying to create facebook connect using javascript which gives follwing 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>Does is due to I am using Localhost server for testing? Do I need to purchase domain to test this or what?
  Or do I need to make changes in following code:</p>
  
  <p>my code:</p>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  //
  // uses the PHP SDK. Download from https://github.com/facebook/php-sdk
  include("facebook-php-sdk/src/facebook.php");
  
  //
  // from the facebook app page
  define('YOUR_APP_ID', '321849981247524');
  define('YOUR_APP_SECRET', '49fd00ce6237aff0af08fd8ca25dbc92');
  
  //
  // new facebook object to interact with facebook
  $facebook = new Facebook(array(
   'appId' =&gt; YOUR_APP_ID,
   'secret' =&gt; YOUR_APP_SECRET,
  ));
  //
  // if user is logged in on facebook and already gave permissions
  // to your app, get his data:
  $userId = $facebook-&gt;getUser();
  
  ?&gt;
  &lt;html&gt;
  &lt;head&gt;
   &lt;style&gt;body { text-align:center; font-size: 40px }&lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;?php
  if ($userId) {
   //
   // already logged? show some data
   $userInfo = $facebook-&gt;api('/' + $userId);
  
  echo "&lt;p&gt;YOU ARE: &lt;strong&gt;". $userInfo['name'] ."&lt;/strong&gt;&lt;br/&gt;";
  echo "Your birth date is: ".$userInfo['birthday']."&lt;/p&gt;";
  
  
  
  } else {
   //
   // use javaascript api to open dialogue and perform
   // the facebook connect process by inserting the fb:login-button
   ?&gt;
   &lt;div id="fb-root"&gt;&lt;/div&gt;
   &lt;fb:login-button scope='email,user_birthday'&gt;&lt;/fb:login-button&gt;
   &lt;?php
  }
  ?&gt;
   &lt;script&gt;
   window.fbAsyncInit = function() {
   FB.init({
   appId : &lt;?=YOUR_APP_ID?&gt;, //When I gives app ID "321849981247524" or my own created it gives error that it's not valid
   status : true,
   cookie : true,
   xfbml : true,
   oauth : true,
   });
  
  FB.Event.subscribe('auth.login', function(response) {
   // ------------------------------------------------------
   // This is the callback if everything is ok
   window.location.reload();
   });
   };
  
  (function(d){
   var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
   js = d.createElement('script'); js.id = id; js.async = true;
   js.src = "//connect.facebook.net/en_US/all.js";
   d.getElementsByTagName('head')[0].appendChild(js);
   }(document));
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>When I run in browser it shows facebook button and on click redirect to new windows to do FB loging but then shows above mentioned error!</p>