title: Get facebook user/app token in a python desktop app
body: <p>I am writing a python desktop app that will access a user's facebook photos. The app currently supports flickr, which uses a similar oauth authentication process, but I am struggling to figure out how to authenticate the app for facebook. For flickr, the basic steps are: </p>
  
  <ol>
  <li>App opens a browser on the authentication page </li>
  <li>user gives the app permission to access the account</li>
  <li>App receives a token as a http response that can then be used with flickr's api</li>
  </ol>
  
  <p>I am hoping that there is something similar for facebook, but I haven't been able to figure it out.</p>
  
  <p>There are a variety of facebook API libraries for python, such as Pyfb, which provides a simple way of accessing graph data, but none of them provide an obvious way to do the authentication steps above and retrieve a token that can be used. Here's the example from Pyfb, which presumes that the user token will be manually entered by the user, which is totally ridiculous for a desktop app...</p>
  
  <pre><code>from pyfb import Pyfb
  
  #Your APP ID. You Need to register the application on facebook
  #http://developers.facebook.com/
  FACEBOOK_APP_ID = 'YOUR_APP_ID'
  
  pyfb = Pyfb(FACEBOOK_APP_ID)
  
  #Opens a new browser tab instance and authenticates with the facebook API
  #It redirects to an url like  http://www.facebook.com/connect/login_success.html#access_token=[access_token]&amp;expires_in=0
  pyfb.authenticate()
  
  #Copy the [access_token] and enter it below
  token = raw_input("Enter the access_token\n")
  
  #Sets the authentication token
  pyfb.set_access_token(token)
  
  #Gets info about myself
  me = pyfb.get_myself()
  </code></pre>