AuthVault
Complete authentication system with ASP.NET Core Identity, JWT, and OAuth2
About This Project
Build a full authentication and authorisation system using ASP.NET Core Identity, JWT with refresh token rotation, Google/GitHub OAuth2, role-based access control (RBAC), and email confirmation. Covers everything in the 'Auth & Security' section of the .NET roadmap — done correctly.
What You'll Learn
Key Features
Setup Guide
Clone and start dependencies
Clone the repo and start PostgreSQL + Redis via Docker.
git clone https://github.com/asmanasir/AuthVault.git cd AuthVault docker-compose up -d
Configure OAuth2 and email
Set Google/GitHub client IDs and SendGrid key in user secrets.
dotnet user-secrets set "Auth:Google:ClientId" "your-client-id" dotnet user-secrets set "Auth:Google:ClientSecret" "your-secret" dotnet user-secrets set "Auth:GitHub:ClientId" "your-client-id" dotnet user-secrets set "Auth:GitHub:ClientSecret" "your-secret" dotnet user-secrets set "Email:SendGridApiKey" "your-key"
Apply migrations
Create Identity tables + auth audit log.
dotnet ef database update
Running the Project
Run the API
Start AuthVault — Scalar docs at /scalar/v1 with all auth endpoints documented.
dotnet run
Run the auth flow
Register, confirm email, login, and test token refresh.
# 1. Register
curl -X POST http://localhost:5000/api/auth/register \
-H "Content-Type: application/json" \
-d '{"email":"you@example.com","password":"Test1234!"}'
# 2. Login → get access + refresh token
curl -X POST http://localhost:5000/api/auth/login \
-d '{"email":"you@example.com","password":"Test1234!"}'
# 3. Refresh
curl -X POST http://localhost:5000/api/auth/refresh \
-d '{"refreshToken":"..."}'Project Info
Tech Stack
Prerequisites
- .NET 8 SDK installed
- Docker Desktop installed
- Google/GitHub OAuth2 app credentials (free to create)
- SendGrid API key (free tier — or emails print to console in dev)
Learnixo
Project Author
Most auth tutorials show you how to issue a JWT. This shows you how to do the whole thing correctly — refresh token rotation, revocation, 2FA, OAuth2, and audit logging. The patterns here are what you'd implement in any production .NET API.