'IdentityServer 3 returns invalid_client when trying to authenticate with Blazor

I have an old IdentityServer 3 implementation and I'm trying not to change it to a newer version, I have been trying to authenticate a Blazor wasm application with it and so far almost everything went fine

Blazor Program.cs

...
builder.Services.AddOidcAuthentication(options =>
{
    builder.Configuration.Bind("Local", options.ProviderOptions);
});

Blazor appsettings.json

{
  "Local": {
    "Authority": "https://localhost:44343/",
    "ClientId": "clientid",
    "RedirectUri": "https://localhost:7170/authentication/login-callback",
    "PostLogoutRedirectUri": "https://localhost:7170/authentication/logout-callback",
    "ResponseType": "code"
  }
}

just for testing purposes I added a new in memory client in my identityserver

IdentityServer 3 Clients

new Client {
  ClientName = "client",
    ClientId = "clientid",
    Enabled = true,
    AccessTokenType = AccessTokenType.Reference,
    Flow = Flows.AuthorizationCodeWithProofKey,
    RequireConsent = false,
    ClientSecrets = new List < Secret > {
      new Secret("secret".Sha256())
    },
    // where to redirect to after login
    RedirectUris = {
      "https://localhost:7170/authentication/login-callback",
      "https://localhost:7170/connect/authorize/callback"
    },

    // where to redirect to after logout
    PostLogoutRedirectUris = {
      "https://localhost:7170/authentication/logout-callback"
    },
    AllowAccessToAllScopes = true,
    AllowedScopes = new List < string > {
      Constants.StandardScopes.OpenId,
      Constants.StandardScopes.Profile,
      Constants.StandardScopes.Email,
      Constants.StandardScopes.Roles,
      "Api"
    }
}

I tried both with

Flow = Flows.AuthorizationCodeWithProofKey

and

Flow = Flows.AuthorizationCode

the problem is that when I try and login everything works fine until a /connect/token request is issued to which the server responds with invalid_client

I might have a clue on why this is happening but so far nothing I tried has done anything

as far as I know IdentityServer 3 requires the client secret and I didn't find a way around this so I tried to set it on the appsettings with:

"ClientSecret" : "secret"

but nothing changes



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source