0

Using Unity 4.3 and Facebook SDK 5.0.3 / 5.0.4 beta I seem to be unable to log in to Facebook on Android using FB.Login("publish_actions", LoginCallback). My game shows the "Game would like to post to your friends on your behalf"-message. After tapping OK, I get an ajax-spinner for about 2-3 seconds after which I'm brought back to my game without being able to post a FB.Feed.

The message I'm getting is:

V/FBUnitySDK( 8892): sending to Unity OnLoginComplete({"cancelled":true,"key_hash":"XXXXXXXXXXXXXXXXXXX"})

As soon as I remove the Facebook app, everything seems to work fine and I'm getting a popup that asks for my publish_actions permissions.

I also looked into the key hash problem and was able to find the correct key_hash by getting FB.Android.KeyHash.

Is there a way around this?

Fluup
  • 53
  • 1
  • 8

2 Answers2

2

if there is the default Facebook App is installed in your phone or if you are trying to upload your app on Google Play, then you need a different KeyHash. because, when u developed your FB app you have registered your FB app with a key hash which is created by using the default debug.keystore.

so, now u need a different KeyStore to generate the different KeyHash. u need a signed KeyStore, which u can get by the help of this tutorial , after generating new keystore, generate a key hash and register your FB App with this new key hash. this should work. for generating new KeyHash u can follow this link.

Community
  • 1
  • 1
Shoshi
  • 2,194
  • 1
  • 26
  • 42
  • Any way of doing this for Mac? I've been trying all sorts of methods, but none of them work. I did get my fingerprint, but I can't seem to create a key hash out of it. – Fluup Mar 12 '14 at 14:06
1

Okay, I finally figured it out.

On Mac, in Terminal, enter the following:

keytool -list -keystore pathtokeystorefile.keystore | openssl sha1 -binary | openssl base64

You'll be prompted to enter the password. Do so and you will get your valid KeyHash.

Fluup
  • 53
  • 1
  • 8