title: Get user accessToken with Java login for Facebook
body: <p>I need to get my user_accessToken with Java login. Have i to use the FacebookOAuthResult? If yes, how?
  I write an Applet for login to Facebook. It works, but i can't get the token.</p>
  
  <pre><code>...
  String GraphURL = "https://graph.facebook.com/me/friends?&amp;access_token=" + token;
  URL newURL = URL(GraphURL);
  HttpsURLConnection https = (HttpsURLConnection)newURL.openConnection();
  https.setRequestMethod("HEAD");
  https.setUseCache(false);
  ...
  
  //open a connection window like:
  if(Desktop.isDesktopSupported())
  {
  Desktop.getDesktop().browse(new URI(GraphURL));
  }
  else if(...
  </code></pre>
  
  <p>here to get token. it is right?</p>
  
  <pre><code>String getTokenUrl = "https://www.facebook.com/dialog/oauth?client_id=MY_APP_ID&amp;redirect_uri=https%3A%2F%2Fwww.facebook.com%2Fconnect%2Flogin_success.html&amp;response_type=token&amp;display=popup&amp;scope=user_about_me%2Cread_stream%2C%20share_item";
  
  Desktop desktop = Desktop.getDesktop();
  desktop.browse(new URL(getTokenUrl).toURI());
  
  URL tokenURL = new URL(getTokenUrl);
  URLConnection connect = tokenURL.openConnection();
  
  BufferedReader in = new BufferedReader(new InputStreamReader(connect.getInputStream()));
  
  String inputLine;
  StringBuffer bufferr = new StringBuffer();
  while ((inputLine = in.readLine()) != null)
  bufferr.append(inputLine + "\n");
  in.close();
  
  token = bufferr.toString();
  
  HttpURLConnection myWebClient = (HttpURLConnection)url.openConnection();
  myWebClient.setRequestMethod("HEAD");
  myWebClient.setUseCaches(false);
  //webClient..
  try
  {
  String gAntwort = myWebClient.getResponseMessage(); 
  
  if (myWebClient.getResponseCode() != HttpURLConnection.HTTP_OK)
  {
  //Not OK
  //JOptionPane.showMessageDialog(null, conn.getResponseMessage(), "URL Response", JOptionPane.INFORMATION_MESSAGE);
  }
  init();
  } catch (Exception d){
  
  }
  </code></pre>