danimc / next-dashboard-template

Custom Next.js Template for Rapid Dashboard Development
MIT License
1 stars 1 forks source link

[FEAT] - Add single auth pipeline #1

Closed danimc closed 2 days ago

danimc commented 2 days ago

PR Description

This PR introduces a basic authentication pipeline for a Next.js application using NextAuth. The following components and functionality are included:

  1. Middleware Setup: • Middleware to handle routing based on authentication status, ensuring only authorized users can access protected pages.
  2. Home and Auth Pages: • Home page, accessible only to authenticated users. • Auth page, accessible to users who need to log in.
  3. Root Redirection Logic: • A function in app/page.tsx to redirect users based on authentication status. • If the user is authenticated, they are redirected to the Home page; if not, they are sent to the Auth page.

This setup provides a foundational authentication flow, leveraging NextAuth for user session management and redirection based on user authentication.