I have added the key hash logged by this call (plus an equals sign) to the settings for my app on the Facebook developer site.
Log.d("MyApp", FacebookSdk.getApplicationSignature(this));
I can repeat the following steps indefinitely. Facebook login works the first time, but fails on all subsequent attempts.
Facebook App (v91.0.0.17.68)
Facebook Android SDK (v4.15.0)
- Revoke Facebook Login at https://www.facebook.com/settings?tab=applications
- Login with Facebook
- Success
- Login with Facebook
- Invalid key hash. The key hash KEY_HASH does not match any stored key hashes. Configure your app key hashes at http://developers.facebook.com/apps/FACEBOOK_APP_ID
The KEY_HASH in the error messages exactly matches one of the key hashes I have saved to the app on the Facebook developer site (at the link listed in the error message).
This only happens when the Facebook app is installed on the device. Facebook login succeeds multiple times in a row using the fallback web login.
I've found this and this question that have a combined single answer of "revoke Facebook Login manually in the app before trying to log in again" which seems like a hacky workaround to me.
Why do you have to revoke Facebook Login before logging in again? With the web fallback login it just says "you've already authorized this app". I would expect the same behavior here.
Edit: This only happens with a debug build. I can login repeatedly with the Facebook app installed if I use a release build (minify disabled just to reduce the changes).