I have a hosted Blazor WebAssembly app secured with Azure AD B2C. I need to call GraphAPI from my app to get some custom user information. I used this article to set up the service, but it doesn't work. I get an error message when I try to access pages that need authentication or log in:
The message is kind of self explaining, but I don't understand how shall I do it.
Here I set AddMsalAuthentication
builder.Services.AddMsalAuthentication(options =>
{
builder.Configuration.Bind("AzureAdB2C", options.ProviderOptions.Authentication);
options.ProviderOptions.DefaultAccessTokenScopes.Add(
"https://xxx.onmicrosoft.com/xxxxxxx-a5f50ab3378d/API.Access");
options.ProviderOptions.LoginMode = "redirect";
});
and Microsoft Graph
builder.Services.AddGraphClient("https://graph.microsoft.com/User.Read");