Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

How to retrieve optional claims when authenticating in Blazor App

$
0
0

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:

My optional claims

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.


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>