MENU

Fun & Interesting

NextAuth.js Custom Adapter with HarperDB Database in Next.js

Colby Fayock 4,898 lượt xem 2 years ago
Video Not Working? Fix It Now

Learn how to create a NextAuth.js Custom Adapter using HarperDB to persist authenticated sessions to a database. We'll walk through setting up a new Custom Adapter, creating a new database in HarperDB with a Schema and Tables, and configuring the Custom Adapter to use HarperDB for database queries and operations.

🧐 What's Inside
00:00 - Intro
00:33 - Tools we'll use including NextAuth.js and HarperDB
02:32 - Reviewing existing project 50reactprojects.com
03:47 - Scaffolding a new NextAuth.js Custom Adapter
06:55 - Creating a new database instance in HarperDB
08:49 - Setting up a new Schema with Tables based on NextAuth.js Models
10:49 - Building a HarperDB client function for making requests
13:56 - Adding a JSON.parse reviver function to parse date values
16:27 - Using NextAuth.js methods to trigger HarperDB queries and operations

💾 Code
https://github.com/colbyfayock/50reactprojects.com/pull/23

🗒️ Read More
https://spacejelly.dev/posts/how-to-create-a-nextauth-js-custom-adapter-with-harperdb-next-js/

🔔 Subscribe for more tech and developer videos
https://www.youtube.com/colbyfayock?sub_confirmation=1

🐦 Get updates straight to your Twitter @colbyfayock
https://twitter.com/colbyfayock

📸 Catch the next stream live on Twitch @colbyfayock
https://twitch.tv/colbyfayock

✉️ Or a newsletter right to your inbox!
https://www.colbyfayock.com/newsletter/

💝 Sponsor me for more free content like this!
GitHub: https://github.com/sponsors/colbyfayock
Other: hello@colbyfayock.com

👨‍🚀 Brought to by colbyfayock.com
https://www.colbyfayock.com

🎥 Want to know what A/V equipment I use?
https://www.colbyfayock.com/uses

🧰 More Resources

HarperDB
https://spacejelly.dev/harperdb

NextAuth.js - Creating a Database Adapter
https://next-auth.js.org/tutorials/creating-a-database-adapter

JSON.parse Reviver Function
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#using_the_reviver_parameter

50 Projects for React & the Static Web
https://50reactprojects.com/
https://github.com/colbyfayock/50reactprojects.com

🎼 Music
Music from Uppbeat (free for Creators!):
https://uppbeat.io/t/danijel-zambo/stardust
License code: D0YGMUZXYPYH8J4U

#colbyfayock #authentication #harperdb #nextauthjs #nextjs #database #webdevelopment

Comment