Web API in .Net 6.0 with Auth0 with Roles and Permissions

Jay (Vijayasimha BR)
3 min readApr 21, 2022

--

absolutely in love with this image.

This week, I was tutoring a student client of mine. We have been working our way through using Auth0. It occurred to me that, all my clients have now migrated to .Net 6.0.

However, my demo project,

is currently running off .Net 5.0. I am working on a upgrade, but the project is massive, and that will take a lot of time.

So, I needed to have a ready to use demo for my .Net 6.0 related tutoring. So, I decided to build it. As usual, you can find the code here.

Here are the key steps, with some screenshots to boot.

create a new project. I am assuming that you have been creating new projects for some time now.
always ensure that the default swagger with weather forecast is running just fine.
setup your auth0 tenant. There is no Asia or India option yet.
setup your API. Yes, Ameesha Patel is the hottest actress in the world.
create your permissions.
build your roles. mixing and matching the permissions you want.
at least two roles. I mean, testing stuff right?
RBAC must be enabled. Or, scopes wont be included in your token.

Once that is done, you have to get the main stuff included in your code.

Look at the full code, here. I have included only the main things above.

That’s all there is to it.

I work as a full time freelance coding tutor. Hire me at UpWork or Fiverr or Stack Overflow. My personal website is here. Find more of my art at Behance and Unsplash. Also, I have a Podcast about everyday life. And, a 2nd Podcast, where I talk about freelancing.

--

--

No responses yet