简体   繁体   English

尝试使用keytool为Android Facebook生成密钥哈希

[英]Trying to generate key hash for Android Facebook with keytool

So I am trying to get a hash so Facebook can use SSO with my android app, but I am having an issue. 因此,我试图获取一个哈希值,以便Facebook可以在我的Android应用程序中使用SSO,但是我遇到了问题。

so I run this: 所以我运行这个:

keytool -exportcert -alias statusp -keystore my-release-key.keystore | openssl sha1 -binary | openssl enc -a -e

And it gives me an error that -exportcert is an illegal option, but it still gives me a key hash! 而且它给我一个错误,即-exportcert是非法选项,但仍然给我一个密钥哈希值! However, it gives me the same key hash if I use the debug key template Facebook provides. 但是,如果我使用Facebook提供的调试密钥模板,它将为我提供相同的密钥哈希。 So I don't think it's right. 所以我认为这是不对的。 It also didn't ask me for my password(s) when making the key hash. 在进行密钥哈希时,它也没有要求我提供密码。

This seems so simple, yet I don't know why I'm having so much trouble. 这看起来很简单,但是我不知道为什么我遇到这么多麻烦。 Can anyone offer any hints or suggestions? 谁能提供任何提示或建议?

I had the same problem, I spend a couple of hours to find a solution, but actually the Facebook SDK provides the solution by itself. 我遇到了同样的问题,我花了几个小时才能找到解决方案,但实际上Facebook SDK本身提供了解决方案。

in the DialogListener class I modified the onFacebookError method: 在DialogListener类中,我修改了onFacebookError方法:

 @Override
    public void onFacebookError(FacebookError error) {
         Log.d("myTag",error.getmessage);
    }

Execute the app (which was sign with the same key i use for the market), and on LogCat will be a message under this tag with the correct key. 执行该应用程序(使用我在市场上使用的相同密钥进行签名),然后在LogCat上使用正确的密钥在此标签下显示一条消息。

We had also created a simple project which does all the work, and returns the correct key on an alert-box and on LogCat. 我们还创建了一个简单的项目来完成所有工作,并在警报框和LogCat上返回正确的密钥。 You can find it on our blog . 您可以在我们的博客上找到它。

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

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