Loading video player...
๐ Learning : Auth.js v5 (successor to NextAuth, now maintained by Better Auth team). Setup with MongoDB adapter. Providers: Google, GitHub, Credentials. Session strategies (JWT vs database). auth() helper for Server Components, useSession() for Client Components. ๐ Hands-On : Install next-auth@beta. Configure auth.ts with Google + GitHub providers. Set up MongoDB adapter. Create sign-in/sign-out buttons. Access session in Server Components with auth(). Protect the admin page. ๐งช Mini-Project : "Auth-Gated Blog" โ Only logged-in users can create/edit posts. Display the logged-in user's avatar and name. Sign in via Google or GitHub. Show "Sign In" CTA for anonymous users.