Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

386
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!