Web app throws exception during AuthN because it is interpreted as Confidential Client instead of Public Client

Thomas Woods 0 Reputation points
2025-03-06T09:13:22.9866667+00:00

Integrating my application with Azure AD B2C for AuthN/AuthZ. Simple configuration (Public Client). I get the Login page successfully. During authentication it throws an Exception:

MsalClientException: One client credential type required either: ClientSecret, Certificate, ClientAssertion or AppTokenProvider must be defined when creating a Confidential Client.

I never created it as a Confidential Client. I am adhering to the rules by Not providing ClientSecret or Certificate or any other information for it to deduce it is Confidential Client request. Here is my appsettings.json and my program.cs values. I have spent 2 WEEKS battling this and I simply do not understand why this is happening! (This is all test information)

"AzureAdB2C": {

"Instance": "https://LitCareDirectory.b2clogin.com/",

"Domain": "LitCareDirectory.onmicrosoft.com",

"ClientId": "a7c692f4-9581-4aa7-be02-6c486e4236a2",

"CallbackPath": "/signin-oidc",

"SignOutCallbackPath": "/signout-oidc",

"SignedOutCallbackPath": "/signout",

"SignUpSignInPolicyId": "B2C_1_SUSI",

"Scopes": "openid profile"
```  }

  
Usage of the settings:  
  
```aspx-csharp
.AddMicrosoftIdentityWebApp(options =>

{

    options.ResponseType = "code"; // Include id_token and token

    options.UsePkce = true;

    options.ClientId = builder.Configuration["AzureAdB2C:ClientId"];

    options.Authority = $"{builder.Configuration["AzureAdB2C:Instance"]}{builder.Configuration["AzureAdB2C:Domain"]}/{builder.Configuration["AzureAdB2C:SignUpSignInPolicyId"]}";

    options.SignOutScheme = OpenIdConnectDefaults.AuthenticationScheme;

    options.CallbackPath = builder.Configuration["AzureAdB2C:CallbackPath"];
```I am absolutely blocked and can't go any further. I have tried everything to make this exception go away. Killing me!
Microsoft Identity Manager
Microsoft Identity Manager
A family of Microsoft products that manage a user's digital identity using identity synchronization, certificate management, and user provisioning.
800 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.