Exemple #1
0
    public static void LoginAnonymous()
    {
        var payLoad = $"{{\"returnSecureToken\":true}}";

        RestClient.Post($"{baseAuthUrl}signUp?key={API_KEY}", payLoad).Then(response =>
        {
            Debug.Log("Se inicio sesion en Firebase Auth anonimamnete");


            FirebaseSignupResponse fbResponse = JsonUtility.FromJson <FirebaseSignupResponse>(response.Text);
            PlayerPrefs.SetString("User UID", fbResponse.localId);
            Debug.Log("Se guardo la sesion del usuario en PlayerPrefs");
            SceneManager.LoadScene("Launcher");
        }
                                                                            ).Catch(err =>
        {
            var error = err as RequestException;
            GameManager.Instance.CreateMessageDialog("Error", error.Response);
        });
    }
Exemple #2
0
    public static void CreateUser(User user, string password)
    {
        var payLoad = $"{{\"email\":\"{user.email}\",\"password\":\"{password}\",\"returnSecureToken\":true}}";

        RestClient.Post($"{baseAuthUrl}signUp?key={API_KEY}", payLoad).Then(response =>
        {
            Debug.Log("Se creo el usuario en Firebase Auth");
            Debug.Log(response.Text);

            FirebaseSignupResponse fbResponse = JsonUtility.FromJson <FirebaseSignupResponse>(response.Text);

            Debug.Log(fbResponse);

            CreateUserProfile(user, fbResponse.localId);
        }
                                                                            ).Catch(err =>
        {
            var error = err as RequestException;
            GameManager.Instance.CreateMessageDialog("Error", error.Response);
        });
    }