Can't relogin with Facebook credentials after logout

試著忘記壹切 提交于 2019-12-03 08:43:28

I had the same problem, even when running Facebook's sample apps. I solved this by providing my default signing key to Facebook: both in my Developer Settings for the Sample Apps at https://developers.facebook.com/settings/developer/sample-app/ and then in your Apps settings in the Android platform.

Facebook suggests an easy way to get at your default key which can be found under Troubleshooting at https://developers.facebook.com/docs/android/getting-started. The code for doing so when running the Hello Facebook example app is provided below.

try {
    PackageInfo info = getPackageManager().getPackageInfo(
        "com.facebook.samples.hellofacebook", 
        PackageManager.GET_SIGNATURES);

    for (Signature signature : info.signatures) {
        MessageDigest md = MessageDigest.getInstance("SHA");
        md.update(signature.toByteArray());
        Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
    }
} catch (NameNotFoundException e) {
} catch (NoSuchAlgorithmException e) {
}

Note: When you're publishing apps, you shouldn't be using the default key and be generating and signing apps with your own.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!