Sandsten Sandsten - 18 days ago 12
C# Question

Firebase Unity password authentication failed

The creation of a user with email and password fails and I can't find the source of the problem.

I'm using "Firebase Unity SDK" with the auth and database packages.

I followed this tutorial on the Firebase web page.

This is the C# code I use in my Unity project.

using UnityEngine;
using Firebase.Auth;

public class FirebaseAuthEmail : MonoBehaviour
{
public string email = "abc@gmail.com";
public string password = "abccbe123321";

void Start()
{
FirebaseAuth auth = FirebaseAuth.DefaultInstance;
auth.CreateUserWithEmailAndPasswordAsync(email, password).ContinueWith(
task => {
if (!task.IsCanceled && !task.IsFaulted)
{
// User created
Debug.Log("User created");
}
else
{
// User creation failed
Debug.Log("User creation failed");
}
if (task.IsCanceled) { Debug.Log("Task canceled"); }
if (task.IsFaulted) { Debug.Log("Task faulted"); }
});
}
}


When I press the play button i get "User creation failed" and "Task faulted".

I've successfully managed to add entries to the database but not to create an authenticated user.

And yes I've enabled Email/Password in the Firebase console.

Thanks in advance

Answer

Firebase Auth doesn't work on Unity Editor.

https://github.com/firebase/quickstart-unity/issues/3