private void AuthSuccessful() { Debug.Log("Auth Successful1"); Firebase.Auth.FirebaseUser user = auth.CurrentUser; user.TokenAsync(true).ContinueWith(task => { if (task.IsCanceled) { Debug.LogError("TokenAsync was canceled."); return; } if (task.IsFaulted) { Debug.LogError("TokenAsync encountered an error: " + task.Exception); return; } string idToken = task.Result; Debug.Log("User Token is :" + idToken); // Send token to your backend via HTTPS // ... }); Debug.Log("User TOoken Updated"); gameController.GetComponent <MainGameController>().ButtonGameControlPanel(); }
//sign in to the firebase instance so we can read some data //Coroutine Number 1 IEnumerator signInToFirebase() { auth = FirebaseAuth.DefaultInstance; //the outside task is a DIFFERENT NAME to the anonymous inner class Task signintask = auth.SignInWithEmailAndPasswordAsync(email, password).ContinueWithOnMainThread( signInTask => { if (signInTask.IsCanceled) { //write cancelled in the console Debug.Log("Cancelled!"); return; } if (signInTask.IsFaulted) { //write the actual exception in the console Debug.Log("Something went wrong!" + signInTask.Exception); return; } Firebase.Auth.FirebaseUser loggedInUser = signInTask.Result; Debug.Log("User " + loggedInUser.DisplayName + " has logged in!"); } ); signedin = true; yield return(new WaitUntil(() => signintask.IsCompleted)); Debug.Log("User has signed in"); }
void InitializeFirebase() { FirebaseApp.DefaultInstance.SetEditorDatabaseUrl("https://grapphia.firebaseio.com/"); reference = FirebaseDatabase.DefaultInstance.RootReference; auth = Firebase.Auth.FirebaseAuth.DefaultInstance; user_fb = auth.CurrentUser; }
IEnumerator HandleAuthCallback(Task <Firebase.Auth.FirebaseUser> task, string operation) { if (task.IsCanceled) { UpdateStatus("La création a été annulée."); } if (task.IsFaulted) { UpdateStatus("Oups une erreur est survenue : " + task.Exception); } if (task.IsCompleted) { // Firebase user has been created. Firebase.Auth.FirebaseUser newUser = task.Result; Debug.LogFormat("Tu es bien inscrit à Lémo {0}!", newUser.Email); if (operation == "sign_up") { Debug.Log("SIGN SIGN SIGN"); Reader reader = new Reader(newUser.Email, 0, 1); DatabaseManager.sharedInstance.CreateNewReader(reader, newUser.UserId); } UpdateStatus("On charge ton expérience"); yield return(new WaitForSeconds(1.5f)); SceneManager.LoadScene("Dashboard"); } }
public void GoogleJoin(string email, string password, string nickname) { _controller.OnProgressBar("회원가입 진행중.."); Debug.Log("google join start"); auth.CreateUserWithEmailAndPasswordAsync(email, password).ContinueWith(task => { if (task.IsCanceled) { Debug.LogError("CreateUserWithEmailAndPasswordAsync was canceled."); return; } if (task.IsFaulted) { //UIManager.Instance.OnWarningMsg(task.Exception.Message); Debug.LogError("CreateUserWithEmailAndPasswordAsync encountered an error: " + task.Exception); _controller.OffProgressBar(); _controller.OnWarningMsg(task.Exception.Message); _controller.OffJoinPage(); return; } // Firebase user has been created. newUser = task.Result; User user = new User(); user.nickname = nickname; user.email = email; user.isAlarmOn = true; SaveUserData(newUser.UserId, user); _controller.OffProgressBar(); _controller.OnWarningMsg("회원가입을 완료하였습니다."); _controller.OffJoinPage(); }); }
void TaskOnClick() { string email = usernameField.text; string password = passwordField.text; auth.SignInWithEmailAndPasswordAsync(email, password).ContinueWith(task => { if (task.IsCanceled) { Debug.LogError("SignInWithEmailAndPasswordAsync was canceled."); return; } if (task.IsFaulted) { Debug.LogError("SignInWithEmailAndPasswordAsync encountered an error: " + task.Exception); return; } Firebase.Auth.FirebaseUser newUser = task.Result; FireBaseAuthHandler.user = newUser; Debug.LogFormat("User signed in successfully: {0} ({1})", newUser.DisplayName, newUser.UserId); //GameObject.Find("InputField").GetComponent<InputField>().text = "Successful Login!"; /* TESTING ONLY */ //TestWriteToFirebase(); /* /TESTING ONLY */ // Start the main activity SceneManager.LoadScene(1); }); }
void Update() { Firebase.Auth.FirebaseUser user = auth.CurrentUser; if (user != null) { ChangeScene("Menu"); } }
void createUser(string email, string password, string name) { auth.CreateUserWithEmailAndPasswordAsync(email, password).ContinueWith(task => { if (task.IsCompleted) { Debug.Log("Complete"); } if (task.IsCanceled) { Debug.LogError("It was canceled"); return; } if (task.IsFaulted) { Debug.LogError("CreateUserWithEmailAndPasswordAsync encountered an error: " + task.Exception); return; } // Firebase user has been created. Debug.Log("新規作成前"); Firebase.Auth.FirebaseUser newUser = task.Result; Debug.Log("新規作成後"); // SetName Firebase.Auth.UserProfile profile = new Firebase.Auth.UserProfile { DisplayName = name, }; //PlayerPrefs.SetString Debug.LogFormat("Firebase user created successfully: {0} ({1})", newUser.DisplayName, newUser.UserId); if (newUser != null) { Debug.Log("名前を更新して遷移する"); newUser.UpdateUserProfileAsync(profile).ContinueWith(innerTask => { if (innerTask.IsCanceled) { Debug.LogError("UpdateUserProfileAsync was canceled."); return; } if (innerTask.IsFaulted) { Debug.LogError("UpdateUserProfileAsync encountered an error: " + innerTask.Exception); return; } Debug.Log("User profile updated successfully."); Debug.Log(newUser.DisplayName); isMove = true; }); } }); }
public void Register() { isNewUser = true; Debug.Log("enter register method"); username = GameObject.Find("UsernameInput").GetComponent <InputField>(); password = GameObject.Find("PasswordInput").GetComponent <InputField>(); repassword = GameObject.Find("RePassInput").GetComponent <InputField>(); if (password.text != repassword.text) { LoginRegisterFeedback.GetComponent <TextMeshProUGUI>().text = "passwords do not match"; LoginRegisterFeedback.SetActive(true); return; } auth.CreateUserWithEmailAndPasswordAsync(username.text, password.text).ContinueWith(task => { if (task.IsCanceled) { Debug.Log("CreateUserWithEmailAndPasswordAsync was canceled."); lastMessage = currentMessage; // currently only displays 1 exception // might need to append to string instead of replacing foreach (System.Exception exception in task.Exception.Flatten().InnerExceptions) { Firebase.FirebaseException firebaseEx = exception as Firebase.FirebaseException; if (firebaseEx != null) { currentMessage = firebaseEx.Message; AuthStateChanged(this, null); } } return; } if (task.IsFaulted) { Debug.Log("CreateUserWithEmailAndPasswordAsync encountered an error: " + task.Exception); lastMessage = currentMessage; // currently only displays 1 exception // might need to append to string instead of replacing foreach (System.Exception exception in task.Exception.Flatten().InnerExceptions) { Firebase.FirebaseException firebaseEx = exception as Firebase.FirebaseException; if (firebaseEx != null) { currentMessage = firebaseEx.Message; AuthStateChanged(this, null); } } return; } // Firebase user has been created. Firebase.Auth.FirebaseUser newUser = null; newUser = task.Result; Debug.LogFormat("Firebase user created successfully: {0} ({1})", newUser.DisplayName, newUser.UserId); }); }
//Handle when Google Sign In successfully void OnGoogleAuthenticationFinished(Task <GoogleSignInUser> task) { if (task.IsFaulted) { using (IEnumerator <System.Exception> enumerator = task.Exception.InnerExceptions.GetEnumerator()) { if (enumerator.MoveNext()) { GoogleSignIn.SignInException error = (GoogleSignIn.SignInException)enumerator.Current; UnityEngine.Debug.Log("Got Error: " + error); ErrorPanel.SetActive(true); // ErrorMessage.text = (string)error; } else { UnityEngine.Debug.Log("Got Unexpected Exception?!?"); } } } else if (task.IsCanceled) { UnityEngine.Debug.Log("Canceled"); } else { UnityEngine.Debug.Log("Google Sign-In successed"); UnityEngine.Debug.Log("IdToken: " + task.Result.IdToken); UnityEngine.Debug.Log("ImageUrl: " + task.Result.ImageUrl.AbsoluteUrlOrEmptyString()); UnityEngine.Debug.Log("Email: " + task.Result.Email); //Start Firebase Auth Firebase.Auth.Credential credential = Firebase.Auth.GoogleAuthProvider.GetCredential(task.Result.IdToken, null); auth.SignInWithCredentialAsync(credential).ContinueWith(t => { if (t.IsCanceled) { UnityEngine.Debug.Log("SignInWithCredentialAsync was canceled."); return; } if (t.IsFaulted) { UnityEngine.Debug.Log("SignInWithCredentialAsync encountered an error: " + t.Exception); return; } user = auth.CurrentUser; UnityEngine.Debug.Log("Email: " + user.Email); // SceneManager.LoadScene("Game", LoadSceneMode.Single); onLogedIn.SetActive(true); }); } }
private void SignOut() { auth.SignOut(); user = auth.CurrentUser; if (user == null) { Debug.Log("SignOut Ja"); SceneManager.LoadScene("LoginScene"); //SceneManager.LoadSceneAsync("LoginScene"); } }
void Start() { authReference = Firebase.Auth.FirebaseAuth.DefaultInstance; authUser = authReference.CurrentUser; if (authUser == null) { SceneManager.LoadScene("LoginScene"); } FirebaseApp.DefaultInstance.SetEditorDatabaseUrl("https://card-677f1.firebaseio.com/"); NextBtn.enabled = false; }
void HandleEmailSigninResult(Task <Firebase.Auth.FirebaseUser> authTask) { //Show off loading panel PanelLoading.SetActive(false); if (authTask.IsCanceled) { WriteLog("SigninAsync was canceled."); ShowPopup("Error Message", "SigninAsync was canceled.\n Please check log for more detail."); return; } if (authTask.IsFaulted) { WriteLog("SigninAsync encountered an error: " + authTask.Exception); ShowPopup("Error Message", "SigninAsync encountered an error.\n Please check log for more detail."); return; } PanelSignIn.SetActive(false); PanelSigned.SetActive(true); PlayerPrefs.SetInt(Utils.LOGGED, Utils.EM); PlayerPrefs.Save(); WriteLog("Email signin done."); if (toggleRememberMe.isOn) { PlayerPrefs.SetString("Email", txtSignInEmail.text); PlayerPrefs.SetString("Pwd", txtSignInPwd.text); PlayerPrefs.Save(); } user = auth.CurrentUser; if (user != null) { txtSignedUsername.text = String.Format("Welcome {0}!", user.DisplayName); WriteLog("User:"******"PhotoUrl:" + user.PhotoUrl.ToString()); if (!string.IsNullOrEmpty(user.PhotoUrl.ToString())) { StartCoroutine(LoadImage(user.PhotoUrl.ToString())); } } else { WriteLog("User is null."); } }
// TODO // ログインの後に,名前を変える処理を行う. // そのときに,値が変わったのを取れるかどうか void Start() { auth = Firebase.Auth.FirebaseAuth.DefaultInstance; user = auth.CurrentUser; FirebaseApp.DefaultInstance.SetEditorDatabaseUrl("https://hamukatsu2-9bebb.firebaseio.com/"); reference = FirebaseDatabase.DefaultInstance.RootReference; if (user == null) { Debug.Log("ログインしてない"); } }
void UpdateUserProfileAsync(string username) { if (auth.CurrentUser == null) { WriteLog("Not signed in, unable to update user profile"); return; } WriteLog("Updating user profile"); user = auth.CurrentUser; if (user != null) { Firebase.Auth.UserProfile profile = new Firebase.Auth.UserProfile { DisplayName = username, PhotoUrl = user.PhotoUrl, }; user.UpdateUserProfileAsync(profile).ContinueWith(task => { if (task.IsCanceled) { WriteLog("UpdateUserProfileAsync was canceled."); return; } if (task.IsFaulted) { WriteLog("UpdateUserProfileAsync encountered an error: " + task.Exception); return; } if (task.IsCompleted) { WriteLog("User profile updated completed"); } PlayerPrefs.SetInt(Utils.LOGGED, Utils.EM); PlayerPrefs.Save(); user = auth.CurrentUser; txtSignedUsername.text = String.Format("Welcome {0}!", user.DisplayName); //WriteLog("PhotoUrl:" + user.PhotoUrl.ToString()); //if (!string.IsNullOrEmpty(user.PhotoUrl.ToString())) //{ // StartCoroutine(LoadImage(user.PhotoUrl.ToString())); //} }); } }
void Start() { //auth関係初期設定 auth = Firebase.Auth.FirebaseAuth.DefaultInstance; loginUser = auth.CurrentUser; //database関係初期設定 FirebaseApp.DefaultInstance.SetEditorDatabaseUrl("https://hamukatsu3-aba8b.firebaseio.com/"); reference = FirebaseDatabase.DefaultInstance.RootReference; if (loginUser != null) { Debug.Log("ログイン出来てるんご"); } }
public void Login() { // retrieve username and password username = GameObject.Find("UsernameInput").GetComponent <InputField>(); password = GameObject.Find("PasswordInput").GetComponent <InputField>(); // attempt to login auth.SignInWithEmailAndPasswordAsync(username.text, password.text).ContinueWith(task => { if (task.IsCanceled) { Debug.Log("SignInWithEmailAndPasswordAsync was canceled."); lastMessage = currentMessage; // currently only displays 1 exception // might need to append to string instead of replacing foreach (System.Exception exception in task.Exception.Flatten().InnerExceptions) { Firebase.FirebaseException firebaseEx = exception as Firebase.FirebaseException; if (firebaseEx != null) { currentMessage = firebaseEx.Message; AuthStateChanged(this, null); } } return; } if (task.IsFaulted) { Debug.Log("SignInWithEmailAndPasswordAsync encountered an error: " + task.Exception.ToString()); lastMessage = currentMessage; // currently only displays 1 exception // might need to append to string instead of replacing foreach (System.Exception exception in task.Exception.Flatten().InnerExceptions) { Firebase.FirebaseException firebaseEx = exception as Firebase.FirebaseException; if (firebaseEx != null) { currentMessage = firebaseEx.Message; AuthStateChanged(this, null); } } return; } // successful login AuthStateChanged(this, null); user = task.Result; Debug.LogFormat("User signed in successfully."); }); }
private void GetSessionProfile() { Firebase.Auth.FirebaseUser user = auth.CurrentUser; if (user != null) { string name = user.DisplayName; string email = user.Email; System.Uri photo_url = user.PhotoUrl; // The user's Id, unique to the Firebase project. // Do NOT use this value to authenticate with your backend server, if you // have one; use User.TokenAsync() instead. string uid = user.UserId; } }
private void LoginwithEmail(string email, string password) { Firebase.Auth.FirebaseAuth auth = Firebase.Auth.FirebaseAuth.DefaultInstance; auth.SignInWithEmailAndPasswordAsync(email, password).ContinueWith(task => { if (task.IsCanceled) { PopupMsg.text = "Check your Email or Password"; PopupPanel.SetActive(true); Debug.LogError("SignInWithEmailAndPasswordAsync was canceled."); return; } if (task.IsFaulted) { PopupMsg.text = "Check your Email or Password"; PopupPanel.SetActive(true); Debug.LogError("SignInWithEmailAndPasswordAsync encountered an error: " + task.Exception); return; } Firebase.Auth.FirebaseUser newUser = task.Result; UserName = newUser.DisplayName; Debug.LogFormat("User signed in successfully: {0} ({1})", newUser.DisplayName, newUser.UserId); }); Firebase.Auth.FirebaseUser user = auth.CurrentUser; if (user != null) { user.SendEmailVerificationAsync().ContinueWith(task => { if (task.IsCanceled) { Debug.LogError("SendEmailVerificationAsync was canceled."); return; } if (task.IsFaulted) { Debug.LogError("SendEmailVerificationAsync encountered an error: " + task.Exception); return; } Debug.Log("Email sent successfully."); }); string myname = user.DisplayName; string myemail = user.Email; System.Uri myphoto_url = user.PhotoUrl; // The user's Id, unique to the Firebase project. // Do NOT use this value to authenticate with your backend server, if you // have one; use User.TokenAsync() instead. string uid = user.UserId; } }
// Start is called before the first frame update void Start() { authReference = Firebase.Auth.FirebaseAuth.DefaultInstance; authUser = authReference.CurrentUser; if (authUser == null) { SceneManager.LoadScene("LoginScene"); } storage = Firebase.Storage.FirebaseStorage.DefaultInstance; FirebaseApp.DefaultInstance.SetEditorDatabaseUrl("https://card-677f1.firebaseio.com/"); StartCoroutine(DownloadImage("https://firebasestorage.googleapis.com/v0/b/card-677f1.appspot.com/o/augment_images%2FyW3fKzIxNiMPZ3rYiJ11OB9ijBq1-M5a2g9pBdPVIsfftPGP?alt=media&token=6a146971-c671-4e73-81fa-606e18ba10ca")); IEnumerator DownloadImage(string MediaUrl) { UnityWebRequest request = UnityWebRequestTexture.GetTexture(MediaUrl); yield return(request.SendWebRequest()); if (request.isNetworkError || request.isHttpError) { Debug.Log(request.error); } else { image.texture = ((DownloadHandlerTexture)request.downloadHandler).texture; } } card_id = "-M5a2g9pBdPVIsfftPGP"; if (!string.IsNullOrEmpty(card_id)) { databaseReference = FirebaseDatabase.DefaultInstance.GetReferenceFromUrl("https://card-677f1.firebaseio.com/cards/" + card_id); databaseReference.GetValueAsync().ContinueWith(task => { if (task.IsFaulted) { // Handle the error... } else if (task.IsCompleted) { DataSnapshot snapshot = task.Result; print(snapshot.Child("photo").ToString()); } }); } }
public void SignInEmail() { Time.timeScale = 1.0f; auth.SignInWithEmailAndPasswordAsync(email.text, password.text).ContinueWith(task => { if (task.IsCanceled) { Debug.LogError("SignInWithEmailAndPasswordAsync was canceled."); return; } if (task.IsFaulted) { Debug.LogError("SignInWithEmailAndPasswordAsync encountered an error: " + task.Exception); return; } Firebase.Auth.FirebaseUser newUser = task.Result; Debug.LogFormat("User signed in successfully: {0} ({1})", newUser.DisplayName, newUser.UserId); Debug.Log("Working user registered"); Debug.Log("Patient UID in login scene " + newUser.UserId); userUID = newUser.UserId; FirebaseFirestore db = FirebaseFirestore.DefaultInstance; DocumentReference docRef = db.Collection("users").Document(userUID); docRef.GetSnapshotAsync().ContinueWithOnMainThread(task1 => { DocumentSnapshot snapshot = task1.Result; if (snapshot.Exists) { Debug.Log(string.Format("Document data for {0} document:", snapshot.Id)); Dictionary <string, object> user1 = snapshot.ToDictionary(); userName = user1["FirstName"].ToString(); Debug.Log("userName is " + userName); signin = true; } }); }); Debug.Log("user id is " + userUID); //signin = true; }
void LoginUser() { auth.SignInWithEmailAndPasswordAsync(email, password).ContinueWith(task => { if (task.IsCanceled) { Debug.LogError("SignInWithEmailAndPasswordAsync was canceled."); loginResult.text = "로그인 실패"; return; } if (task.IsFaulted) { Debug.LogError("SignInWithEmailAndPasswordAsync encountered an error: " + task.Exception); loginResult.text = "로그인 실패"; return; } Firebase.Auth.FirebaseUser newUser = task.Result; Debug.LogFormat("User signed in successfully: {0} ({1})", newUser.DisplayName, newUser.UserId); }); FirebaseUser user; void Awake() { auth = FirebaseAuth.DefaultInstance; auth.StateChanged += AuthStateChanged; AuthStateChanged(this, null); } void AuthStateChanged(object sender, System.EventArgs eventArgs) { if (auth.CurrentUser != user) { bool signedIn = user != auth.CurrentUser && auth.CurrentUser != null; if (!signedIn && user != null) { Debug.Log("Signed out " + user.UserId); } user = auth.CurrentUser; if (signedIn) { Debug.Log("Signed in " + user.UserId); loginResult.text = user.UserId + " 로그인 굿럭"; } } } }
/** * AuthStateChanged used for listening to user login and get that users ID to be later used * for finding the users favorites * **/ void AuthStateChanged(object sender, System.EventArgs eventArgs) { if (auth.CurrentUser != user) { bool signedIn = user != auth.CurrentUser && auth.CurrentUser != null; if (!signedIn && user != null) { Debug.Log("Signed out " + user.UserId); } user = auth.CurrentUser; if (signedIn) { } } }
// Track state changes of the auth object. void AuthStateChanged(object sender, System.EventArgs eventArgs) { if (auth.CurrentUser != user) { if (user == null && auth.CurrentUser != null) { Debug.Log("Signed in " + auth.CurrentUser.DisplayName); } else if (user != null && auth.CurrentUser == null) { Debug.Log("Signed out " + user.DisplayName); } user = auth.CurrentUser; } }
// Display a more detailed view of a FirebaseUser. void DisplayDetailedUserInfo(Firebase.Auth.FirebaseUser user, int indentLevel) { DisplayUserInfo(user, indentLevel); // StartCoroutine(writePlayer(user)); DebugLog(" Anonymous: " + user.IsAnonymous); DebugLog(" Email Verified: " + user.IsEmailVerified); /* var providerDataList = new List<Firebase.Auth.IUserInfo>(user.ProviderData); * if (providerDataList.Count > 0) { * DebugLog(" Provider Data:"); * foreach (var providerData in user.ProviderData) { * DisplayUserInfo(providerData, indentLevel + 1); * } * } */ }
IEnumerator HandleAuthCallback(Task <Firebase.Auth.FirebaseUser> task, string operation) { if (task.IsFaulted || task.IsCanceled) { } else if (task.IsCompleted) { Firebase.Auth.FirebaseUser newPlayer = task.Result; Debug.LogFormat("Welcome to HangGetHome {0}", newPlayer.Email); yield return(new WaitForSeconds(1.0f)); SceneManager.LoadScene("Start_Scene"); } }
private static void AuthCallback(ILoginResult result) { if (FB.IsLoggedIn) { // AccessToken class will have session details var aToken = Facebook.Unity.AccessToken.CurrentAccessToken; // Prints current access token's User ID Debug.Log("Access token: " + aToken.UserId.ToString()); // Print current access token's granted permissions foreach (string perm in aToken.Permissions) { Debug.Log(perm); //Debug.Log("Access Token String: " + aToken.TokenString); } Firebase.Auth.Credential credential = Firebase.Auth.FacebookAuthProvider.GetCredential(aToken.TokenString); FirebaseAuth.DefaultInstance.SignInWithCredentialAsync(credential).ContinueWith(task => { if (task.IsCanceled) { Debug.Log("Facebook Login Canceled ... "); ViewMessageOnScreen("Facebook Login Canceled ... "); return; } if (task.IsFaulted) { Debug.Log("Facebook Login error: " + task.Exception); ViewMessageOnScreen("Facebook Login error: " + task.Exception); return; } Debug.Log("Signed In Successfully ... "); Firebase.Auth.FirebaseUser newUser = task.Result; Debug.Log("Welcome: " + newUser.DisplayName); Debug.Log("Email: " + newUser.Email); Globals.username = newUser.DisplayName.ToString(); Globals.email = newUser.DisplayName.ToString(); Globals.userId = newUser.UserId.ToString(); loadDashboard = true; Globals.isLoggedIn = true; Globals.loggedInWithFaceBook = true; }); } else { Debug.Log("User cancelled login ... "); ViewMessageOnScreen("User Canceled Login ... "); } }
public Task <FirebaseUser> SignInUserWithFacebook(string accessToken) { Credential credential = FacebookAuthProvider.GetCredential(accessToken); if (auth.CurrentUser != null) { Task <FirebaseUser> task = auth.CurrentUser.LinkWithCredentialAsync(credential); task.ContinueWith(t => { if (t.IsCanceled) { Debug.Log("LinkWithCredentialAsync was canceled."); } if (t.IsFaulted) { Debug.Log("LinkWithCredentialAsync encountered an error: " + t.Exception); } Firebase.Auth.FirebaseUser newUser = t.Result; Debug.LogFormat("Credentials successfully linked to Firebase user: {0} ({1})", newUser.DisplayName, newUser.UserId); }); return(task); } else { Task <FirebaseUser> task = auth.SignInWithCredentialAsync(credential); task.ContinueWith(t => { if (t.IsCanceled) { Debug.Log("SignInWithCredentialAsync was canceled."); return; } if (t.IsFaulted) { Debug.Log("SignInWithCredentialAsync encountered an error: " + task.Exception); return; } Firebase.Auth.FirebaseUser newUser = t.Result; Debug.LogFormat("User signed in successfully: {0} ({1})", newUser.DisplayName, newUser.UserId); }); return(task); } }
// Track state changes of the auth object. void AuthStateChanged(object sender, System.EventArgs eventArgs) { if (auth.CurrentUser != firebUser) { bool signedIn = firebUser != auth.CurrentUser && auth.CurrentUser != null; if (!signedIn && firebUser != null) { Debug.Log("Signed out plankgame" + firebUser.UserId); } firebUser = auth.CurrentUser; if (signedIn) { Debug.Log("Signed in plankgame " + firebUser.UserId); } } }
void AuthStateChanged(object sender, System.EventArgs eventArgs) { if (auth.CurrentUser != user) { bool signedIn = user != auth.CurrentUser && auth.CurrentUser != null; if (!signedIn && user != null) { console.text = "Signed out " + user.UserId; } user = auth.CurrentUser; if (signedIn) { console.text = "Signed in " + user.UserId; } } }