Auth.js (Next Auth) V5 (2024) with Next.js, Tailwind, DrizzleORM, NeonDB | Full Tutorial

  Рет қаралды 12,186

GiraffeReactor

GiraffeReactor

Күн бұрын

Пікірлер: 93
@GiraffeReactor
@GiraffeReactor 5 ай бұрын
EDIT: I apologize for the audio issues was a huge overlook on my part, I hope everyone will be understanding and still appreciate the work I put into this video! Hi, thanks for stopping by! I know it's a long video so if you have any questions or what me to point you to a timestamp please let me know! If not I think everything in the video ties together nicely and if you have the time i'd say give it a full go through!
@AlexanderMoyer-k3b
@AlexanderMoyer-k3b 3 ай бұрын
ha no problem. thanks for the awesome video. idk why people say nextauth is easy to implement
@GiraffeReactor
@GiraffeReactor 3 ай бұрын
@@AlexanderMoyer-k3b it's easy to implement for simple credentials with email and password (could probably be done in 5 minutes) It's all the customizing that makes it difficult but it also gives you power as the developer to make the auth work for your customization and needs so it's give and take Thanks for the comment!
@nabiljara9626
@nabiljara9626 2 ай бұрын
@@GiraffeReactor Thanks, that fixed it, excellent tutorial!
@the_beat
@the_beat Ай бұрын
You know whats funny is I have been trying to understand this whole thing from top youtube programmers but all they do is to show how smart they are,here you are making me understand this thing in one go,Thanks mate!
@GiraffeReactor
@GiraffeReactor Ай бұрын
Thank you mean's a lot, i know a lot of time is spent on unrelated stuff and its a bit longer overall then I would of liked but I was really happy with the video (minus the terrible audio i found out afterwards T_T). But yeah thank you for the words!
@mjylove2
@mjylove2 11 күн бұрын
two and an half hours in .. and this vid is a masterpiece
@SpiceDune
@SpiceDune 4 ай бұрын
This is one of the best tutorials. I love the approach. Everything is well thought out, which makes it easy to understand, not just copy-paste like other tutorials. Also loved how you broked down each part into sub parts. Would love to see more tutorials from you.
@GiraffeReactor
@GiraffeReactor 4 ай бұрын
Appreciate the comment does help me want to make more, have some ideas but currently low on time~!
@shinuy-yk2mv
@shinuy-yk2mv 3 ай бұрын
I can't believe youtube is recommending me such high quality bloggers, I'm following you decisively!
@GiraffeReactor
@GiraffeReactor 3 ай бұрын
Thank you for the comment!
@shinuy-yk2mv
@shinuy-yk2mv 3 ай бұрын
@@GiraffeReactor Such long videos are really great, I've been watching continuously for four hours, although I'm really sleepy 😁
@yixie-hu2jm
@yixie-hu2jm 3 ай бұрын
100% wonderful project!!!!!!!!!! It is the fourth day to follow coding!!!! The last chapter now.. so happy!!!!!!!!!!!!!!
@SSECA
@SSECA 5 ай бұрын
Thank you for this course on Next.js & Auth. It helped me to better understand the dynamics of authentication within Next.js.
@GiraffeReactor
@GiraffeReactor 5 ай бұрын
@@SSECA appreciate the comment!
@furkankaracan2076
@furkankaracan2076 2 ай бұрын
thank you for your service sir
@GiraffeReactor
@GiraffeReactor 2 ай бұрын
@@furkankaracan2076 Thank you for your comment!
@OnlyJavascript
@OnlyJavascript 5 ай бұрын
i see the efforts. keep going man!
@GiraffeReactor
@GiraffeReactor 5 ай бұрын
Appreciate the comment!
@HenokGebresenbet
@HenokGebresenbet 2 ай бұрын
this video is underrated
@GiraffeReactor
@GiraffeReactor 2 ай бұрын
@@HenokGebresenbet thanks for the comment!
@codernerd7076
@codernerd7076 16 күн бұрын
Would be awesome to update this video with Next.js 15 and React 19 and maybe some alternative like Better Auth?!
@prashlovessamosa
@prashlovessamosa 15 күн бұрын
+1
@prashlovessamosa
@prashlovessamosa 19 күн бұрын
Thanks 🙏
@zhenobiikuzo4957
@zhenobiikuzo4957 2 ай бұрын
holy shems this is gold
@GiraffeReactor
@GiraffeReactor 2 ай бұрын
@@zhenobiikuzo4957 appreciate the comment
@thecoder1631
@thecoder1631 5 ай бұрын
just came across your channel, definitely want to try the new auth, this would be perfect video. audio has bit of problem but i think you're aware of it :) thank you for putting so much effort into this. cheers.
@GiraffeReactor
@GiraffeReactor 5 ай бұрын
@@thecoder1631 hey thanks for the comment, yeah definitely know about the Audio TT, considered remaking it or dubbing over it but it took me quite a while to make it not sure if it's worth it, just wanted to provide a free resource + the repo for everyone to view
@thecoder1631
@thecoder1631 5 ай бұрын
@@GiraffeReactor nah i think that would be too much work, should put that energy and time into making another project or something :) maybe new ai tools can help you with audio ? not sure just guessing.
@kushaltanna5569
@kushaltanna5569 5 ай бұрын
wow..! great video
@GiraffeReactor
@GiraffeReactor 5 ай бұрын
@@kushaltanna5569 thanks appreciate the comment!
@zatakzataks
@zatakzataks 4 ай бұрын
@@GiraffeReactor hey bro you made my day thanks bro love you
@yoJuicy
@yoJuicy 5 ай бұрын
Love the stack, thanks for sharing. Your audio is only coming out thru the left. I would suggest using a better mic next time.
@GiraffeReactor
@GiraffeReactor 5 ай бұрын
@@yoJuicy I know! I'm so upset 😭 I think my webcam mic was enabled instead of my regular mic I'll be sure to triple check everything next time
@yoJuicy
@yoJuicy 5 ай бұрын
@@GiraffeReactor all good homie. Could still hear you just fine in one ear😁
@AlexanderMoyer-k3b
@AlexanderMoyer-k3b 3 ай бұрын
a. local postgres server with prisma b. start with auth js -> that's why we're watching the tutorial.
@Jacob-od8rl
@Jacob-od8rl 2 ай бұрын
This is the content is one of the best content ever seen. !!! 10 out of 10.!! I got 2 questions. 1: what's the name of the extension or settings when you type a code there are guide you to comment "session is possibly null or undefined" ? - if it's "Error Lens", could you share the settings? or how to enable/disable showing "null | undefined" error? 2. What's the name of extension when you type console.log then show the result beside?
@GiraffeReactor
@GiraffeReactor 2 ай бұрын
Hello, thanks for the comment! 1. it is error lens, i dont think i set up any custom settings for it 2. second one is called console ninja, unfortunately the free version doesnt work with the newest version of next.js which sucks because i really like the extension
@Jacob-od8rl
@Jacob-od8rl 2 ай бұрын
@@GiraffeReactor Thanks for the reply. BTW, are you still using the console ninja? I've just started install but it says they don't support next.js 15 turbopack. how you handle it?
@alexandervasilenko7773
@alexandervasilenko7773 3 ай бұрын
Nice work. Lets continue in the same manner... But you've to dive deeper in the db transactions principle.
@GiraffeReactor
@GiraffeReactor 2 ай бұрын
What would you like to see?
@alexandervasilenko7773
@alexandervasilenko7773 2 ай бұрын
@@GiraffeReactor When you trying to execute several queries (select, update...) to the db it should be less dangerous to execute all of them in one transaction. Just an experience - nothing else, bro :)
@nelco63
@nelco63 4 ай бұрын
Great Work, would love your thoughts on removing third party Auth (Google/Github etc) and replacing with Passkeys in a Next Js SaaS application?
@martinriedl1505
@martinriedl1505 4 ай бұрын
6:00:56 - coffee break ☕
@rezwanulhaque9935
@rezwanulhaque9935 3 ай бұрын
great
@GiraffeReactor
@GiraffeReactor 3 ай бұрын
@@rezwanulhaque9935 thank you for the comment
@yixian0716
@yixian0716 28 күн бұрын
I appreciate your hardwork and it is an awesome tutorial. But I would like to ask whether is this authentication secure enough when going into production?
@GiraffeReactor
@GiraffeReactor 28 күн бұрын
@@yixian0716 I think it's pretty solid It really depends on the scale of the company or if it's just a personal project - All your users are in a database so migration is doable in the future if necessary - I would probably use a better email provider maybe like resend or mail gun so things are easier to handle
@yixian0716
@yixian0716 28 күн бұрын
@GiraffeReactor Okay tqvm for the clarification 😊
@_vyas_ayush
@_vyas_ayush Ай бұрын
Can you please guide about how i can automatically referesh the token from google console oauth playground.? i have to manually refresh it . Great video btw.
@mohamedyoussef8835
@mohamedyoussef8835 5 ай бұрын
Wow... awesome video.
@GiraffeReactor
@GiraffeReactor 5 ай бұрын
@@mohamedyoussef8835 thank you!
@angletheeta
@angletheeta 13 күн бұрын
I have a issue when this goes to production im use self hosted vps with nginx when i place riderect url doman/api/auth/callback/google it ridirected to localhost:3000error why is that
@corpsedad7368
@corpsedad7368 4 ай бұрын
I want to know something can the roles be implemented here i dont know how to implement roles like one admin , user and other roles if i want for general manager or any other from the super admin type. I know its complex but hope please make a short video to include that please
@GiraffeReactor
@GiraffeReactor 4 ай бұрын
I cover roles at 01:08:15 - Drizzle Schema Setup 05:46:03 - PART 6: User Roles (USER vs ADMIN) i only use two roles in this tutorial user and admin the process to add a third role like moderator or something is exactly the same as adding a 2nd role like I did with admin, if I have time I will make another video covering three roles.
@mjylove2
@mjylove2 11 күн бұрын
question: when using useSession() hook, does this hook send request to the /api/auth/[...nextauth] route handler so that the handler read session cookie and send back user info?
@GiraffeReactor
@GiraffeReactor 10 күн бұрын
@@mjylove2 I assume this is the case since the [...nextauth] catch all covers all the routes for next auth and since useSession is used in a client component it has to access to access server data via those route handlers
@mjylove2
@mjylove2 4 күн бұрын
@@GiraffeReactor Thank you for the reply !
@cubeunicorn4055
@cubeunicorn4055 4 ай бұрын
Great video Nice work or dividing in multiple parts bur my issue is i don't want to create the first part so if you can provide the code according to part by part is will be very easy to work with please provide this one thanks
@GiraffeReactor
@GiraffeReactor 4 ай бұрын
I understand, I should have prepared that better in advance I have a very similar repo that has part 1, part 2, part 3, part 4, part 5 in different git branches so you can look there github > destocot > authjs-practice-070804
@prashlovessamosa
@prashlovessamosa 19 күн бұрын
Whats your theme and font.
@kennedymungai1
@kennedymungai1 3 ай бұрын
drizzle-kit push works better than drizzle-kit generate then drizzle-kit migrate IMO
@GiraffeReactor
@GiraffeReactor 3 ай бұрын
@@kennedymungai1 I probably should have used drizzle-kit push for this specific tutorial since it's not about drizzle But I think they serve two different purposes, drizzle-kit push just pushes your database changes for quick prototyping, but drizzle-kit generate and drizzle-git migrate gives you an SQL file which you can use to migrate without drizzle in the future
@kennedymungai1
@kennedymungai1 3 ай бұрын
@@GiraffeReactor Did not think about that. Noted
@GiraffeReactor
@GiraffeReactor 3 ай бұрын
@@kennedymungai1 yeah I learned about it when using prisma, if its just a personal project i say just drizzle-kit push all the way
@codernerd7076
@codernerd7076 3 ай бұрын
Have you ever found a way to fix the button issue without reloading the full page?!
@GiraffeReactor
@GiraffeReactor 3 ай бұрын
@@codernerd7076 nope, you can try the built in signIn, signOut functions from import { signIn, signOut } from "next-auth/react those might give you better luck but then you'll be using them directly in your client component honestly though I see no problem with a full page change, it also helps guarantee no user info is left over from the previous login
@jeremiahgd1924
@jeremiahgd1924 3 ай бұрын
Whats the name of that font
@GiraffeReactor
@GiraffeReactor 3 ай бұрын
for my vs code? I believe I used cascadia code for the next.js app I believe it's Inter
@corpsedad7368
@corpsedad7368 3 ай бұрын
K
@stormbby880
@stormbby880 2 ай бұрын
Does this tutorial include password hashing?
@GiraffeReactor
@GiraffeReactor 2 ай бұрын
@@stormbby880 yes timestamps are in the description 00:56:04 - Password Hashing (Argon2)
@stormbby880
@stormbby880 2 ай бұрын
Just finished the tutorial, awesome work, thank you! Do you have any configurations for connecting to supabase instead of neon?
@GiraffeReactor
@GiraffeReactor 2 ай бұрын
@@stormbby880 yeah you can simply use supabase as a connection string to a postgres database there's also a guide to using it with drizzle from postgres itself supabase.com/docs/guides/database/drizzle I am unsure how it works with the RLS (row level security)
@OnlyJavascript
@OnlyJavascript 5 ай бұрын
can you make one for lucia auth?
@GiraffeReactor
@GiraffeReactor 5 ай бұрын
Ive only learned about lucia auth recently, dont think ill get to it anytime soon but ill keep it mind, check out @codinginflow latest 2 videos he covers lucia auth in that tutorial
@alexdin1565
@alexdin1565 5 ай бұрын
The big problem with this Authjs is facebook provider doesn't work
@GiraffeReactor
@GiraffeReactor 5 ай бұрын
@@alexdin1565 I've never worked with the Facebook provider but I want to for a future personal project so maybe I'll take a look
@martinriedl1505
@martinriedl1505 4 ай бұрын
works for me
@nabiljara9626
@nabiljara9626 2 ай бұрын
I have an error in the auth-core-d.ts file line 5 that says: Type 'AdapterUser' recursively references itself as a base type.ts How could I fix it?
@GiraffeReactor
@GiraffeReactor 2 ай бұрын
Try to use same versions of my next-auth and authcore Try to remove the extends default adapter user part Try to use same version of my nextjs Hopefully one of these works, all source code is in the description of the video
@nabiljara9626
@nabiljara9626 2 ай бұрын
@@GiraffeReactor I tried changing the versions but it didn't work. How would the code look if I removed the extends default adapter user part?
@GiraffeReactor
@GiraffeReactor 2 ай бұрын
@@nabiljara9626 import type { AdapterUser as DefaultAdapterUser } from "@auth/core/adapters"; import { users } from "@/drizzle/schema"; declare module "@auth/core/adapters" { export interface AdapterUser { role: (typeof users.$inferSelect)["role"]; } } If that doesn't work just do a // @ts-ignore and move on so you don't get stuck on it
@nabiljara9626
@nabiljara9626 2 ай бұрын
That fixed it thanks! Excellent tutorial
@GiraffeReactor
@GiraffeReactor 2 ай бұрын
@@nabiljara9626 thank you for the comment!
@CyrilUrban-nw8vd
@CyrilUrban-nw8vd 3 ай бұрын
Nextjs is shit framework
@PierreAtman
@PierreAtman 2 ай бұрын
Great video ! at 6:14:21, i guess it doesn't work because you typed "insertData.role === USER_ROLES.ADMIN" instead of "insertData.role = USER_ROLES.ADMIN", i guess the first return false :)
@PierreAtman
@PierreAtman 2 ай бұрын
Great video ! at 6:14:21, i guess it doesn't work because you typed "insertData.role === USER_ROLES.ADMIN" instead of "insertData.role = USER_ROLES.ADMIN", i guess the first return false :)
@GiraffeReactor
@GiraffeReactor 2 ай бұрын
@@PierreAtman ahh I see good eye, funny how I never figured that out just rewrote it with a ternary xD
@PierreAtman
@PierreAtman 2 ай бұрын
​@@GiraffeReactor as long as it works :D thanks again for the video, i learned a lot :)
@GiraffeReactor
@GiraffeReactor 2 ай бұрын
@@PierreAtman appreciate it means a lot that I can help at least one person
They made React great again?
4:11
Fireship
Рет қаралды 1,1 МЛН
Мясо вегана? 🧐 @Whatthefshow
01:01
История одного вокалиста
Рет қаралды 7 МЛН
VIP ACCESS
00:47
Natan por Aí
Рет қаралды 30 МЛН
Леон киллер и Оля Полякова 😹
00:42
Канал Смеха
Рет қаралды 4,7 МЛН
Is Next.js 15 any good? "use cache" API first look
8:16
Beyond Fireship
Рет қаралды 130 М.
Web Developers Are Disconnected
21:36
ThePrimeTime
Рет қаралды 228 М.
The Simplest Tech Stack
9:38
Awesome
Рет қаралды 143 М.
I'm finally moving away from Next-Auth
16:24
Web Dev Cody
Рет қаралды 30 М.
I Used Code to Go Viral on Social Media
8:54
Green Code
Рет қаралды 253 М.
Embedded Rust setup explained
23:03
The Rusty Bits
Рет қаралды 95 М.
Next-Auth on App Router - Solid Auth, Super Fast
17:20
Jack Herrington
Рет қаралды 123 М.
How to OVER Engineer a Website // What is a Tech Stack?
11:20
Fireship
Рет қаралды 2,5 МЛН
I tried 8 different Postgres ORMs
9:46
Beyond Fireship
Рет қаралды 443 М.
Мясо вегана? 🧐 @Whatthefshow
01:01
История одного вокалиста
Рет қаралды 7 МЛН