I am just learning restfb
. I registered an app on the FB site and got an app ID and Secret keys. However, as per this tutorial, I am supposed to have an access token to initialize DefaultFacebookClient. 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.
Request https://graph.facebook.com/oauth/authorize?client_id=MY_API_KEY&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& redirect_uri=http://www.facebook.com/connect/login_success.html&client_secret=MY_APP_SECRET&code=MY_VERIFICATION_CODE
Facebook will respond with access_token=MY_ACCESS_TOKEN
I did exactly that but every time I get
{
"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
}
}
Any idea what I am supposed to do to get an access token and start using the API?