Android的Facebook的密钥散列停止工作 [英] Android Facebook Key Hash Stopped Working

查看:162
本文介绍了Android的Facebook的密钥散列停止工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建一个Android应用程序,将与Facebook集成。我已经能够成功地生成一个密钥散列,当我跑我的应用程序登录,我顺利到了接受权限按钮。我点击接受,从那时起,我一直无法从应用程序重新登录。我给出的错误(插入钥匙有我使用这里)不符合任何允许的关键。在配置您的应用程序键哈希(列出我的Facebook开发者URL)。是否有任何理由为什么一个密钥散列会工作,然后就只是停止?我并没有改变任何Facebook的设置,并没有改变任何应用程序code。我试图创建一个新的密钥散列,但是这仍然没有奏效。什么这可能是任何想法,或如何解决这将是极大的AP preciated!

I am creating an Android app that will integrate with Facebook. I have been able to successfully generate a Key Hash, and when I run my app to log in, I successfully got to the accept permissions button. I clicked accept and since then, I haven't been able to log back in from the app. I am given the error "(insert the key has i'm using here) does not match any allowed key. Configure your app key hashes at (lists my Facebook developer URL)". Is there any reason why a Key Hash would work and then would just stop? I did not alter any facebook settings and did not alter any application code. I've tried creating a new key hash, but that still didn't work. Any ideas on what this could be, or how to resolve it would be greatly appreciated!

推荐答案

我想通了这一点。不知何故,散列键就停了匹配我所插在Facebook上的一面。使用Facebook的文档,我在$ C $下加入我说告诉我散列键是在我的LogCat中onCreate方法。我还添加了一些日志code在我的事件捕获异常,我是拧紧了我的包的名字。这是code:

I figured this out. Somehow, the Hash Key just stopped matching what I had inserted on the Facebook side. Using the facebook documentation, I added in code in my onCreate method that told me what the hash key was in my LogCat. I also added in some logging code for my catch exceptions in the event that I was screwing up my package name. This is the code:

try {
            PackageInfo info = getPackageManager().getPackageInfo(
                    "com.your.package", 
                    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) {
            Log.d("Error1", "NameNotFoundException");

        } catch (NoSuchAlgorithmException e) {
            Log.d("Error2", "Algorthim");

        }

我补充说,并运行它后,我发现在我的日志猫哈希键,然后只是复制了我的Facebook应用。保存后,再次运行应用程序和它的工作!

After I added that and ran it, I found the hash key in my log cat, and then just copied that to my Facebook App. Saved it, ran the app again and it worked!

这篇关于Android的Facebook的密钥散列停止工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆