ASP.NET CORE : how to set clientid, authority and client-secret at runtime

Hi

I want to enable multi-tenant authentication in Auth0 for which i dont want to pass the domain & client id

and need to provide them at runtime.

services
.AddAuth0WebAppAuthentication(options => {
options.Domain = Configuration[“Auth0:Domain”]; //I dont want to provide at compile time
options.ClientId = Configuration[“Auth0:ClientId”]; /I dont want to provide at compile time
});

If i invoke

HttpContext.ChallengeAsync(Auth0Constants.AuthenticationScheme, authenticationProperties);

routing is not working and is throwing error.

Is there a way where we can set the domain(Authority) and ClientId at runtime ?

thanks

2 Likes