【问题标题】:How to set Firebase Database URL (Unity)如何设置 Firebase 数据库 URL (Unity)
【发布时间】:2021-05-15 17:40:10
【问题描述】:

我正在尝试使用 Firebase 创建 Facebook 登录。 我的登录功能是:

public void FacebookLogin()
    {
        var perms = new List<string>() { "public_profile", "email" };
        FB.LogInWithReadPermissions(perms, AuthCallback);

        if (FB.IsLoggedIn)
        {
            
            string aToken = Facebook.Unity.AccessToken.CurrentAccessToken.UserId;
            Firebase.Auth.FirebaseAuth auth = Firebase.Auth.FirebaseAuth.DefaultInstance;

            Firebase.Auth.Credential credential = Firebase.Auth.FacebookAuthProvider.GetCredential(aToken);
           
            auth.SignInWithCredentialAsync(credential).ContinueWith(task => {
                if (task.IsCanceled)
                {
                    Debug.LogError("SignInWithCredentialAsync was canceled.");
                    return;
                }
                if (task.IsFaulted)
                {
                    Debug.LogError("SignInWithCredentialAsync encountered an error: " + task.Exception);
                    return;
                }
                
                Firebase.Auth.FirebaseUser newUser = task.Result;
                Debug.LogFormat("User signed in successfully: {0} ({1})",
                    newUser.DisplayName, newUser.UserId);
            });



        }

       
    }

我的问题是警告“未在 Firebase 配置中设置数据库 URL。”,然后是 SignInWithCredentialAsync 错误 (System.AggregateException)。 如何更改 Firebase 配置中的 URL?这个 Firebase 配置在哪里? 我是编码新手,感谢支持。

我应该设法正确链接所有 Id 应用程序、Oauth 等(我希望如此),我相信问题是由 firebase db 的空 URL 引起的。

【问题讨论】:

    标签: firebase unity3d facebook-unity-sdk


    【解决方案1】:

    firebaser 在这里

    目前 Firebase 游戏 SDK 中有一个 bug,这要求在 google-services.json 和/或 google-services-info.plist 文件中指定 databaseURL 值。不幸的是,该密钥不再存在,除非您实际使用实时数据库。

    最简单的可能是:

    1. 在 Firebase 控制台中创建一个实时数据库实例。
    2. 下载更新的配置文件并再次将它们添加到您的项目中。

    更新:我刚刚发现 Github 上的 issue 也提到了 workaround 的问题。

    【讨论】:

      猜你喜欢
      • 2018-11-18
      • 1970-01-01
      • 2020-01-07
      • 2020-03-04
      • 1970-01-01
      • 2020-09-20
      • 2016-08-16
      相关资源
      最近更新 更多