使用发布密钥的 Android 应用程序 Facebook 登录 [英] Facebook Login for Android App with release key
问题描述
我正在尝试在 Google Play 上发布我的应用.我的应用中有 Facebook 登录名.直到昨天,一切正常,直到我使用 debug.keystore
运行应用程序.但是,当我使用自己的发布密钥并签署我的应用程序时,Facebook 无法登录,我似乎无法弄清楚原因.
I am trying to release my app on Google Play. I have a Facebook login in my app. Up until yesterday all was working fine till the time I was running the application with debug.keystore
. But when I use my own release key and sign my application Facebook doesn't login and I cant seem to figure out why.
按照这个链接,也做了所有的事情:所以:key-hash-for-android-facebook-app
Followed this link and did all that was meth as well : so : key-hash-for-android-facebook-app
我更换了机器,也更换了平台(windows 和 mac osx ML)以获得解决方案,但同样的问题.它没有登录.当我使用 debug.keystore 时,下面的代码为我提供了正确的哈希键,当我使用不同的键对应用程序进行签名时,我得到相同的哈希键(经过大量试验,我得出的结论是我得到的密钥是错误的)
I changed machines, I changed platforms (windows and mac osx ML) as well to get a solution but the same issue. IT DOES NOT LOG IN. The below code gives me the proper hash key when i use debug.keystore where as when i sign the application even with different keys I get the same Hashkey ( which I have come to a conclusion after lots of trials that the key i get is wrong)
PackageInfo info;
try {
info = getPackageManager().getPackageInfo("com.you.name", PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md;
md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
String something = new String(Base64.encode(md.digest(), 0));
//String something = new String(Base64.encodeBytes(md.digest()));
Log.e("hash key", something);
}
} 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());
}
在使用发布密钥签署应用程序时,我们是否需要采取任何额外的步骤.请帮助.
So is there any kind of extra steps which we need to take when signing the application with the release key. Please HELP.
推荐答案
这是我解决问题的方法:
Here is what I did that solved the problem:
- 使用 openssl-0.9.8e_WIN32 而不是 openssl-0.9.8k_WIN32
- 我没有在下面使用别名,或者我在别名中输入了一个空格,因为生成的密钥是错误的.
我用这个代替:
keytool -exportcert -alias <aliasNameUseInReleaseKeystore> -keystore <ReleasekeystoreFilePath> | openssl sha1 -binary | openssl base64
附言我在问题中发布的方法真的没用.它无非是让我迷惑不解.
P.S. The method which I have posted in my question is really useless. It did nothing more than confuse me to no end.
这篇关于使用发布密钥的 Android 应用程序 Facebook 登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!