Exemple #1
0
        public async Task <string> GetAllUserFromServer()
        {
            var response = await authorizeHelper.LoginToIds4Async(HttpContext, OauthMngModule.OauthClient);


            var apiurl = OauthMngModule.Configuration["OauthMngModule:ids4_api_url"];

            authorizeHelper.Client.SetBearerToken(OauthMngModule.OauthClient.AccessToken);//add bearer with access_token


            var resultjson = await authorizeHelper.Client.GetAsync(apiurl + "/api/Users");

            var allresoult = await resultjson.Content.ReadAsStringAsync();

            //string wherestring = ""; int pindex = 0; int pagesize = 10;
            //var query = OauthMngModule.DB.Client.Queryable<OauthUser>();
            //query.WhereIF(!string.IsNullOrEmpty(wherestring),
            //    it => it.Name.Contains(wherestring) || it.UserName.Contains(wherestring));
            var usertoken = allresoult.ToJsonToken()["users"];

            return(usertoken.ToString());
        }
        public async Task <object> Login(string userName, string password, string refreshToken)
        {
            var response = await authorizeHelper.LoginToIds4Async(HttpContext, userName, password, refreshToken);

            return(new { response });
        }