2

I have some microservices. One microservice which is IdentityServer runs over HTTPS, I also have a second microservice which is a protected API and it uses HTTP(I can’t change it)

This is protected API(Client credentials flow)

services.AddAuthentication(IdentityServerAuthenticationDefaults.AuthenticationScheme)
                .AddIdentityServerAuthentication(options =>
                {
                    options.Authority = "https://localhost:5001";
                    options.RequireHttpsMetadata = false;
                    options.ApiName = "NotifyAPI";
                    options.ApiSecret = "api_secret";
                });

It can't make a https request from http

Error connecting to https://localhost:5001/.well-known/openid-configuration. The SSL connection could not be established, see inner exception.

This method works, but I can't change HttpClientHandler in the Authentication configuration(Startup.cs)

using (var httpClientHandler = new HttpClientHandler())
            {

                httpClientHandler.ServerCertificateCustomValidationCallback = (message, cert, chain, errors) =>
                {
                    return true;
                };
                using (var client = new HttpClient(httpClientHandler))
                {

                    var response = await client.GetAsync("https://localhost:5001/.well-known/openid-configuration");
                    return response;

                }
            }
Am124
  • 21
  • 2
  • Does this answer your question? [Exception: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel](https://stackoverflow.com/questions/41519935/exception-the-underlying-connection-was-closed-could-not-establish-trust-relat) – Pablo Recalde Jun 05 '20 at 21:35
  • This was untrusted SSL problem – Am124 Sep 06 '20 at 11:28

0 Answers0