3
Answers

JWT Authentication in Razor Pages .net core

Hi,
 
I am big fan of your. Love you site and content. I need your help, with one of my project.
Thank you very much for being so active for c# community.  
I have a website in Razor pages, but now i am planning to have a Web API also, so that i can use it as business layer/Data Layer for Mobile app and Blazor too.
 
Now, as per your post, i can implement an API with JWT Authentication and will be using Roles in it also. Now my concern is, how i can implement the JWT Authentication in Razor Pages. Like i will log into Razor pages app and will call Web API from razor pages and API will return a JWT Authentication token. I want to use that JWT in Razor Pages for authorization and want to use attribute [Authorize(Role = "role")] in razor pages. Is this possible, if yet can you please create a post on this.
 
Thanks,
Rupinder 
Answers (3)