Azure B2C Server Web Application

662 Views Asked by At

Working on a Razor Page web application and trying to let it authenticate users against Azure b2c. I have configured the following code.

builder.Services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
    .AddMicrosoftIdentityWebApp(builder.Configuration.GetSection("AzureAdB2C"));

builder.Services.AddAuthorization(options =>
{
    options.FallbackPolicy = options.DefaultPolicy;
});
builder.Services.AddRazorPages(options =>
{
    options.Conventions.AllowAnonymousToPage("/Index");
}).AddMicrosoftIdentityUI();

But I keep getting the error that the application is not configured for implicit flow.

Message contains error: 'unauthorized_client', error_description: 'AADB2C90057: The provided application is not configured to allow the 'OAuth' Implicit flow.

But when I configure it as a SPA application (see screenshot) it works. But a Razor Page Webapplication is not a SPA. What am I missing here? Is it still safe? When I use the following code it makes no difference :-(

 services.AddMicrosoftIdentityWebAppAuthentication(Configuration, Constants.AzureAdB2C);

enter image description here

1

There are 1 best solutions below

0
Tom Dev On

Within App Manifest:

"oauth2AllowImplicitFlow": true

registered app manifest