Exemple #1
0
        private async void btnGenerateNewToken_Click(object sender, EventArgs e)
        {
            appGUID = Guid.Parse(txtAppID.Text);

            conf.URL      = txtURL.Text;
            conf.UserName = txtUser.Text;
            conf.Password = txtPassword.Text;
            conf.AppGUID  = txtAppID.Text;
            uow           = new UnitOfWork(conf);
            try
            {
                APIAppUserTokenResponseModels.GetNewToken resp = await uow.TokenService.GetNewToken();

                conf.URL      = txtURL.Text;
                conf.UserName = txtUser.Text;
                conf.Password = txtPassword.Text;
                conf.AppGUID  = txtAppID.Text;
                conf.Token    = resp.AppUserToken.Token.ToString();
                uow           = new UnitOfWork(conf);

                txtToken.Text = resp.AppUserToken.Token.ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #2
0
        public async Task <APIAppUserTokenResponseModels.GetNewToken> GetNewToken()
        {
            APIAppUserTokenRequestModels.GetNewToken model = new APIAppUserTokenRequestModels.GetNewToken();
            model.AppGuid  = Guid.Parse(hostconfig.AppGUID);
            model.UserName = hostconfig.UserName;
            model.Password = hostconfig.Password;
            string strResult = await HttpPost("api/apptokens/GetNewToken", JsonConvert.SerializeObject(model));

            APIAppUserTokenResponseModels.GetNewToken result = (APIAppUserTokenResponseModels.GetNewToken)JsonConvert.DeserializeObject(strResult, typeof(APIAppUserTokenResponseModels.GetNewToken));
            return(result);
        }