|
@@ -45,8 +45,12 @@ namespace Hotline.YbEnterprise.Sdk
|
|
|
}
|
|
|
var path = _config.AddressUrl + "platform/12345/selectEnterpriseList";
|
|
|
var rest = new RestRequest(path, Method.Post);
|
|
|
- rest.AddHeader("content-type", "application/json");
|
|
|
- rest.AddHeader("Blade-Auth", token.TokenType + " " + token.AccessToken);
|
|
|
+ //rest.AddHeader("content-type", "application/json");
|
|
|
+ //rest.AddHeader("Blade-Auth", token.TokenType + " " + token.AccessToken);
|
|
|
+ rest.AddHeaders(new[] {
|
|
|
+ new KeyValuePair<string, string>("content-type", "application/json"),
|
|
|
+ new KeyValuePair<string, string>("Blade-Auth", token.TokenType + " " + token.AccessToken)
|
|
|
+ });
|
|
|
var res = await ExecuteAsync<EnterpriseListRequest, EnterpriseListResponse>(path, Method.Post, request, rest, cancellationToken);
|
|
|
return res == null ? null : res.data;
|
|
|
}
|
|
@@ -66,10 +70,14 @@ namespace Hotline.YbEnterprise.Sdk
|
|
|
|
|
|
var path = _config.AddressUrl + "blade-auth/oauth/getAccessToken";
|
|
|
var rest = new RestRequest(path, Method.Post);
|
|
|
- rest.AddHeader("content-type", "application/json");
|
|
|
- rest.AddHeader("Authorization", "Basic " + authorization);
|
|
|
- rest.AddHeader("Tenant-Id", _config.TenantId);
|
|
|
- var res = await ExecuteAsync<string, EnterpriseServiceResponse>(path, Method.Post, "", rest, cancellationToken);
|
|
|
+ //rest.AddHeader("content-type", "application/json");
|
|
|
+ //rest.AddHeader("Authorization", "Basic " + authorization);
|
|
|
+ //rest.AddHeader("Tenant-Id", _config.TenantId);
|
|
|
+ rest.AddHeaders(new[] {
|
|
|
+ new KeyValuePair<string, string>("content-type", "application/json"),
|
|
|
+ new KeyValuePair<string, string>("Authorization", "Basic " + authorization),
|
|
|
+ new KeyValuePair<string, string>("Tenant-Id", _config.TenantId)});
|
|
|
+ var res = await ExecuteAsync<string, EnterpriseServiceResponse>(path, Method.Post, "", rest, cancellationToken);
|
|
|
|
|
|
if (res is null)
|
|
|
throw new UserFriendlyException("获取token请求失败 authorization:" + authorization + " ,path:" + path + " , res:" + res.ToString());
|