Sandsten
Sandsten

Reputation: 757

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 = "[email protected]";
    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

Upvotes: 4

Views: 1656

Answers (1)

Sezer Egrek
Sezer Egrek

Reputation: 76

Firebase Auth doesn't work on Unity Editor.

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

Upvotes: 6

Related Questions