private static async Task Login(string username, string password)
        {
            string json = LoginRequestData.CreateLoginRequestDataAsJson(username, password);
            string url  = Constants.REST_MULTIDIALOGO_STAGE_HOST + "/users/login";

            HttpResponseMessage response = await http.SendAsync(Utils.CreateRequest(url, null, Utils.CreateStringContent(json), "Post"));

            string responseContent = await response.Content.ReadAsStringAsync();

            AuthResponse authResponse = JsonConvert.DeserializeObject <AuthResponse>(responseContent);

            Console.WriteLine("Nuovo token ricevuto: " + authResponse.GetTokenResponse().Token);

            StoreTokens(authResponse);
        }
        private static async Task <HttpResponseMessage> LoginRefresh(string username)
        {
            string token = TokenWallet.GetCurrentTokens().RefreshToken;
            string json  = RefreshTokenRequest.CreateRefreshTokenRequestAsJson(username, token);
            string url   = Constants.REST_MULTIDIALOGO_STAGE_HOST + "/users/login/refresh";

            HttpResponseMessage res = await http.SendAsync(Utils.CreateRequest(url, token, Utils.CreateStringContent(json), "Post"));

            if (res.IsSuccessStatusCode)
            {
                string responseContent = await res.Content.ReadAsStringAsync();

                AuthResponse authResponse = JsonConvert.DeserializeObject <AuthResponse>(responseContent);
                Console.WriteLine("Refresh token ricevuto: " + authResponse.GetTokenResponse().RefreshToken);
                StoreTokens(authResponse);
            }
            return(res);
        }
 private static void StoreTokens(AuthResponse authResponse)
 {
     TokenWallet.WriteTokens(authResponse.GetTokenResponse());
 }