I am trying to create an ASP.Net Core 3 webapp that uses Azure B2C for authentication. I created a WebApp using the template in Visual Studio and have configured the appsettings.json with appropriate values.
The app launches fine and when I click the Sign In button, I receive the following error:
However when I dotnet run
from Code, I can see the following:
Hosting environment = Development
which I think contradicts the error message.
When I click Sign In I can briefly see I am being redirected to AzureB2C which is sending me back.
How can I set Development mode to reveal more about the error here?
Edit:
Startup.cs
is not changed from the default using the WebApp template with B2C selected as auth.
public void ConfigureServices(IServiceCollection services)
{
services.AddAuthentication(AzureADB2CDefaults.AuthenticationScheme)
.AddAzureADB2C(options => Configuration.Bind("AzureAdB2C", options));
services.AddControllersWithViews();
services.AddRazorPages();
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
endpoints.MapRazorPages();
});
}