/// <summary> /// Login user by their userUID. User must be stored locally /// </summary> /// <param name="userUID">Unique identifier for users</param> /// <returns>String displaying login info</returns> internal string Login_USERID(string userUID) { try { Logging_In?.Invoke("Login using a USER ID Invoked"); YUR_Log.Server_Log("Retrieving locally stored Refresh token"); var combine = Utilities.YUR_Conversions.PathCombine(Application.persistentDataPath, YUR_Constants.USERS_FILEPATH); var usersPath = Utilities.YUR_Conversions.PathCombine(combine, userUID + ".json"); YUR_Log.Log("User Found at: " + usersPath); var userRefresh = System.IO.File.ReadAllText(usersPath); YUR_Log.Log("File contents: " + userRefresh); YUR_CurrentUser.Local_User_Info_Reference tmp = new YUR_CurrentUser.Local_User_Info_Reference(); tmp = Utilities.YUR_Conversions.ConvertStringToObject <YUR_CurrentUser.Local_User_Info_Reference>(userRefresh); YUR_Log.Log("Refresh Token: " + tmp.refresh_token); YUR_Log.Server_Log("Refresh token acquired, passing to Native DLL"); StartCoroutine(Get_IDtoken(tmp.refresh_token)); } catch (System.Exception e) { YUR_Log.Error("Login with Refresh Token Error: " + e); } YUR_Log.Server_Log("Waiting for response from server"); return("Logging in User"); }
/// <summary> /// Login in User with Email and Password /// </summary> /// <param name="email"></param> /// <param name="password"></param> public void Login_Email_Password(string email, string password) { Logging_In?.Invoke(string.Empty); try { StartCoroutine(Acquire_Access_Tokens(email, password)); } catch (System.Exception e) { YUR_Log.Error(e.ToString()); } }
/// <summary> /// Used for Creating a new account. Creates an account and then signs the user in. /// </summary> /// <param name="email"></param> /// <param name="password"></param> /// <param name="displayName"></param> /// <returns></returns> private IEnumerator Create_New_Account_Email_Password(string email, string password, string displayName) { YUR_Log.Server_Log("Creating an account with Email and Password"); string response; yield return(response = Systems.Interops.User_AccountCreation.CreateAccount(email, password, displayName)); if (response.StartsWith("--1")) { Bad_Login?.Invoke("Account Creation Failed: " + response); yield break; } YUR_Log.Server_Log("Account creation was successful, waiting for profile to build"); yield return(new WaitForSeconds(3)); Logging_In?.Invoke("Attempting to Login to account"); yield return(StartCoroutine(Acquire_Access_Tokens(email, password))); yield break; }
/// <summary> /// Create an anonymous account. Name must be provided /// </summary> /// <param name="users_name"></param> internal void Create_Anonymous_Account(string users_name) { Logging_In?.Invoke(string.Empty); StartCoroutine(Acquire_Anonymous_Tokens(users_name)); }