title: How do you get the OAuth token from the JavaScript API?
body: <p>I have a page that is supposed to get the comments form a facebook object and post them on the page using JavaScript, but when the user logs in I cannot for the life of me figure out how to get the OAuth token. Here is my page.</p>
  
  <pre><code>&lt;div id="fb-root"&gt;&lt;/div&gt;
  &lt;script&gt;
      window.fbAsyncInit = function () {
          FB.init({
              appId: 'myrealappid',
              status: true,
              cookie: true,
              xfbml: true,
              oauth: true,
          });
      };
      (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));
      function getComments(objectid) {
  //I need to append the OAuth token to this graph request
          var commentUri = "https://graph.facebook.com/" + objectid + "/comments";
          return $.getJSON(commentUri, function (json) {
              var html = "&lt;ul&gt;";
              $.each(json.data, function (i, fb) {
                  html += "&lt;li&gt;" + fb.message + "&lt;/li&gt;";
              });
              html += "&lt;/ul&gt;"
          });
          $('.comments').html(html);
      };
      $(document).ready(function () {
          getTripComments(data.WallPostId);
      });
  &lt;/script&gt;
  &lt;div id="pageLogo"&gt;
      &lt;img src="/images/page_logo.png" alt="Digital Mementos" /&gt;
  &lt;/div&gt;
  &lt;div id="container"&gt;
      &lt;div class="fb-login-button"&gt;Login with Facebook to Comment&lt;/div&gt;
      &lt;div id="comments"&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>See where it says 'I need to append the OAuth token to this graph request'? Yeah, I need to do that. How do I get the OAuth token? Or am I going about this all wrong?</p>