Facebook login fails with FB app installed

只愿长相守 提交于 2020-01-14 05:38:24

问题


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?


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/22238125/facebook-login-fails-with-fb-app-installed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!