© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
1 reply
mobeid

❔ Assign Keycloak Roles to User Identity Roles in ASP.NET Core

I'm using OIDC to authenticate with keycloak and finally communicate with Azure.
I did the configuration in Program.cs (see image).

I tried to add the keycloak roles to User Identity roles by adding a new claim(ClaimsType.Role)
The problem is when I used the [Authorize(Roles = "admin")] for example it return Access Denied.

Any idea how to assign the keycloak roles to the Claim Identity Roles in ASP.NET Core ?

THank you
image.png
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

ASP.NET Core Identity - How to manage roles?
C#CC# / help
2y ago
ASP.NET Core Identity?
C#CC# / help
3y ago
How to assign roles to already created Users in ASP.NET Identity?
C#CC# / help
3y ago
ASP.NET Core auth + roles
C#CC# / help
3mo ago