0

I'm running a Skoruba IdentityServer4 project `https://github.com/skoruba/IdentityServer4.Admin

Microsoft Visual Studio Community 2022 (64-bit) - Current Version 17.2.2

The project was working fine, but after disabling/enabling SSL im getting This site can’t provide a secure connection localhost sent an invalid response in chrome

When running Skoruba.IdentityServer4.Admin

Note: in Firefox I get An error occurred during a connection to localhost:44303. SSL received a record that exceeded the maximum permissible length.

I checked all my certificate definition according to: Enable SSL in Visual Studio and it seems OK

But since the menus in this version of Visual Studio have completely changed I couldn't follow any of the instruction I found on the WEB

EDIT: I found in https://serverfault.com/questions/379772/how-do-i-resolve-the-error-ssl-received-a-record-that-exceeded-the-maximum-perm:`That usually means that you are sending a HTTPS request to a HTTP service`

So I tried to search & replace the port from 44303 to 44304 and the ssl is working but I get a new error:

enter image description here

Sorry, there was an error : invalid_request Invalid redirect_uri

Elia Weiss
  • 8,324
  • 13
  • 70
  • 110

1 Answers1

0

Here is the correct definitions that solves the problem for me:

{
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:44301",
      "sslPort": 44304
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },
    "Skoruba.IdentityServer4.Admin": {
      "commandName": "Project",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      },
      "applicationUrl": "http://localhost:44301;https://localhost:44304"
    }
  }
}

The strange thing is that on one of my working station the port 44303 is working, and on the other it is gone for good, even after reset I get The connection to localhost was interrupted. Error code: ERR_CONNECTION_RESET

So I just had to change the port to 44304

But then I got the Invalid redirect_uri

I found that on one of my working station the VS generate a log under each project Log folder and there I saw:

2022-05-28 10:28:33.864 +03:00 [ERR] Invalid redirect_uri: http://localhost/api/swagger/oauth2-redirect.html

{"ClientId":"skoruba_identity_admin_api_swaggerui", "ClientName":"skoruba_identity_admin_api_swaggerui", "RedirectUri":null, "AllowedRedirectUris":["https://localhost/api/swagger/oauth2-redirect.html"],

Notice that the url doesn't start with https This can be solved directly in the DB:

enter image description here

Or in the Admin: Clients > skoruba_identity_admin_api_swaggerui > Basic

Save Client at the buttom

enter image description here

Elia Weiss
  • 8,324
  • 13
  • 70
  • 110