简体   繁体   English

在Android中使用Facebook SDK for Unity3d登录

[英]Login in Facebook SDK for Unity3d in android

I need help using Facebook SDK for Unity3d in android. 我需要在Android中为Unity3d使用Facebook SDK的帮助。 I was trying to do all the tutorial said, but I can't login succesfully. 我试图按照本教程中的所有说明进行操作,但是我无法成功登录。 I do FB.Init and its ok, but FB.Login never works. 我做FB.Init及其确定,但FB.Login永远无法工作。 Always return this: 始终返回以下内容:

{
   "is_logged_in":false,
   "user_id":"",
   "access_token:"",
   "access_token_expires_at":"01/01/0001 00:00:00"
}

please, i need fix it as soon as possible. 请,我需要尽快修复它。

Thanks for all. 谢谢大家

i had the same problem this fixed it for me i was using the wrong keyhash in facebook, maybe you have the same problem 我遇到了同样的问题,这对我来说已经解决了,我在facebook中使用了错误的密钥哈希,也许您遇到了同样的问题

open the AndroidFacebook script and scroll till you see this: 打开AndroidFacebook脚本并滚动,直到看到以下内容:

 public void OnLoginComplete(string message)
        {
            var parameters = (Dictionary<string, object>)MiniJSON.Json.Deserialize(message);

            if (parameters.ContainsKey("user_id"))
            {
                isLoggedIn = true;
                userId = (string)parameters["user_id"];
                accessToken = (string)parameters["access_token"];
                accessTokenExpiresAt = FromTimestamp(int.Parse((string)parameters["expiration_timestamp"]));
            }

            if (parameters.ContainsKey("key_hash"))
            {
                keyHash = (string)parameters["key_hash"];
                print (keyHash);
            }

            OnAuthResponse(new FBResult(message));
        }

as you can see inside where it pertains to keyhash i put 如您所见,它与密钥哈希有关

print (keyHash);

so now if you run it and log in and use logcat on eclipse or a logger to see the print() that come out of the code check the keyhash you have in your facebook app and the one that is printed out with print (keyHash); 所以现在,如果您运行它并登录并在eclipse上使用logcat或使用记录器查看代码中的print(),请检查您的Facebook应用程序中具有的密钥哈希以及使用print(keyHash)打印出来的密钥哈希; witch is the correct one, hope this helps :) 女巫是正确的,希望这会有所帮助:)

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

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