Exemplo n.º 1
0
		public IEnumerator LogIn(string user, string pw){
			string uid = "";
			firebase.AuthWithPassword(user,pw, (AuthData auth) => {
				Debug.Log("Auth ID: " + auth.Uid);
					uid = auth.Uid + "," + auth.Token + "," +auth.Expiration;
				}, (FirebaseError e) =>{
					uid = "";
				}
			);
			yield return uid;
		}
Exemplo n.º 2
0
	// Use this for initialization
	void Start () {
	    firebase = Firebase.CreateNew ("https://incandescent-torch-2575.firebaseio.com/testing");
		firebase.AuthWithPassword ("*****@*****.**", "password", (AuthData auth) => {
			Debug.Log ("auth success!!" + auth.Uid);
		}, (FirebaseError e) => {
			Debug.Log ("auth failure!!");
		});

		firebase.ChildAdded += (object sender, ChangedEventArgs e) => {
			Debug.Log ("Child added!");
		};

		firebase.ChildRemoved += (object sender, ChangedEventArgs e) => {
			Debug.Log ("Child removed!");
		};

		//firebase.SetValue ("working?");
	}
Exemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        firebase = Firebase.CreateNew("https://incandescent-torch-2575.firebaseio.com/testing");
        firebase.AuthWithPassword("*****@*****.**", "password", (AuthData auth) => {
            Debug.Log("auth success!!" + auth.Uid);
        }, (FirebaseError e) => {
            Debug.Log("auth failure!!");
        });

        firebase.ChildAdded += (object sender, ChangedEventArgs e) => {
            Debug.Log("Child added!");
        };

        firebase.ChildRemoved += (object sender, ChangedEventArgs e) => {
            Debug.Log("Child removed!");
        };

        //firebase.SetValue ("working?");
    }
Exemplo n.º 4
0
        public IEnumerator LogIn(string username, string password)
        {
            CoroutineWithData cd = new CoroutineWithData(this, GetUserByName(username));

            yield return(cd.coroutine);

            UserVO  user        = cd.result as UserVO;
            Session session     = new Session();
            bool    isDone      = false;
            float   elapsedTime = 0.0f;
            string  uid         = "";
            string  token       = "";

            firebase.AuthWithPassword(user.email, password, (AuthData auth) => {
                Debug.Log("Log In Success");
                uid    = auth.Uid;
                token  = auth.Token;
                isDone = true;
            }, (FirebaseError e) => {
                session = null;
                isDone  = true;
            }
                                      );
            while (!isDone)
            {
                elapsedTime += Time.deltaTime;
                if (elapsedTime >= 10.0f)
                {
                    break;
                }
                yield return(null);
            }
            if (isDone && string.IsNullOrEmpty(uid))
            {
                Debug.Log("error on login");
            }
            session.uid         = uid;
            session.token       = token;
            session.currentUser = user;
            Debug.Log("Session created with UID: " + session.uid);
            yield return(session);
        }