Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

389
Vistas
Unity Firebase Authentication CreateUserWithEmailAndPasswordAsync returns empty UserID

When I run CreateUserWithEmailAndPasswordAsync() the task returns as IsCompleted and the FirebaseUser is also not null, but the UserID and email are null/empty. I can see the new user (with UserID) in the firebase console.

The same thing happens when trying to SignInWithEmailAndPasswordAsync() with the newly created User. But when I SignInWithEmailAndPasswordAsync() with an older user account everything works fine.

It's strange because it is the same code I used a year ago. In the mean time I did update the Firebase SDK to 7.0.2. Could that be the cause of the issue?

Here is my code for creating a new user:

public static async Task<CallbackMessage> RegisterNewUser(string email, string password)
        {
            CallbackMessage callback = new CallbackMessage();
            callback.isSuccess = false;

            if (!await DatabaseManager.CheckConnection())
            {
                callback.notConnected = true;
                return callback;
            }

            return await auth.CreateUserWithEmailAndPasswordAsync(email, password).ContinueWith(task =>
            {
                if (task.IsCanceled)
                {
                    callback.errorMessage = "Create User was canceled";
                }
                else if (task.IsFaulted)
                {
                    callback.errorMessage = GetErrorMessage(task.Exception);
                }
                else if (task.IsCompleted)
                {
                    FirebaseUser newUser = task.Result;
                    Debug.Log("User created succesfully! userID: " + newUser.UserId);
                    callback.userID = newUser.UserId;
                    callback.email = newUser.Email;
                    callback.isSuccess = true;
                }

                CleanTask(task);
                return callback;
            });
        }

Could really use a nudge in the right direction on this one :)

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

I was able to solve it. Apologies for doubting the Firebase Auth service.

In my AuthStateChanged code I added a Signout() whenever a user signed in, but wasn't emailVerified yet. That's where the problem was.

My guess what happened: When user creation is called it signs the user in immediately, then goes to Firebase to set things up there. In the mean time I sign out the user because it's not email verified. When the callback comes back it looks for the FirebaseUser that it signed in before going to Firebase, but finds nothing.

Something like pulling the chair from underneath someone as he's about to sit :P

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda