Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug Firebase Authentication App Creation Failed

Discussion in 'Scripting' started by honrese, Dec 2, 2023.

  1. honrese

    honrese

    Joined:
    Jun 5, 2020
    Posts:
    2
    Hello guys,
    I have a problem. Even though I tried many times, I could not solve this problem. Below I share my project settings and codes with you. Thank you in advance to those who will help.
    Unity version 2022.3.12f
    Scripting : .NET Standart 2.1

    Code (CSharp):
    1.     private void Start()
    2.     {
    3.         try
    4.         {
    5.             PlayGamesPlatform.Activate();
    6.             PlayLoginn();
    7.         }
    8.         catch (Exception e)
    9.         {
    10.             infoTxt.text = "Try error: " + e.ToString();
    11.             throw;
    12.         }
    13.  
    14.  
    15.     }
    16.     public void PlayLoginn()
    17.     {
    18.         PlayGamesPlatform.Instance.Authenticate((success) =>
    19.         {
    20.             if (success == SignInStatus.Success)
    21.             {
    22.                 infoTxt.text = "Login In.";
    23.                 Firebase.FirebaseApp.CheckAndFixDependenciesAsync().ContinueWithOnMainThread(task =>
    24.                 {
    25.                     if (task.Result == Firebase.DependencyStatus.Available)
    26.                     {
    27.                         firebaseTxt.text = "Dependency in";
    28.                         connectToFirebase();
    29.                     }
    30.                     else
    31.                     {
    32.                         firebaseTxt.text = "Dependency Error";
    33.                     }
    34.                 });
    35.             }
    36.             else if (success == SignInStatus.InternalError)
    37.             {
    38.                 infoTxt.text = "InternalError: " + success.ToString();
    39.             }
    40.             else
    41.             {
    42.                 infoTxt.text = "Error: " + success.ToString();
    43.             }
    44.         });
    45.     }
    46.  
    47.     void connectToFirebase()
    48.     {
    49.         PlayGamesPlatform.Instance.RequestServerSideAccess(true, code =>
    50.         {
    51.             try
    52.             {
    53.                 authCode = code;
    54.                 FirebaseAuth fbAuth = FirebaseAuth.DefaultInstance;
    55.                 Credential fbCred = PlayGamesAuthProvider.GetCredential(authCode);
    56.                 fbAuth.SignInWithCredentialAsync(fbCred).ContinueWithOnMainThread(task =>
    57.                 {
    58.                     if (task.IsCanceled)
    59.                     {
    60.                         firebaseTxt.text = "Sign in cancelled";
    61.                     }
    62.                     if (task.IsFaulted)
    63.                     {
    64.                         firebaseTxt.text = "fireBase Error: " + task.Result;
    65.                     }
    66.                     Firebase.Auth.FirebaseUser user = fbAuth.CurrentUser;
    67.                     if (user != null)
    68.                     {
    69.                         firebaseTxt.text = "Signed in as: " + user.DisplayName;
    70.                     }
    71.                 });
    72.             }
    73.             catch (Exception e)
    74.             {
    75.                 throw;
    76.             }
    77.         });
    78.     }
    WhatsApp Image 2023-12-02 at 12.11.32.jpeg
     
  2. joefspiro

    joefspiro

    Joined:
    Jan 6, 2022
    Posts:
    32
    What target platform are you running this on?

    What version of the SDK are you running?

    Have you included the appropriate configuration files for your default platform? The fact that Firebase.FirebaseApp has a 0x00000 memory address makes me think its unable to generate a default app. Please include other warnings or errors you may have seen.

    Additionally, if you have time consider running through this debug guide and respond with what you find.
     
    honrese likes this.
  3. honrese

    honrese

    Joined:
    Jun 5, 2020
    Posts:
    2


    Thank you for your interest.

    SDK Version: Google Play Services 0.11.01 SDK Version: Firebase 11.6.0 Platform: Android

    The StreamingAssets/ folder is not being created automatically, so I am creating it manually (yet, this did not solve the issue). I can send and receive data in play mode within Unity. However, when I try it on an Android device with the APK, it doesn't work. It automatically gets created in Unity version 2020.3, but I encounter this issue in version 2022.3f. The sole problem is the automatic creation of the StreamingAssets/ folder and its contents not happening in version 2022.3, which is preventing the creation of the FirebaseApp. Thank you for your assistance.