title: API Key Error in Facebook Connect (javascript sdk)
body: <p>I am trying to implement Facebook Connect on a website. I am trying to work with Javascript SDK of Facebok. I am new to it and unfortunately most of links provided in Facebook WIKI are out of date... Returning 404 not found. Anyway I added this code before the ending <code>&lt;/body&gt;</code>:</p>
  
  <pre><code>&lt;script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"&gt;&lt;/script&gt;
   &lt;div id="fb-root"&gt;&lt;/div&gt;
   &lt;script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"&gt; &lt;/script&gt;
   &lt;script src="http://connect.facebook.net/en_US/all.js"&gt;&lt;/script&gt;
   &lt;script&gt;
     FB.init({
       appId  : '12344', // my real app id is here
       status : true, // check login status
       cookie : true, // enable cookies to allow the server to access the session
       xfbml  : false  // parse XFBML
     });
  
     FB.login(function(response) {
    if (response.session) {
      if (response.perms) {
          alert('user is logged in and granted some permissions');
        // user is logged in and granted some permissions.
        // perms is a comma separated list of granted permissions
      } else {
          alert('user is logged in, but did not grant any permissions');
        // user is logged in, but did not grant any permissions
      }
    } else {
          alert('user is not logged in');
      // user is not logged in
    }
  }, {perms:'email'});
   &lt;/script&gt;
  </code></pre>
  
  <p>And I have a login button at some other place (much before the above scripts) in the same page rendered with:</p>
  
  <pre><code>&lt;fb:login-button v="2"&gt;Connect with Facebook&lt;/fb:login-button&gt;
  </code></pre>
  
  <p>This button renders as a normal fb connect button and clicking it opens a new popup window as it normally should. Problem is that it shows 'invalid api key specified' error. On inspecting address bar of popup, I see that api_key=undefined is passed to it :(</p>
  
  <p>Any idea about this? I am trying to fix this for last 5 hours now... Please help me found out why correct API key is not being passed to popup window.</p>
  
  <p>Thanks in advance.</p>