Skip to content

Can't sign in due to exceptions #2

@max-arshinov

Description

@max-arshinov

I am starting Api.Swashbuckle.csproj.user

dotnet run
info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
      User profile is available. Using 'C:\Users\max\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
info: Microsoft.Hosting.Lifetime[0]
      Now listening on: https://localhost:5001
info: Microsoft.Hosting.Lifetime[0]
      Now listening on: http://localhost:5000
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
      Content root path: c:\work\IdentityServer4-Swagger-Integration\Api.Swashbuckle
info: Microsoft.Hosting.Lifetime[0]

Now, when I am trying to authorize using Swagger I am redirected to https://localhost:5000/connect/authorize?response_type=code&client_id=demo_api_swagger&redirect_uri=https%3A%2F%2Flocalhost%3A5001%2Fswagger%2Foauth2-redirect.html&scope=api1&state=VHVlIEp1bCAwNyAyMDIwIDEzOjUzOjI5IEdNVCswMzAwICjQnNC%2B0YHQutCy0LAsINGB0YLQsNC90LTQsNGA0YLQvdC%2B0LUg0LLRgNC10LzRjyk%3D&code_challenge=B_M2Xf-8ZUdugsHiXmHvgPj4Nz-uIlqQoVmWMg1BRMk&code_challenge_method=S256 where I am getting ERR_SSL_PROTOCOL_ERROR

I am not sure, but this might be related to the security definition. My app servers HTTP on localhost:5000 and HTTPS on localhost:5001 using dotnet run command.

               options.AddSecurityDefinition("oauth2", new OpenApiSecurityScheme
                {
                    Type = SecuritySchemeType.OAuth2,
                    Flows = new OpenApiOAuthFlows
                    {
                        AuthorizationCode = new OpenApiOAuthFlow
                        {
                            AuthorizationUrl = new Uri("https://localhost:5000/connect/authorize"),
                            TokenUrl = new Uri("https://localhost:5000/connect/token"),
                            Scopes = new Dictionary<string, string>
                            {
                                {"api1", "Demo API - full access"}
                            }
                        }
                    }
                });

I tried to use localhost:5001 in my security definition but in this case I am getting 404 error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions