Azure B2C SSO for Hosted Wasm Blazor and Classical Web Application

125 views Asked by At

Is it possible to use SSO with B2C for following scenario?

  1. ASP.Net Core web app (Razor Pages) that authenticates user in a B2C tenant (local accounts). Using Microsoft.Identity.Web for simplicity:
services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
           .AddMicrosoftIdentityWebApp(Configuration.GetSection("web-AzureAdB2C"));
  1. Hosted Blazor (wasm), where the client authenticates against the same B2C tenant with:
builder.Services.AddMsalAuthentication(options =>
{
     builder.Configuration.Bind("app-AzureAdB2C", options.ProviderOptions.Authentication);
     options.ProviderOptions.DefaultAccessTokenScopes.Add("some-scope-for-server-api-access");
     options.ProviderOptions.LoginMode = "redirect";
});

Authentication works fine for both apps, but user has to login in both.

Both apps are using the same B2C User Flow. Simply enabling the SSO option in Azure Portal for the User Flow does not change anything, user still have to manually sign in in both apps.

I am not sure it can be done simply (implicit vs authorization flow), but I would appreciate any guidance. Many thanks.

0

There are 0 answers