/// <summary> /// 刷新token /// </summary> /// <returns></returns> public string refreshToken() { try { string txtPath = _hostingEnvironment.ContentRootPath + "/refreshToken.txt";; HttpRequestClient http = new HttpRequestClient(); http.SetField("client_id", ConfigExtensions.Configuration["ClientId"]); http.SetField("client_secret", ConfigExtensions.Configuration["ClientSecret"]); http.SetField("refresh_token", FileHelp.FileStream(txtPath)); http.SetField("grant_type", "refresh_token"); http.SetField("redirect_uri", ConfigExtensions.Configuration["Redirect_uri"]); ResponseToken token = http.HttpPost <ResponseToken>(ConfigExtensions.Configuration["RedirectTokenUrl"]); FileHelp.FileWriter(txtPath, token.refresh_token); return(token.access_token); } catch (Exception e) { _logger.LogError(e.Message); } return(null); }