Ejemplo n.º 1
0
        /// <summary>
        /// 获取服务端的Token
        /// </summary>
        /// <param name="tokenData">Token数据</param>
        /// <returns>授权对象</returns>
        public static OpenApiResult <AccessGrant> GetToken(SimpleTokenData tokenData)
        {
            UpdateClient();
            var url = UriPathBuilder.Combine(OAuthService.OAuthServicePath, "token");

            var data = new NameValueCollection();

            tokenData.UpdateDatas(data);
            var innerResult = client.HttpPostForResult <AccessGrant.InnerAccessGrant>(url, data);

            var result = new OpenApiResult <AccessGrant>()
            {
                Code = innerResult.Code, Message = innerResult.Message
            };

            if (innerResult.Data != null)
            {
                result.Data = innerResult.Data.Convert();
            }
            return(result);
        }
Ejemplo n.º 2
0
 public async Task <string> ReadString(UriPathBuilder pathBuilder)
 {
     return(await ReadString(pathBuilder.Build()));
 }
Ejemplo n.º 3
0
 public async Task <T> Read <T>(UriPathBuilder pathBuilder)
 {
     return(await Read <T>(pathBuilder.Build()));
 }