Login in Facebook SDK for Unity3d in android

I need help using Facebook SDK for Unity3d in android. 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. 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.

Answers


i had the same problem this fixed it for me i was using the wrong keyhash in facebook, maybe you have the same problem

open the AndroidFacebook script and scroll till you see this:

 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); witch is the correct one, hope this helps :)


Need Your Help

Display Image through Parse iOS

ios xcode parsing uiimageview uiimage

I have a mapview that displays an array of annotations pulled from parse. Each one has a detail view controller that displays labels connected to the annotation and I am trying to have an image dis...

Flex viewstack keeps redrawing invisible child, how to fix?

flex memory viewstack

The situation: I've got a ViewStack with 2 children (both of type Panel).