简体   繁体   中英

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.

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! However, it gives me the same key hash if I use the debug key template Facebook provides. 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.

in the DialogListener class I modified the onFacebookError method:

 @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.

We had also created a simple project which does all the work, and returns the correct key on an alert-box and on LogCat. You can find it on our blog .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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