title: Access Token from JavaScript
body: <p>I'm fairly new to Facebook and I'm trying to display a simple dialog that will write to the wall... But with no luck... :-( </p>
  
  <p>I tried this:</p>
  
  <pre><code>&lt;!DOCTYPE HTML&gt;
  &lt;html xmlns:fb="https://www.facebook.com/2008/fbml"&gt;
      &lt;body&gt;
          &lt;script src="http://connect.facebook.net/da_DK/all.js"&gt;&lt;/script&gt;
          &lt;div id="fb-root"&gt;&lt;/div&gt;
          &lt;script&gt;
              FB.init({appId: '172225549532081', xfbml: true, cookie: true});
  
              FB.getLoginStatus(function(response) {
  
                    if (response.authResponse &amp;&amp; response.status=="connected") {
                      console.log("loged in");
                    } else {
                      console.log("not logged in");
                    }
              });
              FB.ui({
                  display: 'iframe',
                  method: 'feed',
                  name: 'Facebook Dialogs',
                  link: 'http://developers.facebook.com/docs/reference/dialogs/',
                  picture: 'http://fbrell.com/f8.jpg',
                  caption: 'Reference Documentation',
                  description: 'Dialogs provide a simple, consistent interface for applications to interface with users.'
  
              });
          &lt;/script&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>But it always logs "Not logged in", even if I'm logged into Facebook, and the dialog gives me this error:</p>
  
  <pre><code>API Error Code: 102
  API Error Description: Session key invalid or no longer valid
  Error Message: Iframe dialogs must be called with a session key
  </code></pre>
  
  <p>I've searched all over, but I can't see how to get the <code>access token</code> anywhere.</p>
  
  <p>What am I doing wrong?</p>
  
  <p>Thank you in advance...</p>