Reputation: 160
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.
Upvotes: 2
Views: 2591
Reputation: 96537
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.
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.
Upvotes: 1
Reputation: 3919
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.
Upvotes: 0