Firebase do not create user in Unity SDK

六月ゝ 毕业季﹏ 提交于 2019-12-10 13:56:18

问题


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:


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.



来源:https://stackoverflow.com/questions/41054554/firebase-do-not-create-user-in-unity-sdk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!