问题
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