Error when get token “The remote certificate is invalid according to the validation procedure”

三世轮回 提交于 2019-12-11 06:46:07

问题


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

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

The remote certificate is invalid according to the validation procedure. I am realy not sure how semple working fine, but my code does not.

This is code

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
   }

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.


回答1:


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.



来源:https://stackoverflow.com/questions/34942051/error-when-get-token-the-remote-certificate-is-invalid-according-to-the-validat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!