MENU

Fun & Interesting

Next.js 15 Authentication COMPLETE Guide (+ Best Practices, Pitfalls)

ByteGrad 34,950 lฦฐแปฃt xem 3 months ago
Video Not Working? Fix It Now

๐Ÿ‘‰ Kinde: https://bit.ly/3QOe1Bh (paid sponsorship)
๐Ÿ‘‰ NEW React & Next.js Course: https://bytegrad.com/courses/professional-react-nextjs

Hi, I'm Wesley. I'm a brand ambassador for Kinde (paid sponsorship).
๐Ÿ‘‰ Check out Kinde for auth and more https://bit.ly/3QOe1Bh
๐Ÿ‘‰ Work with me: support@bytegrad.com

๐Ÿ‘‰ NEW React & Next.js Course: https://bytegrad.com/courses/professional-react-nextjs
๐Ÿ‘‰ Professional JavaScript Course: https://bytegrad.com/courses/professional-javascript
๐Ÿ‘‰ Professional CSS Course: https://bytegrad.com/courses/professional-css

๐Ÿ‘‰ Web development roadmap 2024 & 2025: https://email.bytegrad.com
๐Ÿ‘‰ Email newsletter (BIG update soon): https://email.bytegrad.com
๐Ÿ‘‰ Discord: all my courses have a private Discord

โฑ๏ธ Timestamps:
00:00 What should be protected in Next.js?
03:48 Cookies and tokens (JWT)
04:27 Auth solution: External (Kinde) vs Do It Yourself?
06:18 Kinde setup
07:56 Protect routes (server components)
10:09 Logout link
11:17 Login link & Register link
11:52 Layout vs Page (where to do auth check?)
14:05 Middleware vs Page (where to do auth check?)
17:49 Protect server actions
20:25 Pitfall: using server action on unprotected route
21:50 Protect route handlers
22:08 Show user info in header: client-side auth (avatar + email in header)
23:28 Pitfall: static & dynamic rendering (IMPORTANT!)
27:44 Connecting external auth solution with your own database
29:45 Pitfall: forgetting authorization
32:14 Roles & Permissions (admin role)
35:09 Best practice: Data Access Layer (DAL)

#webdevelopment #reactjs #nextjs

Note that my videos may contain mistakes. Always verify yourself that your code is safe and does what you want it to do for your specific situation. You agree by watching the videos that you are solely responsible for any mistakes in your code.

This channel and all its content is owned & operated by ByteGrad Sp. z o.o. with Tax ID: PL6762676561 and KRS-number: 0001125554 .
.
TOP resource to LEARN AI for Developers - https://datacamp.pxf.io/RGyxrR (paid sponsorship & ByteGrad Sp. z o.o. gets commission)

Comment