5

It is strange that Firebase can't create user in Unity SDK out of the box. Firebase Console was tuned (anonymous access and email/password access are enabled) and google-service.json was placed in Assets folder of Unity.

However, Firebase still won't create a user. This is the code where it always fails:

auth.SignInAnonymouslyAsync().ContinueWith(task => {
            if (task.IsCompleted && !task.IsCanceled && !task.IsFaulted) {
                Debug.Log("User is now signed in.");
                FirebaseUser newUser = task.Result;
            }
            else if (task.IsFaulted || task.IsCanceled)
            {
                Debug.Log("User signup failed");
            }
        });

Why?

1 Answer 1

5

There are possible several reasons:

  • The app was run in the Editor, rather than on the device
  • The configuration file is not updated after you add Firebase Auth feature
  • The password is shorter than 6 chacters
  • The email address is in invalid form, e.g. abcdef@aaa

The first one is highly likely the reason why.

I have created a tutorial here, which covers the steps to create/login using firebase in Unity, hope this is helpful.

enter image description here

Sign up to request clarification or add additional context in comments.

1 Comment

SIR! I swear by the holy potato I am going to buy a cookie. The first one did was the problem . . . The google DOCZ is clearly shitty. (firebase.google.com/docs/unity/setup?authuser=0) The step 6 says Click Switch Platform to select Android as the target platform. Well, I did but it says NOWHERE it would not execute successfully in the Editor. I ran it like thousand times and thousand time I got the message the User was successfully created but I could never see it anywhere unless you as you mentioned to actually deploy on a Device... thanks google wasting 50+ hours

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.