https://github.com/korabi123/advanced-auth-guide-2024
An advanced repo dedicated for authentication built with the most modern web techonologies.
https://github.com/korabi123/advanced-auth-guide-2024
2024 authentication-middleware fullstack github neondb next-auth-v5 nextjs14 prisma server-actions shadcn-ui tailwindcss typescript zod
Last synced: 2 months ago
JSON representation
An advanced repo dedicated for authentication built with the most modern web techonologies.
- Host: GitHub
- URL: https://github.com/korabi123/advanced-auth-guide-2024
- Owner: Korabi123
- License: mit
- Created: 2024-01-01T20:23:22.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-01-16T12:27:54.000Z (over 1 year ago)
- Last Synced: 2024-05-17T20:52:42.011Z (about 1 year ago)
- Topics: 2024, authentication-middleware, fullstack, github, neondb, next-auth-v5, nextjs14, prisma, server-actions, shadcn-ui, tailwindcss, typescript, zod
- Language: TypeScript
- Homepage: https://advanced-auth-five.vercel.app
- Size: 553 KB
- Stars: 11
- Watchers: 1
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Next Auth v5 - Advanced Repository (2024)

This is a repository for Next Auth v5 (2024)
Once finished this Project will have the following Key Features:
- 🔐 Next-auth v5 (Auth.js)
- 🚀 Next.js 14 with server actions
- 🔑 Credentials Provider
- 🌐 OAuth Provider (Social login with Google & GitHub)
- 🔒 Forgot password functionality
- ✉️ Email verification
- 📱 Two factor verification
- 👥 User roles (Admin & User)
- 🔓 Login component (Opens in redirect or modal)
- 📝 Register component
- 🤔 Forgot password component
- ✅ Verification component
- ⚠️ Error component
- 🔘 Login button
- 🚪 Logout button
- 🚧 Role Gate
- 🔍 Exploring next.js middleware
- 📈 Extending & Exploring next-auth session
- 🔄 Exploring next-auth callbacks
- 👤 useCurrentUser hook
- 🛂 useRole hook
- 🧑 currentUser utility
- 👮 currentRole utility
- 🖥️ Example with server component
- 💻 Example with client component
- 👑 Render content for admins using RoleGate component
- 🛡️ Protect API Routes for admins only
- 🔐 Protect Server Actions for admins only
- 📧 Change email with new verification in Settings page
- 🔑 Change password with old password confirmation in Settings page
- 🔔 Enable/disable two-factor auth in Settings page
- 🔄 Change user role in Settings page (for development purposes only)## For the env file use this template:
```env
# Environment variables declared in this file are automatically made available to Prisma.
# See the documentation for more detail: https://pris.ly/d/prisma-schema#accessing-environment-variables-from-the-schema# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.
# See the documentation for all the connection string options: https://pris.ly/d/connection-stringsDATABASE_URL=""
DIRECT_URL=""# NextAuth
AUTH_SECRET=""
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=# Resend Mail
RESEND_API_KEY=NEXT_PUBLIC_APP_URL=""
```Project Progress:
- [x] Project structure
- [x] Landing page
- [x] Login Component (Redirect)
- [x] Register Component
- [x] Login Button
- [x] Social Login Component
- [x] Credentials Provider
- [x] OAuth Provider
- [x] User Roles
- [x] Email Verification
- [x] Forgot Password Component
- [x] 2FA
- [x] Hooks
- [x] Role Gate
- [x] Protect API Routes for Admins only
- [x] Protect Server Actions for Admins only
- [x] Change Email
- [x] Enable / disable 2FA in settings