Securing Pages
Client-Side Protection
To protect client-side routes, usegetCurrentUser() to check if the user is authenticated. If not, redirect them to the login page using the signIn() function:
Server-Side Protection
For server-side route protection, use theauth() function provided by Next Auth:
Securing API Routes
To protect API routes, use theauth() function in your route handlers: