Hi, From your code, I think you are looking for MVC front-end using HttpClient to access WebApi back-end with Azure B2C authentication. You could try following steps.
In Azure B2C, register a "webapi" application. expose the api with scope of "access_as_user" ,Note down the full scope string.

Create a webapi with "microsoft identity platfrom" template, fill the appsetting with the registered info
"AzureAd": {
"Instance": "https://login.microsoftonline.com/",
"Domain": "xxx.onmicrosoft.com",
"TenantId": "xxx",
"ClientId": "xxx",
"CallbackPath": "/signin-oidc"
}
Change the program.cs like following to add B2C audience:
builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
//.AddMicrosoftIdentityWebApi(builder.Configuration.GetSection("AzureAd"));
.AddMicrosoftIdentityWebApi(options =>
{
builder.Configuration.Bind("AzureAd", options);
// Additional options
options.TokenValidationParameters = new TokenValidationParameters
{
ValidAudience = "https://myb2ctest7.onmicrosoft.com/{clientId}"
};
}, options => { builder.Configuration.Bind("AzureAd", options); }
);
Next, register a MVC application in Azure B2C, find and add api permissions to the "access_as_user" we set up above.

Create a MVC with "microsoft identity platform" template and modify the appsettings, add the scopes with the scope string we note down above.
"AzureAd": {
"Instance": "https://login.microsoftonline.com/",
"Domain": "xxx.onmicrosoft.com",
"TenantId": "xxx",
"ClientId": "xxx",
"ClientSecret": "xxx",
"CallbackPath": "/signin-oidc",
"Scopes": "https://xxx.onmicrosoft.com/{webapi-clientID}/access_as_user"
},
Modify the program.cs like below
builder.Services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
.AddMicrosoftIdentityWebApp(builder.Configuration.GetSection("AzureAd"))
.EnableTokenAcquisitionToCallDownstreamApi()
.AddInMemoryTokenCaches();
Then in the MVC project you could access back-end api using following code.
string[] scopes = new string[] { "https://myb2ctest7.onmicrosoft.com/{webapi-clientID}/access_as_user" };
string accessToken = await _tokenAcquisition.GetAccessTokenForUserAsync(scopes);
_httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
var response = await _httpClient.GetAsync("https://localhost:7299/weatherforecast");
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.