I am getting this error. When I try to sign in with facebook to my app. When I first time authentication it will correctly working. After I unistalled my application and now trying to sign in with Facebook on that I am getting this error.
Another Issue : After authenticate in device1 and try to login with facebook on device2 also same error is getting.
Solution I Found : when I remove App authentication from Facebook App Settings it is working in above scenario's but this is not an good solution how we can tell to users to do this action?
btnFbLogin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(accessToken != null) {
boolean expires = accessToken.isExpired();
if(!expires) {
performFbLoginOrSignUp(accessToken);
}
} else {
LoginButton loginButton = (LoginButton) findViewById(R.id.login_button);
callbackManager = CallbackManager.Factory.create();
if (loginButton != null) {
loginButton.setReadPermissions("public_profile", "email", "user_friends");
if (CommonUtil.isConnectingToInternet(LoginActivity.this)) {
loginButton.performClick();
loginButton.setPressed(true);
loginButton.invalidate();
loginButton.registerCallback(callbackManager, mCallBack);
loginButton.setPressed(false);
loginButton.invalidate();
}
}
}
}
});
In Facebook example also having an issue : GitHub link of Facebook example
Steps to reproduce :
Launch the app Login with Facebook Authenticate FB profile.
Un_install the app and install again.
Now try to Login with Facebook.
The error occurs because of invalid hash key.
We can create Hash key using the below command and update the same here under Settings-> Basic -> Android HashKeys
keytool -exportcert -alias ADD_RELEASE_KEY_ALIASE_HERE -keystore ADD_UR_KEYSTORE_PATH_HERE | openssl sha1 -binary | openssl base64
You can find the Relase Key Alias of your keystore using the below command if needed:
keytool -list -keystore ADD_UR_KEYSTORE_PATH_HERE
I have also experience an issue like by using the above HashKey the login works fine if I install the release APK directly to the device, But when I upload the APK to Play Store and install app from store then it shows the same Login failed error. The fix for this is as follows: