本文介绍了当获得令牌“根据验证过程,远程证书无效"时,将发生错误.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有很多类似的主题都存在相同的问题,但是与我在Identity Server上的问题无关.可能仍然无法理解这一点.我正在尝试通过重新创建此示例

There are many similar topics with same issue, but nothing relevant to my issue on Identity server.Probably am still failing to understand this.I am trying to implement identity server authentication by recreating this sample

示例GetToken()方法工作正常,但是当我在应用程序中调用GetToken()方法时出现错误

Sample GetToken() method is working fine, but when I call GetToken() method in my application I get error

这是代码

public async Task<ActionResult> GetToken()
{
    var client = new TokenClient(
        "https://localhost:44331/connect/authorize",
        "codeclient",
        "secret");

    var code = Request.QueryString["code"];
    var tempState = await GetTempStateAsync();
    Request.GetOwinContext().Authentication.SignOut("TempState");

    var response = await client.RequestAuthorizationCodeAsync(
        code,
        "http://localhost/UniSrv.Client.Web/callback"
            );

    //... more code
   }

它在RequestAuthorizationCodeAsync上中断.我在同一服务器主机应用程序上使用与示例应用相同的证书.我需要客户证明吗?如果是,为什么不使用示例应用程序就不这样做呢?感谢您帮助解决此问题.

It breaks on RequestAuthorizationCodeAsync.I am using same certificate as sample aplication on identiy server host app.Do I need certificate on client? If yes, why than sample application working without that?Thank for help to resolve this issue.

推荐答案

似乎SSL证书验证失败.尝试在回调端点上使用HTTPS.注意:使用OAuth/OpenId连接令牌时,必须启用https传输安全性.

It looks like SSL Certificate validation failed. Try Using HTTPS on the callback endpoint.Note: https transport security must be enabled when OAuth/OpenId connect tokens are used.

这篇关于当获得令牌“根据验证过程,远程证书无效"时,将发生错误.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 06:02