How to consume/generate JWT Token in ASP.net 6 web application MVC without API

Viewed 195

I want to implement the Jwt Token in the Asp.net Core 6 web application MVC without using web API. I read so many posts where they are referencing the API only.

And apart from that can we use cookies authentication in our Production environment?

1 Answers

I want to implement the Jwt Token in the Asp.net Core 6 web application MVC without using web API. I read so many posts where they are referencing the API only.

To consume/generate JWT Token in ASP.net 6 web application MVC, it is similar like in the Web API application, you could create an MVC controller action method, and receive the Login user, then verify the user and call the generate JWT token method to generate the token. After that, you can add the token at the request header and access the protected data.

Refer the following articles and change the API controller to MVC controller:

https://www.c-sharpcorner.com/article/jwt-json-web-token-authentication-in-asp-net-core/

ASP.NET Core JWT Authentication and Authorization of Web API [Detailed]

Apart from that can we use cookies authentication in our Production environment?

Yes, you can use it.

Related