I am using this simple code from here:
https://developers.facebook.com/docs/mobile/android/build/#sig
public class MainActivity extends Activity {
Facebook facebook = new Facebook("xxxxxxxxxxxxxx");
AsyncFacebookRunner mAsyncRunner = new AsyncFacebookRunner(facebook);
private SharedPreferences mPrefs;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mPrefs = getPreferences(MODE_PRIVATE);
String access_token = mPrefs.getString("access_token", null);
long expires = mPrefs.getLong("access_expires", 0);
if (access_token != null) {
facebook.setAccessToken(access_token);
}
if (expires != 0) {
facebook.setAccessExpires(expires);
}
if (!facebook.isSessionValid()) {
facebook.authorize(this, new String[] {}, new DialogListener() {
@Override
public void onComplete(Bundle values) {
SharedPreferences.Editor editor = mPrefs.edit();
editor.putString("access_token", facebook.getAccessToken());
editor.putLong("access_expires",
facebook.getAccessExpires());
editor.commit();
}
@Override
public void onFacebookError(FacebookError error) {
}
@Override
public void onError(DialogError e) {
}
@Override
public void onCancel() {
}
});
}
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
facebook.authorizeCallback(requestCode, resultCode, data);
try {
JSONObject json = Util.parseJson(facebook.request("me"));
String facebookID = json.getString("id");
String firstName = json.getString("first_name");
String lastName = json.getString("last_name");
String email = json.getString("email");
String gender = json.getString("gender");
} catch (Exception e) {
//If i click Okay i get Exception saying You need an Active access token to get the current user details
}
}
}
got Hash key using this:

which asks for a password (“android”)
and gives me a code like this:
xLYMxxxxxx/0enePexxf4DORUfR8=
and in facebook application my configurations are:

But i get this Error:

and if i press Okay i get the Exception saying You need an Active access token to get the current user details.
I tried all possible solutions given on SOF. But of no use. Please help
Thank You
It seems like you didn’t get your hash key correctly from the terminal.
Try this instead
Util.javaand setENABLE_LOGto true.Copy and paste that key into your dashboard and try again.
See this SO thread: App is misconfigured for Facebook login : Android Facebook integration issue