首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >.NET中缩放积分过程中发生的错误

.NET中缩放积分过程中发生的错误
EN

Stack Overflow用户
提问于 2022-01-12 07:11:48
回答 1查看 121关注 0票数 0
代码语言:javascript
复制
public void OAuthRedirect(string code)
{
    RestClient restClient = new RestClient();

    RestRequest request = new RestRequest(); 
    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

    request.AddParameter("grant_type", "authorization_code");
    request.AddParameter("code", code);
    request.AddParameter("redirect_uri", ConfigurationManager.AppSettings["RedirectUrl"]);
    request.AddHeader("Authorization", string.Format(AuthorizationHeader));

    restClient.BaseUrl = Convert.ToString(new Uri("https://zoom.us/oauth/token"));
    //restClient.BaseUrl = new Uri("https://zoom.us/oauth/token");

    var response = restClient.Post(request); 

    if (response.StatusCode == System.Net.HttpStatusCode.OK)
    {
        System.IO.File.WriteAllText(ConfigurationManager.AppSettings["TokenFilePath"], response.Content);
        var token = JObject.Parse(response.Content);
        this.GetUserDetails(token["access_token"].ToString());

        //return RedirectToAction("Index", "Home");
    } 
    //return View("Error");
}

当我试图使用这段代码创建一个令牌时,我会得到一个错误:

基础连接已关闭:发送

发生意外错误

EN

回答 1

Stack Overflow用户

发布于 2022-11-20 12:37:06

将以下内容添加到代码中:

代码语言:javascript
复制
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70677580

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档