Facebook Unity SDK on Android - Login fails when FB App installed

后端 未结 2 1771
情深已故
情深已故 2020-12-06 11:57

I appear to be having the same issue as discussed in this question: Facebook SDK for Unity on Android - Trouble about callback from FB.Login

On Android when the regu

相关标签:
2条回答
  • 2020-12-06 12:29

    I had a same error. And i have remove facebook app. My app is working fine


    MORE ON THAT: https://stackoverflow.com/a/23446140/294884

    0 讨论(0)
  • 2020-12-06 12:37

    Ach feel so silly, eventually managed to solve it myself, by deploying to an intermediary Google Android Project, I was able to use logcat to obtain a more useful error messsage:

    remote_app_id does not match stored id

    From there I found this topic relating to the standard Android SDK: Android Facebook SDK 3.0 gives "remote_app_id does not match stored id" while logging in

    And finally solved the problem by replacing the Key Hash with the one obtained by this code snippet

    try {
    PackageInfo info = getPackageManager().getPackageInfo(
          "com.facebook.samples.loginhowto", PackageManager.GET_SIGNATURES);
    for (Signature signature : info.signatures){
           MessageDigest md = MessageDigest.getInstance("SHA");
           md.update(signature.toByteArray());
           Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
    }
    } catch (NameNotFoundException e) {
    } catch (NoSuchAlgorithmException e) {
    }
    

    Replacing com.facebook.samples.loginhowto with your own package name of course

    Source: https://stackoverflow.com/a/14421260/2823496

    It seems getting the correct keyhash, via command line or through Unity depends on having the right version of openssl installed (and stored in PATH) but no idea what version that is. (tried the one in linked answer) So heads up to anyone else struggling with this.


    Note - it's almost impossible to do this if you're using Mac for Unity development. Here's the fortunately simple solution in that case http://answers.unity3d.com/questions/609810/using-facebook-api-with-android-says-login-is-canc.html

    0 讨论(0)
提交回复
热议问题