0

I created a project Blazor Webassembly with Authentification type : Individual accounts. The framework use IdentityServer by Duende.(I have a community licence)

The app works fine in my local environment but when I deploy the app in production it doesn't work. I have an error 500.

Error in the log :

fail: Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler[3]
      Exception occurred while processing message.
      System.NullReferenceException: Object reference not set to an instance of an object.
         at Microsoft.AspNetCore.ApiAuthorization.IdentityServer.IdentityServerJwtBearerOptionsConfiguration.ResolveAuthorityAndKeysAsync(MessageReceivedContext messageReceivedContext)
         at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.HandleAuthenticateAsync()

The app is host in docker with proxy reverse (provider by Caddy)

I tried to add ForwardedHearders whitout success :

builder.Services.Configure<ForwardedHeadersOptions>(options =>
{
    options.ForwardedHeaders =
        ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
});

1 Answers1

0

You need to have a key in your appsettings.json. You probably have the following in your appsettings.development.json:

"IdentityServer": {
"Key": {
  "Type": "Development"
}  
Foitn
  • 604
  • 6
  • 25