Skip to main content

Admin Pages

The /admin directory contains administrative components and pages that require user authentication to access. Both NextAuth and Supabase are used to protect these pages, ensuring only logged-in users can view or interact with the content.

Admin Directory

The /admin directory is specifically for administrative components and pages. These pages are protected by middleware, requiring users to be authenticated to access any content.

Protection with NextAuth

When using NextAuth, the middleware ensures that only authenticated users can access the /admin pages. If a user is not logged in, they will be redirected to the login page.

  • Authentication: Managed by NextAuth, with session and token handling.
  • Access Control: Middleware checks user authentication status before allowing access to /admin pages.

Protection with Supabase

Similarly, when using Supabase, the middleware protects the /admin pages by verifying the user's session. Unauthenticated users will be redirected to the login page.

  • Authentication: Managed by Supabase, using its auth client.
  • Access Control: Middleware checks for a valid user session before granting access to /admin pages.

Conclusion

The /admin directory in this project is securely protected to ensure that only authenticated users can access administrative functionalities. Whether using NextAuth or Supabase, the middleware effectively handles the authentication and access control, maintaining the security and integrity of the admin pages.