title: How do I get Facebook's new OAuth 2.0 access_token with JavaScript in Google Chrome Extention?
body: <p>I want to create simple Google Chrome extention which would display News from Facebook.</p>
  
  <p>News feed can be retrieved by calling this:<br/>https://graph.facebook.com/me/home?<strong>access_token</strong>=...</p>
  
  <p>But I need <strong>access_token</strong>.</p>
  
  <p>Could someone give a hint how to define a JavaScript function which would return <strong>access_token</strong> when given YOUR_APP_ID. This function also should work inside Chrome Extention.</p>
  
  <p>Other examples on the internet did not work, because:<br/></p>
  
  <ul>
  <li>I don't have a server.<br/></li>
  <li>FB.getLoginStatus does not seem to work.</li>
  </ul>
  
  <p><strong>EDIT1</strong>:</p>
  
  <p>I've tried this:</p>
  
  <pre><code>    function getAccessToken2(YOUR_APP_ID) {
          alert("before FB.init");
          FB.init({
              appId  : YOUR_APP_ID ,
              status : true, // check login status
              cookie : true, // enable cookies to allow the server to access the session
              xfbml  : true  // parse XFBML
          });
          alert("before FB.login");
          FB.login( function (response) {
          alert("response");
              if ( response.authResponse ) {
                  alert("response.authResponse");
                  var access_token = response.authResponse.access_token;
                  alert(access_token);
              }
          } );
      }
  </code></pre>
  
  <p>And I've got:</p>
  
  <ul>
  <li>alert("before FB.init");</li>
  <li>alert("before FB.login");</li>
  <li><p>Popup opened. It's URL is <a href="https://www.facebook.com/dialog/oauth?api_key=280834438632804&amp;app_id=280834438632804&amp;client_id=280834438632804&amp;display=popup&amp;locale=en_US&amp;origin=1&amp;redirect_uri=https://s-static.ak.fbcdn.net/connect/xd_proxy.php?version=3#cb=f26be1326c&amp;origin=chrome-extension%253A%252F%252Fedolefjdphajfbpepcfnmldchhbbcjom%252Ff56dba178&amp;relation=opener&amp;transport=postmessage&amp;frame=f5df5f2f&amp;response_type=token,signed_request&amp;sdk=joey" rel="nofollow">this</a>. The content is:</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></li>
  </ul>
  
  <p>But I've did <em>NOT</em> got:</p>
  
  <ul>
  <li>alert("response");</li>
  <li>alert(access_token);</li>
  <li>no other JavaScript errors seen in debug mode.</li>
  </ul>
  
  <p><strong>Edit2</strong>
  The issue here is that I need to authenticate at Facebook like a desktop application. IMHO.</p>