Auth0 Home Blog Docs

How to change IssuerSigningKey after startup in asp.net core

hi,
I use this code at startup:

        services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
            .AddJwtBearer(options =>
            {
                options.TokenValidationParameters = new TokenValidationParameters
                {
                    ValidateIssuerSigningKey = true,
                    IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8
                        .GetBytes(Configuration.GetSection("AppSettings:Key").Value)),
                    ValidateIssuer = false,
                    ValidateAudience = false
                };
            });

and then I use Authorize Attribute to protect my controllers. is there any way to change the IssuerSigningKey later on after startup?

thanks

Hey there!

Sorry for such huge delay in response! We’re doing our best in providing you with best developer support experience out there, but sometimes our bandwidth is not enough comparing to the number of incoming questions.

Wanted to reach out to know if you still require further assistance?