title: Facebook login through android
body: <p>I write an Android application that integrates facebook, but failing in the login to facebook step. What I'm doing basically is to perform authorization and then ask if the session is valid. The answer is always negative. If I'm trying a simple request like:</p>
  
  <pre><code> String response = facebookClient.request("me"); 
  </code></pre>
  
  <p>I am getting this response: </p>
  
  <blockquote>
    <p>{"error":{"message":"An active access token must be used to query
    information about the current user.","type":"OAuthException"}}</p>
  </blockquote>
  
  <p>Maybe I have the wrong hash key (through I read pretty good threads how to get it right). I'd like to know if this is a way to insure key is matching.</p>
  
  <p>I based my code on this - <a href="https://stackoverflow.com/questions/2953146/android-java-post-simple-text-to-facebook-wall/2956352#2956352">Android/Java -- Post simple text to Facebook wall?</a>, and add some minor changes. This is the code:</p>
  
  <pre><code>public class FacebookActivity extends Activity implements DialogListener
  {
  
      private Facebook facebookClient;
  
      @Override
      protected void onCreate(Bundle savedInstanceState)
      {
          super.onCreate(savedInstanceState);
          this.setContentView(R.layout.main);//my layout xml  
  
      }
  
  
  
      public void login(View view)
      {
              facebookClient = new Facebook("my APP ID");
              facebookClient.authorize(this, this);
              if (facebookClient.isSessionValid() == true)
                  Log.d("Valid:", "yes");
              else
                  Log.d("Valid:", "no");
      }
  }
  </code></pre>