C# unity中的Firebase身份验证登录始终返回新用户
我尝试使用身份验证登录Unity中的firebase用户帐户,但我的问题是,如果我使用了错误的信用或正确的登录信用(相同的结果),我会返回一个新用户(未验证电子邮件…)。是否有任何方法可以修复它,并获得正确的用户或无用户,如果用户不存在。下面的代码是我用于身份验证的所有代码。为了防止有人误解新用户,不会创建新用户。我获得的信息与新帐户的信息类似 我希望有人能帮助我。提前谢谢C# unity中的Firebase身份验证登录始终返回新用户,c#,firebase,unity3d,firebase-authentication,C#,Firebase,Unity3d,Firebase Authentication,我尝试使用身份验证登录Unity中的firebase用户帐户,但我的问题是,如果我使用了错误的信用或正确的登录信用(相同的结果),我会返回一个新用户(未验证电子邮件…)。是否有任何方法可以修复它,并获得正确的用户或无用户,如果用户不存在。下面的代码是我用于身份验证的所有代码。为了防止有人误解新用户,不会创建新用户。我获得的信息与新帐户的信息类似 我希望有人能帮助我。提前谢谢 using Firebase; using Firebase.Databa
using Firebase;
using Firebase.Database;
using Firebase.Unity.Editor;
using Firebase.Auth;
.
.
.
FirebaseApp app = FirebaseApp.DefaultInstance;
app.SetEditorDatabaseUrl("this is my database url");
if (app.Options.DatabaseUrl != null)
app.SetEditorDatabaseUrl(app.Options.DatabaseUrl);
Firebase.Auth.FirebaseAuth auth = FirebaseAuth.GetAuth(app);
auth.SignOut();//I don't know if this line is required, I just have it since I thought maybe the user is cached
auth.SignInWithEmailAndPasswordAsync("example@gmail.com", "any password").ContinueWith(task => {
if (task.IsCanceled)
{
Debug.LogError("Task was canceled.");
return;
}
if (task.IsFaulted)
{
Debug.LogError("Task encountered an error: " + task.Exception);
return;
}
if (task.IsCompleted)
{
//This case is true
Debug.Log("Task Completed");
}
Firebase.Auth.FirebaseUser newUser = task.Result;
Debug.LogFormat("User signed in successfully: {0} ({1})",
newUser.DisplayName, newUser.UserId);
Debug.Log(FirebaseApp.DefaultInstance.GetEditorAuthUserId());//This is always the email adress
Debug.Log(auth.CurrentUser.IsEmailVerified);//This is always false even if I use the correct password and email adress and verified it
});
确保您的google-services.json文件位于项目中。这就是我遇到的问题,从firebase控制台下载json文件后,问题得到了解决