.NET 7 Web API π JWT Authentication and role-based Authorization
#aspdotnetcore #dotnet #jwt
A step-by-step guide to user authentication using ASP.NET Core 7, Identity, MSSQL
Create a minimal API project in Visual Studio 2022.
π» GitHub: https://github.com/shahedbd/API.UserManagement
π Table of Contents:
β
1. Create Project: Using Visual Studio 2022
β API Project, Dotnet 7.0, and a class library project for data connectivity and migration
β
2. Install the Required Packages
dotnet add package Microsoft.AspNetCore.Authentication.JwtBearer βversion 7.0.4
dotnet add package Microsoft.AspNetCore.Identity.EntityFrameworkCore βversion 7.0.4
dotnet add package Microsoft.EntityFrameworkCore.SqlServer βversion 7.0.4
dotnet add package Microsoft.EntityFrameworkCore.Tools βversion 7.0.4
β
3. Database connection: MSSQL: appsettings.json
β
4. Create models and complete ApplicationDbContext class
β
5. Update program.cs: AddDbContext
β
6. Database Migration
dotnet ef migrations add InitialCreate
dotnet ef database update
β using PMC
PM: add-migration initcreate
PM: update-database
β
7. Create Auth Controller
β
8. Crete Auth Service
β
9. Test API using postman
β
10. Deploy to IIS
β
11. Test API from IIS hosting
π Main Profile:
https://1.envato.market/7mA73y
β
Business ERP Solution/Product/POS/Company Management:
https://1.envato.market/AoMzyj
β
School/College/University Management ERP:
https://1.envato.market/15NBrd
β
Dashboard Template | ASP.NET Core MVC Web Starter Kit
https://1.envato.market/JrEGWa
β
Advance POS System with Stock Manager | ASP.NET Core | EF Core | .NET Core 6.0:
https://1.envato.market/9WQxbW
β
Asset Management System with Barcode | ASP.NET Core | EF Core | .NET Core 6.0:
https://1.envato.market/qnNkey
β
Advanced Files & Users Management | ASP.NET Core | EF Core | .NET Core | MSSQL | MySQL:
https://1.envato.market/DVaRBq
β
Hospital and Pharmacy Management System | ASP.NET Core | EF Core:
https://1.envato.market/OR5o6N
β
Inventory and User Management System:
https://1.envato.market/jW221P
β
Invoice Gen(Invoice Generation and Management) using .Net Core and EF:
https://1.envato.market/0JOOm3
β
Complaint | Issue | Helpdesk Ticket | My Ticket HelpDesk Support System | ASP.NET Core | EF Core:
https://1.envato.market/MXjj5P
β
User Management:
https://1.envato.market/WDE2JO
β
ASP.NET Core CRUD Operation Using Dot Net 6.0 | MVC| MSSQL | MySQL | EF Core Code First | jQuery
https://1.envato.market/b3Yeg9
β
ASP.NET Core full CRUD with .NET 5 | MSSQL/MySQL | EF code first:
https://1.envato.market/OR551W
β
Staff | Employee Leave Management System
https://1.envato.market/rnjYzd
β
Library Management System | ASP.NET Core | MSSQL | Code First
https://1.envato.market/YgWWgR