Effortless Auth in Next.js 14: Use Auth.js & Drizzle ORM for Secure Login

The newest version of Next Auth works really well with the App Router. If you follow this tutorial, your app will be ready for modern next.js and partial pre-rendering. Next auth is a popular library within the Next.js ecosystem, designed for managing user authentication and authorization in your application.

In this tutorial, I'll guide you through the process of integrating Next Auth into your Next.js 14 app, utilizing the Drizzle ORM adapter. Everything will be using Server Actions and Server Components.

This setup will enable users to log in to your app using social sign-in providers such as GitHub, with their user data securely stored in your database via Drizzle ORM.

Code and references: https://www.nexttonone.lol/next-auth

Join this channel to get access to perks: https://www.youtube.com/channel/UC6aTLuI_j4-0wiDSzmaPctQ/join

Chapters:

  • 0:00​ Intro
  • 0:52 Setup Next Auth
  • 3:16 Next Auth Providers
  • 4:16 Setup Github
  • 6:50 Sign In
  • 7:30 User Session
  • 11:09 Drizzle Adapter
  • 15:36 Session User id
  • 21:24 Using the user id
  • 24:25 middleware
  • 26:14 Conclusion

Find an issue with this page? Fix it on GitHub