Trying to connect to my Azure B2C to have clients access an app. With very little luck. I'm new on Azure so I might have made some very basic error.
The error "IDX20803: Unable to obtain configuration from: 'System.String'" I get when I click the "Login" link in a blazor server app. I'm just trying to get this to work in a basic app, then I'll transfer the bits that deals with auth to my real app.
Startup.cs:
public IConfiguration Configuration { get; }
public void ConfigureServices(IServiceCollection services) {
services.AddRazorPages();
services.AddServerSideBlazor();
services.AddScoped<AuthenticationStateProvider, RevalidatingIdentityAuthenticationStateProvider<IdentityUser>>();
services.AddSingleton<WeatherForecastService>();
services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
.AddMicrosoftIdentityWebApp(Configuration.GetSection("AzureAdB2C"));
services.AddControllersWithViews()
.AddMicrosoftIdentityUI();
services.AddAuthorization(options =>
{
});
services.AddServerSideBlazor()
.AddMicrosoftIdentityConsentHandler();
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) {
if(env.IsDevelopment()) {
app.UseDeveloperExceptionPage();
} else {
app.UseExceptionHandler("/Error");
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.UseEndpoints(endpoints => {
endpoints.MapBlazorHub();
endpoints.MapFallbackToPage("/_Host");
endpoints.MapControllers();
});
}
appsettings.json
"AzureAdB2C": {
"Instance": "https://*****.b2clogin.com/",
"ClientId": "11111-965c-40c5-8dda-9315638fbda3",
"CallbackPath": "/signin-oidc",
"Domain": "*****.b2clogin.com",
"SignedOutCallbackPath": "/signout-callback-oidc",
"SignUpSignInPolicyId": "B2C_1_SignupAndSignin",
"ClientSecret": "11111-0f01-49f7-827a-bff6522bc1e6"
}
These are the redirect URL:s from the app:
https://localhost:44340/
https://localhost:44340/MicrosoftIdentity/Account/SignIn
https://*****.azurewebsites.net/MicrosoftIdentity/Account/SignIn
https://*****.azurewebsites.net/
Anyone know what I'm doing wrong?
Cheers!