Exemplo n.º 1
0
 public override string GetAccessToken(Dictionary<string, string> dic, HttpMethod.RequestMethod method)
 {
     string json = base.GetAccessToken(dic, method);
     return "";
     //JObject obj = JObject.Parse(json);
     //return obj["access_token"].ToString();
 }
Exemplo n.º 2
0
        /// <summary>
        /// 获取AccessToken
        /// </summary>
        /// <returns>返回请求结果JSON字符串,AccessToken需自行根据不同应用进行提取</returns>
        public virtual string GetAccessToken(Dictionary<string, string> dic, HttpMethod.RequestMethod method)
        {
            UriBuilder uri = new UriBuilder(AccessTokenRequestUrl);
            string queryString = Common.BuildQueryString(dic);
            uri.Query = queryString;
            string result = string.Empty;

            if (method == HttpMethod.RequestMethod.GET) //GET请求
            {
                HttpGet get = new HttpGet(uri.ToString());
                result = get.SendReqReturnResponseString();
            }
            else if (method == HttpMethod.RequestMethod.POST) //POST请求
            {
                HttpPost post = new HttpPost(AccessTokenRequestUrl, queryString);
                result = post.SendReqReturnResponseString();
            }
            return result;
        }