Abhishek
Abhishek

Reputation: 41

Unable to retrieve document from: 'https://localhost:5005/.well-known/openid-configuration' on dockerising the project

I have created a microservice on .Net Core 3.1. I have used Identityserver4 as IDPClient. The project is working fine locally. After dockerising the project(Docker-compose), and calling the Identityserver from MVC Client application it is throwing Unable to retrieve document from: 'https://localhost:5005/.well-known/openid-configuration'

MVC Application Startup code

 services.AddAuthentication(options =>
        {
            options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
            options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
        })
            .AddCookie(CookieAuthenticationDefaults.AuthenticationScheme)
            .AddOpenIdConnect(OpenIdConnectDefaults.AuthenticationScheme, options =>
            {
                options.Authority = "https://localhost:5005/";
                options.ClientId = "taxationclient_presentation";
                options.ClientSecret = "secret";
                options.ResponseType = "code";
                options.Scope.Add("openid");
                options.Scope.Add("profile");
                options.SaveTokens = true;
                options.GetClaimsFromUserInfoEndpoint = true;
            });
            

Upvotes: 0

Views: 88

Answers (1)

Tore Nestenius
Tore Nestenius

Reputation: 19961

For it to work, you first need to make sure that there is a valid HTTPS TLS certificate for Localhost inside the container. Second, are you sure the application is actually listening on port 5001 or is it 443? You usually have 5001 locally in visual studio, but in production it changes to port 443.

I also blogged in depth how to do it here: IdentityServer in Docker Containers – Part 1.

Upvotes: 0

Related Questions