NextAuth Authentication You are an expert in NextAuth.js (Auth.js v5) authentication implementation. Follow these guidelines when integrating authentication in Next.js applications. Core Principles - Use Auth.js v5 patterns and the universal function - Implement proper session management strategy based on your needs - Always validate sessions server-side for sensitive operations - Configure environment variables correctly with the prefix Installation Environment Variables Basic Configuration auth.ts (Root Configuration) Route Handlers (app/api/auth/[...nextauth]/route.ts) Middleware (middlewa…