Which worked OK, it gave me a proper key hash, on the Facebook settings, it shows the same keyhash, on the android build settings I selected that same debug.keystore and entered the proper password and also populated the app page on facebook with everything correctly, the package name, the class, and the key hash are all there.
However when running the example “InteractiveConsole” scene on my android the init works nicely but when I click login, it asks for permissions and I press OK, and it then says that “login was cancelled by the Player”.
I am at a complete loss on why that would happen, any ideas ?
So answering my own question, turns out the key hash was wrong, I modified the facebook API file AndroidFacebook.cs and made it log whatever key hash it was using by changing this method :
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"];
}
if (parameters.ContainsKey("key_hash"))
{
keyHash = (string)parameters["key_hash"];
Debug.Log("proper keyhash : " + keyHash);
}
OnAuthResponse(new FBResult(message));
}
And the logged keyhash was different from what every other method was giving me, including the API own informed key, I added the proper key to the facebook page it everything is OK now.
Hi guys… Sorry to revive such an old thread but I found the actual reason for the different keystore value. It is using the keystore defined in your publish settings. You have to either define the debug.keystore file there or use something like the fix i wrote for the faceboook sdk below.
Good post. I would like to add one more solution for when it fails even though following all solutions posted here.
If the facebook app hasn’t been opened for public, then only development accounts can be log in to the facebook app.
I spent about 2 hours because of this reason.
Go to: Control Panel > System > Advanced system settings > Environment Variables
Select the Variable “Path” in the “System variables” window and click Edit.
Add the path to your OpenSSL bin folder to the end of the “Variable value” text. e.g. I added “;C:\Program Files\OpenSSL-Win64\bin” to the end of the value text.
Restart Unity3D.
take note do not forget to add semi-colon “;” before the C:/
If you get the error in FacebookSettings “Keytool not found”, you need to add the JDK (Java Development Kit) bin directory to the Path variable value.
Follow the same steps as before, but instead of the OpenSSL bin path, add the JDK bin path. e.g. I added “;C:\Program Files\Java\jdk1.7.0_45\bin” to the end of the value text.
I lost a lot of time because even with the correct hashkeys on developer configuration page, the login fails as above,
the problem was that the manifest is wrong, be careful with “regenerate manifest” button, it seems do not work well (at least for me).
To really re-generate the manifest I had to delete the manifest file and then click on regenerate it.