Adding Identity Roles To Identity Server 4 in .NET Core 3.1


So where do we start?

Fig. 1: install identity server 4 templates
Fig. 2: create a project using IS4 template for ASP.NET Identity
Fig. 3: add client to list of authorization server clients
Fig.4: add roles to seed data
Fig. 5: add alice to member role
Fig. 6: add bob to admin role
Fig. 7: implement add role to claim
Fig. 8: full source for profile service
Fig. 9: add profile service to startup
Fig. 10: resulting JWT claims

(Optional) Connecting to MVC ASP.NET Core projects

Fig. 11: add additional options to AddOpenIdConnect method
Fig. 12: add authorize attribute to controller


Software Engineer. View my other articles at and also guys listen to my podcast about life at

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store