0

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

Henkie85
  • 197
  • 2
  • 15
  • I am not great on authentication but our Razor web app registration has the Redirect uri's in the Web section where you don't have any and both Access Tokens and ID tokens selected under 'Implicit grant and hybrid flows' section. – Scott Mildenberger Apr 08 '22 at 12:58

1 Answers1

0

Within App Manifest:

"oauth2AllowImplicitFlow": true

registered app manifest

Maytham Fahmi
  • 31,138
  • 14
  • 118
  • 137
Tom Dev
  • 29
  • 2