I have set up authentication in Blazor using Microsoft Entra, and it works great. However, I need some more claims and have added three more in Entra:
But when I look at the users claims in the code, then they don't appear. I only get the 8 default claims. In my Program.cs I set authentication up like this:
builder.Services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme) .AddMicrosoftIdentityWebApp(options => { IConfigurationSection section = builder.Configuration.GetSection("AzureAd"); string? instance = section["Instance"]; ArgumentException.ThrowIfNullOrWhiteSpace(instance); options.Instance = instance; string? domain = section["Domain"]; ArgumentException.ThrowIfNullOrWhiteSpace(domain); options.Domain = domain; string? tenantId = section["TenantId"]; ArgumentException.ThrowIfNullOrWhiteSpace(tenantId); options.TenantId = tenantId; string? clientId = section["ClientId"]; ArgumentException.ThrowIfNullOrWhiteSpace(clientId); options.ClientId = clientId; string? callbackPath = section["CallbackPath"]; ArgumentException.ThrowIfNullOrWhiteSpace(callbackPath); options.CallbackPath = callbackPath; });I'm not very knowledgeable about authentication, but I think I'm supposed to supply scopes to my authentication, but I can find no way of doing this.
