在Facebook的应用程序的Andr​​oid哈希键的变化应用程序、Facebook、Andr、哈希键

2023-09-07 09:59:31 作者:失物招領

我试图把我的debbug哈希键,它是:e3U9nzK7A8gyWoCiNUZQA / C + BZI =。但每次我把它放在我的Facebook应用程序的关键部分哈希值会自动更改为e3U9nzK7A8gyWoCiNUZQA%2FC%2BbZI%3D在里面,使我的应用程序形同虚设。我用两种方法来得到这个关键,它返回相同:密钥工具-exportcert -alias androiddebugkey -keystore〜/ .android / debug.keystore | OpenSSL的SHA1 -binary | OpenSSL的BASE64

 私人无效getAppKeyHash(){    尝试{        PackageInfo信息= getPackageManager()getPackageInfo(getPackageName(),PackageManager.GET_SIGNATURES)。        对(签字签名:info.signatures){            消息摘要MD;            MD = MessageDigest.getInstance(SHA);            md.update(signature.toByteArray());            字符串的东西=新的String(Base64.en code(md.digest(),0));            Log.d(哈希键的东西);        }    }    赶上(E1的NameNotFoundException){        // TODO自动生成catch块        Log.e(找不到名称,e1.toString());    }    赶上(抛出:NoSuchAlgorithmException E){        // TODO自动生成catch块        Log.e(没有这样的算法,e.toString());    }    赶上(例外五){        Log.e(异常,e.toString());    }} 

解决方案

我有同样的问题,并意识到这是fecebook's结束的错误。请参见链接。很是烦人。

修改

,直到它被解决的唯一可行的解​​决方案(丑陋)似乎是通过Web界面来强制登录,因为SSO是使用haskey之一。

如果使用的登录按钮:

  LoginButton authButton =(LoginButton)view.findViewById(R.id.authButton);authButton.setLoginBehavior(SessionLoginBehavior.SUP preSS_SSO); 

来源:Android - 强制Facebook的联接 - 堆栈溢出

编辑2

有可虽然解决;我问一个朋友(通过Skype,he's在Mac)将它们加入到我。他设法得到它的权利(但我不知道如何)。

修改3

现在这个问题似乎已经解决了本身对我来说。进入HASHKEYS不再被改写。无论是通过FB队解决,或只是需要重新启动计算机,从我,我不知道。

I'm trying to put my debbug hash key, which is : "e3U9nzK7A8gyWoCiNUZQA/C+bZI=". But every time i put it inside the key hash section on my Facebook App it changes to "e3U9nzK7A8gyWoCiNUZQA%2FC%2BbZI%3D" automatically, making my app useless. I used two methods to get this key, and it returned the same : keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64

and :

 private void getAppKeyHash() {
    try {
        PackageInfo info = getPackageManager().getPackageInfo(getPackageName(), 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));
            Log.d("Hash key", something);
        } 
    }
    catch (NameNotFoundException e1) {
        // TODO Auto-generated catch block
        Log.e("name not found", e1.toString());
    }

    catch (NoSuchAlgorithmException e) {
        // TODO Auto-generated catch block
        Log.e("no such an algorithm", e.toString());
    }
    catch (Exception e){
        Log.e("exception", e.toString());
    }

}

解决方案

I have the same problem, and realised this is a bug on fecebook´s end. See link. Very anoying.

Edit

The only working solution (but ugly) until it is solved seems to be to force login through web interface, since SSO is the one using the haskey.

If using the login-button:

LoginButton authButton = (LoginButton) view.findViewById(R.id.authButton);
authButton.setLoginBehavior(SessionLoginBehavior.SUPPRESS_SSO);

Source: Android - Force Facebook connexion - Stack Overflow

Edit 2

It can be solved though; I asked a friend (over Skype, he´s on a mac) to add them for me. And he managed to get it right (but I do not know how).

Edit 3

Now this issue seems to have solved itself for me. Entered hashkeys no longer gets rewritten. Whether it is solved by fb-team or just required a computer restart from me I do not know.