在Android的Facebook应用程序无效的哈希键 [英] Invalid Hash key in facebook app in android
问题描述
我的哈希键从下方的Android code:
I got hash key from below code in android:
try {
PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(),
PackageManager.GET_SIGNATURES);
for (Signature signature : packageInfo.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
}
}
catch (NameNotFoundException e1) {
Log.e("Name not found", e1.toString());
}
catch (NoSuchAlgorithmException e) {
Log.e("No such an algorithm", e.toString());
}
catch (Exception e){
Log.e("Exception", e.toString());
}
但它是无效键......请建议如何验证哈希键Facebook登录....
But it was invalid key... Please suggestion how to verify hash key for Facebook login....
推荐答案
您所得到的散列键与调试的关键...这可能工作,如果您还没有登录调试模式打包和运行应用程序。什么,你需要做的是:
You are getting the hash-key with debug key... Which may work if you haven't sign the package and running app in debug mode. What you need to do is :
1)进入清单文件,并添加到应用程序的android:可调试=真正的
1) Go to the manifest file and add to the application android:debuggable="true".
2)注册申请,capy和手动或使用安装到您的设备的命令行亚行安装path_to_apk。
2) Sign the application, capy and install to your device manually or for use "adb install path_to_apk" from command line.
3)现在运行您的应用程序和监视的logcat。
3) Now run your app and monitor the logcat.
4)您将获得印=在过去的一个新的关键,这将是匹配的密钥,密钥Facebook应用程序是显示错误味精,你有现在有一个关键的标志。
4) You will get printed a new key which will be the matching key with key facebook app is showing in the error msg, The key you have got is now having a = sign in the last.
5)注册在Facebook开发者网站此键
5) Register this key on facebook developer site
备用招数
您可以做的另一件事情简单的注册键是显示错误消息的密钥散列###不符合任何存储的密钥散列值就在###的末尾添加=。它会像### =
You can do one other thing Simply register key which is showing in the error msg "The key hash ### does not match any stored key hashes" Just add the = in the end of the ###. It will be like ###=
你做!希望这将正常工作。
you are done!! Hope this will work.
这篇关于在Android的Facebook应用程序无效的哈希键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!