简体   繁体   English

当移动设备已经具有Facebook应用程序并显示“无效哈希键” android之类的错误时,facebook集成无法正常工作?

[英]facebook integration is not working when the mobile have already facebook application and shows the error like “invalid hash key” android?

In my application i want to integrate the facebook. 在我的应用程序中,我想集成Facebook。 I wrote all the code for this.But whenever i click the facebook login button it showing one popup like "Invalid key hash and the key hash XXX does not match with any stored key hash" If my mobile not having facebook application, then it is working. 我为此编写了所有代码。但是,每当我单击Facebook登录按钮时,它都会显示一个弹出窗口,例如“无效的哈希值和密钥哈希值XXX与任何存储的密钥哈希值都不匹配”。如果我的手机没有Facebook应用程序,工作。 If my mobile is having facebook app the facebook integration is not possible to me. 如果我的手机安装了Facebook应用程序,那么我无法进行Facebook集成。

for hash key: (oncreate) 用于哈希键:(oncreate)

 try {
            Log.v("TAG_PACKNAME",""+"UUUU");
            PackageInfo info = getPackageManager().getPackageInfo(
                    "Your package name",
                    PackageManager.GET_SIGNATURES);
            for (Signature signature : info.signatures) {
                MessageDigest md = MessageDigest.getInstance("SHA");
                md.update(signature.toByteArray());
                Log.v("TAG_PACKNAME",""+ Base64.encodeToString(md.digest(), Base64.DEFAULT));  // not printing

            }
        } catch (PackageManager.NameNotFoundException e) {

        } catch (NoSuchAlgorithmException e) {

        }

i got hash key and release key too. 我也有哈希键和释放键。 i added both developement key and release key in facebook console. 我在Facebook控制台中添加了开发密钥和发布密钥。 But whenever i click the facebook login button it pop ups like "invalid hash key. the hash key not matched with already stored hashkey" please any one help me out. 但是,每当我单击Facebook登录按钮时,它都会弹出类似“无效的哈希密钥。哈希密钥与已存储的哈希密钥不匹配”之类的消息,请任何人帮助我。

When you are redirected to Facebook app and when it shows invalid keyhash, The keyhash XXXX doesnot match with any stored keyhashes. 当您重定向到Facebook应用并且显示无效的密钥哈希时,密钥哈希XXXX与任何存储的密钥哈希都不匹配。 Copy the keyHash XXXX add = to that and paste XXXX= in the Key hashes section in Facebook 将keyHash XXXX add =复制到其中,并将XXXX =粘贴到Facebook的Key hash部分中 在此处输入图片说明

You need generate your release keyhash with this: 您需要使用以下命令生成发布密钥哈希:

Mac/osx: Mac / osx:

keytool -exportcert -alias <RELEASE_KEY_ALIAS> -keystore <RELEASE_KEY_PATH> | openssl sha1 -binary | openssl base64

Windows: 视窗:

keytool -exportcert -alias <RELEASE_KEY_ALIAS> -keystore <RELEASE_KEY_PATH> | openssl sha1 -binary | openssl base64

And your debug key like this: 和您的调试键是这样的:

On OS X, run: 在OS X上,运行:

keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64

On Windows, run: 在Windows上,运行:

keytool -exportcert -alias androiddebugkey -keystore %HOMEPATH%\.android\debug.keystore | openssl sha1 -binary | openssl
base64

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM