Example #1
0
        /// <summary>
        /// Direct authorization
        /// option
        /// {&Language=[LANGUAGE]}
        /// {&Nick=[NICK]}
        /// {&Timezone=[TIMEZONE]}
        /// { &Demo =[DEMO]}
        /// { &IsMobile =[ISMOBILE]}
        /// { &ExtParam =[EXTPARAM]}
        /// { &UserAutoCreate =[USERAUTOCREATE]}
        /// { &Currency =[CURRENCY]}
        /// { &Country =[COUNTRY]}
        /// </summary>
        /// <param name="login"></param>
        /// <param name="TID"></param>
        /// <param name="system"></param>
        /// <param name="pass"></param>
        /// <param name="page">mã page code</param>
        /// <param name="UserId">IP được uỷ quyền</param>
        /// <returns></returns>
        public async System.Threading.Tasks.Task <string> ApiDirect_AuthorizationAsync(string login, string TID, string system, string pass, string page, string UserIP)
        {
            string strMdD5 = hashMD5.Hash_Direct_Authorization(login, TID, pass, system);

            log.Info("DirectAuth-Long");
            log.Info("System/Api/" + API_KEY + "/User/DirectAuth/?&Login="******"&Password="******"&System=" + system +
                     "&TID=" + TID + "&Hash=" + strMdD5 + "&Page=" + page + "&UserIP=" + UserIP + "&Language=en&Country=VN&Currency=USD");
            using (var client = new HttpClient())
            {
                var b = "System/Api/" + API_KEY + "/User/DirectAuth/?&Login="******"&Password="******"&System=" + system +
                        "&TID=" + TID + "&Hash=" + strMdD5 + "&Page=" + page + "&UserIP=" + UserIP + "&Language=en&Country=VN&Currency=USD";
                client.BaseAddress = new Uri(URL_API_FUNDIST);
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "application/json");
                HttpResponseMessage response = (await client.PostAsync("System/Api/" + API_KEY + "/User/DirectAuth/?&Login="******"&Password="******"&System=" + system +
                                                                       "&TID=" + TID + "&Hash=" + strMdD5 + "&Page=" + page + "&UserIP=" + UserIP + "&Language=en&Timezone=+7&Country=VN&Currency=USD", null));//có thể option reason
                if (response.IsSuccessStatusCode)
                {
                    return(response.Content.ReadAsStringAsync().Result);
                }
                return(null);
            }
        }