|
@@ -44,8 +44,8 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop |
|
|
{ |
|
|
{ |
|
|
try |
|
|
try |
|
|
{ |
|
|
{ |
|
|
var refresh_token = _redis.Read<string>("refresh_token"); |
|
|
|
|
|
var access_token = _redis.Read<string>("access_token"); |
|
|
|
|
|
|
|
|
var refresh_token = _redis.Read<string>("refresh_token") == "null" ? "" : _redis.Read<string>("refresh_token"); |
|
|
|
|
|
var access_token = _redis.Read<string>("access_token") == "null" ? "" : _redis.Read<string>("access_token"); |
|
|
if (string.IsNullOrEmpty(refresh_token) || string.IsNullOrEmpty(_redis.Read<string>("access_token"))) |
|
|
if (string.IsNullOrEmpty(refresh_token) || string.IsNullOrEmpty(_redis.Read<string>("access_token"))) |
|
|
{ |
|
|
{ |
|
|
//用户授权 |
|
|
//用户授权 |
|
@@ -75,7 +75,7 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop |
|
|
private void login() |
|
|
private void login() |
|
|
{ |
|
|
{ |
|
|
var login_url = InsUrl + "/prod-api/api/web/collect/oauth2/login?grant_type=password&client_id=" + client_id + "&username=" + username + "&password=" + password; |
|
|
var login_url = InsUrl + "/prod-api/api/web/collect/oauth2/login?grant_type=password&client_id=" + client_id + "&username=" + username + "&password=" + password; |
|
|
var login_res_str = HttpMethods.Get(login_url); |
|
|
|
|
|
|
|
|
var login_res_str = HttpMethods.Post(login_url); |
|
|
var login_res = JsonConvert.DeserializeObject<InsResult>(login_res_str); |
|
|
var login_res = JsonConvert.DeserializeObject<InsResult>(login_res_str); |
|
|
var login_data = login_res.data; |
|
|
var login_data = login_res.data; |
|
|
string access_token = ((dynamic)login_data)?.access_token; |
|
|
string access_token = ((dynamic)login_data)?.access_token; |
|
@@ -95,7 +95,7 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop |
|
|
var refresh_url = |
|
|
var refresh_url = |
|
|
InsUrl + "/prod-api/api/web/collect/oauth2/refresh?grant_type=refresh_token&client_id=" + |
|
|
InsUrl + "/prod-api/api/web/collect/oauth2/refresh?grant_type=refresh_token&client_id=" + |
|
|
client_id + "&client_secret=" + client_secret + "&refresh_token=" + refresh_token; |
|
|
client_id + "&client_secret=" + client_secret + "&refresh_token=" + refresh_token; |
|
|
var refresh_res_str = HttpMethods.Get(refresh_url); |
|
|
|
|
|
|
|
|
var refresh_res_str = HttpMethods.Post(refresh_url); |
|
|
var refresh_res = JsonConvert.DeserializeObject<InsResult>(refresh_res_str); |
|
|
var refresh_res = JsonConvert.DeserializeObject<InsResult>(refresh_res_str); |
|
|
if (refresh_res == null || ((dynamic)refresh_res)?.code != 200) |
|
|
if (refresh_res == null || ((dynamic)refresh_res)?.code != 200) |
|
|
{ |
|
|
{ |
|
|