// Commands // ======== public static async Task <YoungPerson> Login(string email, string password, string tempPassword = "") { //Set up the request var client = new RestClient(API.BaseURL + "Login.php"); var request = new RestRequest(Method.POST); request.AddHeader("Cache-Control", "no-cache"); request.AddHeader("Content-Type", "application/x-www-form-urlencoded"); request.AddParameter("email", email); request.AddParameter("password", password); if (tempPassword != "") { request.AddParameter("tempPassword", tempPassword); } //Get the data async IRestResponse response = await Task.Run(() => { return(client.Execute(request)); }); TokenRequest token = TokenRequest.FromJson(response.Content); //Log any errors for (int i = 0; i < token.Errors.Length; i++) { Debug.LogError(token.Errors[i]); } YoungPerson newYoungPerson = new YoungPerson { RawToken = token.Value, Token = Token.FromJWT(token.Value) }; await newYoungPerson.Update(); return(newYoungPerson); }