2

I'm programming an Android App that should use the Facebook SDK to add some social interaction with Facebook.

My problem is, that the Authentication fails each time I try to run the app.

The only error message I get is: "An error occurred. Please try again later."

My call looks like that:

private Facebook facebook = new Facebook("MyAppID");

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    facebook.authorize(this, permissions, new LoginDialogListener());
}

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data)
  {
    super.onActivityResult(requestCode, resultCode, data);
    facebook.authorizeCallback(requestCode, resultCode, data);
  }

I have genereated my debugkey as described and it did work once... but only once! Since then I'm getting this error even after I uninstall the app.

Anyone who has that error too and may have found a solution?

Thanks for any help!

Edit: Got it back to work... no clue how.

I'll update this post if I find out why.

Olivier
  • 160
  • 2
  • 11
  • Take a look at [this post](http://stackoverflow.com/questions/6129308/an-errors-occurred-when-authenticating-with-facebooks-android-sdk) Maybe this provides a solution? – THelper Jun 03 '11 at 16:43
  • I actually did have that same problem at the beginning but it's not the same anymore. Thanks. – Olivier Jun 03 '11 at 17:07

2 Answers2

1

I had this exact same problem where it worked once and then stopped working. I changed nothing, just restarted the phone and it worked again! Logged out/in again and it worked fine.

Very strange.

Edit

Further observation shows that this only occurs when the facebook app is not installed. I'm guessing it is some facebook bug, maybe related to cookies or something.

Timmmm
  • 88,195
  • 71
  • 364
  • 509
0

The answer is that for "MyAppID" you need to use the App ID that Facebook assigned you when you created your account - not the Android Key Hash that you generated using the keytool.

Go to https://developers.facebook.com/apps. At the top left is a value, App ID/API Key. This is the value you should enter when you construct your new Facebook object with

Facebook facebook = new Facebook("4123532123123").

Enter the keytool value into Facebook's configuration page, enter the App ID into your application.

Thomson Comer
  • 3,919
  • 3
  • 30
  • 32
  • I'm pretty sure he had already done that! (Otherwise it wouldn't work at all.) I have the same symptoms as him (worked once but never again) and I have my ID set correctly. – Timmmm Nov 01 '12 at 17:29