title: How to get FB access token given App ID and Secret?
body: <p>I am just learning <code>restfb</code>.  I registered an app on the FB site and got an app ID and Secret keys.  However, as per <a href="http://restfb.com" rel="nofollow">this tutorial</a>, I am supposed to have an access token to initialize <a href="http://restfb.com/javadoc/com/restfb/DefaultFacebookClient.html" rel="nofollow">DefaultFacebookClient</a>.  I tried to follow the instructions there but none sufficiently explained how to get the access token out of the app ID and secret key.</p>
  
  <pre><code>Request https://graph.facebook.com/oauth/authorize?client_id=MY_API_KEY&amp;redirect_uri=http://www.facebook.com/connect/login_success.html
  
  Facebook will redirect you to http://www.facebook.com/connect/login_success.html?code=MY_VERIFICATION_CODE
  
  Request https://graph.facebook.com/oauth/access_token?client_id=MY_API_KEY&amp; redirect_uri=http://www.facebook.com/connect/login_success.html&amp;client_secret=MY_APP_SECRET&amp;code=MY_VERIFICATION_CODE
  
  Facebook will respond with access_token=MY_ACCESS_TOKEN
  </code></pre>
  
  <p>I did exactly that but every time I get</p>
  
  <pre><code>{
     "error": {
        "message": "Error validating verification code. Please make sure your redirect_uri is identical to the one you used in the OAuth dialog request",
        "type": "OAuthException",
        "code": 100
     }
  }
  </code></pre>
  
  <p>Any idea what I am supposed to do to get an access token and start using the API?</p>