示例#1
0
        static void SystemLogin(ref IUserManage userManage)
        {
            //登录获取Token
            Console.WriteLine("用户名:ggg");
            var userName = "******";

            Console.WriteLine("密码:222222");
            var password = "******";

            var result = userManage.Login(userName, password).GetAwaiter().GetResult();

            Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(result));
            //初始化通用接口
            userManage = RestService.For <IUserManage>(new HttpClient(new AuthenticatedHttpClientHandler(result.access_token))
            {
                BaseAddress = new Uri("http://localhost:5000")
            });
        }