Next Auth V5 - Advanced Guide (2024)

  Рет қаралды 477,678

Code With Antonio

Code With Antonio

Күн бұрын

Discord for any problems/errors/bugs: www.codewithantonio.com/discord
Github & Live Website: www.codewithantonio.com/proje...
Auth.js: authjs.dev/
Middleware config: dub.sh/Apr6dvD
Resend: resend.com/
Node.js: nodejs.org/en
ShadcnUI: ui.shadcn.com/
Clerk: dub.sh/SdVFxFU
Learn how to add advanced authentication to your NextJS App.
Key Features:
- 🔐 Next-auth v5 (Auth.js)
- 🚀 Next.js 14 with server actions
- 🔑 Credentials Provider
- 🌐 OAuth Provider (Social login with Google & GitHub)
- 🔒 Forgot password functionality
- ✉️ Email verification
- 📱 Two factor verification (2FA)
- 👥 User roles (Admin & User)
- 🔓 Login component (Opens in redirect or modal)
- 📝 Register component
- 🤔 Forgot password component
- ✅ Verification component
- ⚠️ Error component
- 🔘 Login button
- 🚪 Logout button
- 🚧 Role Gate
- 🔍 Exploring next.js middleware
- 📈 Extending & Exploring next-auth session
- 🔄 Exploring next-auth callbacks
- 👤 useCurrentUser hook
- 🛂 useRole hook
- 🧑 currentUser utility
- 👮 currentRole utility
- 🖥️ Example with server component
- 💻 Example with client component
- 👑 Render content for admins using RoleGate component
- 🛡️ Protect API Routes for admins only
- 🔐 Protect Server Actions for admins only
- 📧 Change email with new verification in Settings page
- 🔑 Change password with old password confirmation in Settings page
- 🔔 Enable/disable two-factor auth in Settings page
- 🔄 Change user role in Settings page (for development purposes only)
Timestamps
00:00 Intro & Demo
02:05 Project setup
15:19 Routing crash course
38:06 Home page
48:40 Card wrapper
01:04:51 Login form
01:23:08 Register form
01:40:16 Database & Prisma setup
01:57:14 Create user
02:06:30 Middleware & Login
02:50:52 Callbacks
03:20:34 OAuth (Google & Github)
03:47:58 Resend (Sending emails)
04:19:27 Email verification
04:48:12 Reset password email
05:08:11 Reset password form
05:22:48 Two factor authentication
05:55:28 User button
06:15:02 Server & Client example
06:30:06 Admin example
06:47:25 Settings page
07:33:09 Sponsor demo
07:38:14 Deployment

Пікірлер: 1 500
@codewithantonio
@codewithantonio 5 ай бұрын
Hello everyone 👋 Thank you for choosing this video, and I hope you will enjoy this next auth v5 masterclass. I listened to your requests and decided to dive deep into creating our own auth toolkit with reuseable components, hooks and utils to use auth in server & client components, api routes and server actions. We will also deeply explore the middleware and learn how to extend next auth session, use callbacks, pages and events configuration. Thank you all for an amazing 2023, and see you in 2024! ❤
@NaniwaRocky
@NaniwaRocky 5 ай бұрын
Professional stuff as to be expected from Antonio! Many thanks! ❤
@ilyaasomar9173
@ilyaasomar9173 5 ай бұрын
thank you you did awasome tutorial.
@raymondmichael4987
@raymondmichael4987 5 ай бұрын
This looks loaded 😊😊, ❤; I’m at 48 minutes now. You have done a lot of wonderful works this year, stay safe Brother. Greetings from Tanzania 🇹🇿
@baptistefuseau1332
@baptistefuseau1332 5 ай бұрын
Thank you very much for the quality of the content you offer! We see that you keep improving from one video to another and that's what makes you teach us a lot! For the next video, would it be possible to achieve the same with image hosting without going through an external provider or using base64? From my point of view, it would be interesting to store the images on our server directly 😉 Thank you again and happy new year 2024! ❤
@Yahya_Umar
@Yahya_Umar 5 ай бұрын
Your content is amazing! Could you consider creating a video about Inventory Management Systems? Your expertise would make it incredibly valuable. Thanks!.
@bobbuilder2837
@bobbuilder2837 5 ай бұрын
This tutorial needs to be in official NextAuth documentation.
@codewithantonio
@codewithantonio 5 ай бұрын
Glad you like it!
@Besaoct
@Besaoct Ай бұрын
​@@codewithantonio hey! It's not working properly in production (middleware and redirections)
@iganic7574
@iganic7574 6 күн бұрын
Is you have completed this project?
@Besaoct
@Besaoct 6 күн бұрын
@@iganic7574 yeah
@santech5669
@santech5669 5 ай бұрын
8hrs of content on Next Auth? Brother you're awesome, I am definitely contriuting once I get a frontend job, the amount of value you give out for free is priceless. Awesome tutor!!!!!
@codewithantonio
@codewithantonio 5 ай бұрын
Glad you like the content :)
@maskahleo
@maskahleo Ай бұрын
who has 8 hours to watch?
@stanleyudegbunam873
@stanleyudegbunam873 Ай бұрын
@@maskahleo someone who really wants to learn
@ChristopherMakrides
@ChristopherMakrides Ай бұрын
It is worth the 8 hours
@Coding-pj4zq
@Coding-pj4zq 24 күн бұрын
@@ChristopherMakrides definately
@jonathanbaird1633
@jonathanbaird1633 Ай бұрын
For security purposes, you should always return a generic Invalid credentials message no matter if the user account exists or not. For unverified emails on user accounts your function for sending the verification emails will send an email no matter if the password is correct or not. Instead you should verify that the the password and the email before sending the verify email. Also for password reset; the response should not be Email not found if the user account doesn't exist. It should always return Reset email sent message. The reason for this is because you do not want a malicious actor to find out if an email belongs to a valid user account. If they can get a list of your users they can try brute force or password spray techniques to hack your app.
@deadgun0817
@deadgun0817 29 күн бұрын
Thanks for sharing these with us 🙏
@someshkarmakar47
@someshkarmakar47 26 күн бұрын
actually i am thinking the same, if password is wrong then it should not send 2FA mail, I did it by checking the credentials using a sever action and if creadential are correct then it goes to 2FA mail. besides that everything is gem in this video i think... and till now the best Next-auth tutorial on KZfaq.
@adabooost
@adabooost 4 ай бұрын
for those of you getting errors at 2:31:45. Just end the control with a simple return. After the update the function signature you're using for the middleware does not match what the new auth package expects... so if you don't wanna downgrade from auth beta.9 ... just return a native Response, or just do a simple return without the null.
@eness_ctnn
@eness_ctnn 4 ай бұрын
i was searching all of the internet for this solution thank you mate
@thiettruong7381
@thiettruong7381 4 ай бұрын
@@Salah-YT i removed all return lines, but when isLoggedIn = false and isPublicRoute =.false, middleware not redirect to /auth/login can you show me more,
@mideolaniyi
@mideolaniyi 4 ай бұрын
thank you, it worked
@mideolaniyi
@mideolaniyi 4 ай бұрын
actually it wasn't redirecting to /auth/login when I tried accessing the /settings route. So I added another condition "&& nextUrl.pathname !== "/auth/login"" then it worked
@gendev1105
@gendev1105 3 ай бұрын
return NextResponse.next(); don't forget to import : import { NextResponse } from "next/server"; this works for me!
@ypeng5811
@ypeng5811 5 ай бұрын
This is awesome! By following your airbnb clone I landed my first job in tech and now I’m building a website using next auth for them? even though I have done the most basic part but a in-depth nextauth is what I need!❤ thank you so much
@codewithantonio
@codewithantonio 5 ай бұрын
Happy that my videos helped you!
@softdevstuff1008
@softdevstuff1008 5 ай бұрын
Just landed upon your channel, checked number of subscribers and checked when you started. To be honest it was a surprise you got to this number in less than an year. Then I checked your other videos. Now I know, with few videos, you have delivered so much value for free that its just priceless. Subscribed.
@codewithantonio
@codewithantonio 5 ай бұрын
Thank you very much, happy you like my content :)
@0xOmzi
@0xOmzi 5 ай бұрын
Damnnn 🤯. You keep outdoing yourself Antonio. This is the EXACT tutorial I need right now. I've always wanted to go beyond the basics with NextAuth (now AuthJS) but haven't had much success. Thanks a million for this timely tutorial 🙏🏽. I also have a testimony to share 😅. Due to the skills & experience I gained following your tutorials, I won my first hackathon ever! Thanks again 🙌🏽😁.
@codewithantonio
@codewithantonio 5 ай бұрын
Great job!!!!!
@user-zu1qm6ji9y
@user-zu1qm6ji9y 5 ай бұрын
If there were a KZfaq Valuable Creator Award specifically for teaching coding, there is no doubt in my mind that you would be the perfect candidate for this prestigious recognition. Your dedication to educating others about coding and your exceptional teaching skills make you truly deserving of such an accolade. Through your KZfaq channel, you have consistently demonstrated an incredible ability to break down complex coding concepts into digestible and easily understandable explanations. Your videos are not only informative and comprehensive but also engaging and enjoyable to watch. Your commitment to helping aspiring developers and programmers navigate the world of coding is inspiring. You go above and beyond to provide valuable resources, tutorials, and practical examples, empowering your viewers to learn coding and enhance their skills. The impact you have on your audience is evident through the numerous positive comments and gratitude expressed by those who have benefited from your instructional videos. Your ability to make coding accessible and enjoyable for learners of all levels sets you apart as a truly exceptional coding instructor. Your passion for coding and your genuine desire to see others succeed in their coding journey shines through in every video you create. Your dedication and expertise have undoubtedly made a significant impact on the coding community, and for that, you are truly deserving of recognition and appreciation.
@codewithantonio
@codewithantonio 5 ай бұрын
Thank you a lot for the kind words ❤️
@eshw23
@eshw23 5 ай бұрын
Amazing, I would love more tutorials focusing on concepts like this instead of only project clone tutorials all the time. Great video!
@codewithantonio
@codewithantonio 5 ай бұрын
I would be happy to do more like this if people like it :)
@jones3791
@jones3791 5 ай бұрын
@@codewithantonioI agree with him, Please do more like this!
@mohdali-yq8gq
@mohdali-yq8gq 5 ай бұрын
These kind of tutorials are very, very helpful so please create these kind of projects like what are the main security concerns before we upload on the cloud and how to make our website more and more secure so that it can not be managed by others by some bugs as these kind of contents will be of a great help as these kind of things are not available online.
@rikki7663
@rikki7663 5 ай бұрын
@@codewithantonio people will like these types of videos more because simply cloning the website is not that helpful if we don't have a clear idea of "behind the scene"
@mediacreatif
@mediacreatif 5 ай бұрын
Yes because he already made clones of all famous apps 😂😂😂
@Triple._.A
@Triple._.A 5 ай бұрын
This is EXACTLY what I needed! I was getting a little tired of using Clerk, I don't exactly like the idea of using pre-made components that we can't style however we want. I'll be using Next Auth from now on. Feels like I've learned so much from this, thank you as always, really appreciate your videos!
@paulks9771
@paulks9771 5 ай бұрын
These are the basic things which wordpress had like 20 years ago, and now some companies such as clerk are trying to intervene and make such a simple functionality as an exclusive thing, and making cap on users, this is ridiculous.. There must be a standard from next themselves on this, its tiring..
@michaelmiller7264
@michaelmiller7264 2 ай бұрын
I always perceive Clerk as SCAM. Most KZfaqrs mention them because they're paid to promote them. 🤢🤢🤢
@nemeziz_prime
@nemeziz_prime 5 ай бұрын
Man you're magic! I learnt some of NextJS and Auth.js from your Airbnb clone video, but it was a bit complicated for me as a beginner. I always wanted to learn middleware based Auth in NextJS 14 and you just dropped a massive tutorial for the same. You're awesome 🔥
@codewithantonio
@codewithantonio 5 ай бұрын
Enjoy!!
@anonymouseverx
@anonymouseverx 5 ай бұрын
My entire mindset has been changed because of you, Antonio. For this, I can't say thanks enough. I know one thing without any doubt that I can't find this quality of learning and doing anywhere else. Thank you so much, Antonio for everything. ❤
@codewithantonio
@codewithantonio 5 ай бұрын
Thank you for the kind words, I am happy I could be of help!
@teetanrobotics5363
@teetanrobotics5363 5 ай бұрын
Hi Code With Antonio, I just wanted to drop by and say a huge thank you for your recent video on Next Auth V5. Your explanations were clear and concise, making it easy for me to understand and implement in my projects. I'm really interested in learning more about the t3 stack, and I think your expertise would be invaluable in helping me and many others navigate this technology. If you have any plans to create more content on the t3 stack in the future, I would be eagerly looking forward to it! Thanks again for all the amazing content you put out, and keep up the fantastic work!
@codewithantonio
@codewithantonio 5 ай бұрын
Thanks for the suggestion!
@guigabelline
@guigabelline 5 ай бұрын
Congratulations on the videos, I'm following them all. These classes are rich in knowledge and Antonio explains very well. I'm from Brazil and there isn't much content about nextjs here, I even want to share your channel with my friends... Keep creating your legacy, a legion is with you! Congratulations on the work... 😉
@TheAremoh
@TheAremoh 5 ай бұрын
Antonio. Always coming through for me. Thanks for all you do. It's been great learning from you in 2023. Wishing you an even better 2024.
@codewithantonio
@codewithantonio 5 ай бұрын
Thank you very much and wish you all the best as well!
@epatrickification
@epatrickification 4 ай бұрын
I just read your bio on your website. Feels good to be taught by someone who has actually worked in industry. Keep up the good work man!
@codewithantonio
@codewithantonio 4 ай бұрын
Happy to hear that :)
@Tapadar.Monsur
@Tapadar.Monsur 5 ай бұрын
Thanks a lot, Antonio! The quality of your content is unrivalled.
@codewithantonio
@codewithantonio 5 ай бұрын
Thank you very much :)
@Minu_Shalom
@Minu_Shalom 5 ай бұрын
It looks like a very robust tutorial and at first glance it covers all the topics that are extremely important for a real word application. Perhaps the best video on KZfaq so far that deals with its topic?! Thank you for your work!
@Fiilipes
@Fiilipes 5 ай бұрын
8 hours of nextauth is just crazy. Appreciate it very much!!!
@codewithantonio
@codewithantonio 5 ай бұрын
Hope you enjoy it!
@CoryTheSimmons
@CoryTheSimmons 5 ай бұрын
Seems like it might be overkill. I suspect 50% of this tutorial is going to be markup and CSS styles, but it looks like it's worth watching anyway.
@erickandrade154
@erickandrade154 5 ай бұрын
This is absolutely amazing. Thanks Antonio for all this year!
@codewithantonio
@codewithantonio 5 ай бұрын
Thank you for your support! Enjoy!
@ferdinandeke9590
@ferdinandeke9590 5 ай бұрын
i honestly really lack the words to express my gratitude for the value you put out here for us consistently. Thank you so much Antonio. Still looking out to see your teaching using "Nest.js" backend and hooking it up to a "Next.Js" frontend here on your channel, cos somehow things become so easy to understand listening and watching your build ideas. Happy new year and God bless.
@matheus.maiberg
@matheus.maiberg 3 ай бұрын
Makes no sense to use both together. Both are backend framworks. React + Nest.js, this wold make sense.
@dyashwanth9822
@dyashwanth9822 2 ай бұрын
From the bottom of my heart, I would like to say Thank you so much Antonio. Your ability to explain complex topics in such a clear and simple manner is truly appreciated. Looking forward to more of your interesting and advanced tutorials. Once again, thanks a lot ❤.
@antareephasan
@antareephasan 5 ай бұрын
Just starting now. Really thrilled to see, someone is making detailed videos on specific things like auth on youtube for full free. You are real Hero Man, thank you
@codewithantonio
@codewithantonio 5 ай бұрын
Enjoy! ❤️
@unknownheart-x
@unknownheart-x 4 ай бұрын
I've watched 1 hr 30min so far, and I want to say that this is the first time I have seen an honest tutorial without errors or mysterious or ambiguous codes which u dont know from where they come from every minute! Thank u for ur honesty doing this tutorial
@codewithantonio
@codewithantonio 4 ай бұрын
Glad it helped!
@A.Dalton
@A.Dalton 5 ай бұрын
Man, you always drop about the topics i need, love the content
@KramCodes
@KramCodes 5 ай бұрын
This is some top quality content, Antonio! With regards to the user object at 2:56:32, it is undefined because it contains the result of the authorize callback within the authConfig, meaning that it will only ever have a value once during signIn, after which it is undefined. Since the value of the session is set during signIn, you can just use the user object instead of making a request to the database again in the jwt callback. Hope this helps, and thank you for awesome content!
@codewithantonio
@codewithantonio 5 ай бұрын
Thank you for that insight, it definitely confused me. I will explore!
@KramCodes
@KramCodes 5 ай бұрын
And regarding extending the user (3:11:02) and the token (3:13:48), this works: import { User } from "@auth/core/types"; import { JWT } from "@auth/core/jwt"; declare module "@auth/core/types" { interface User { // add your custom fields here } interface Session { user: User; } } declare module "@auth/core/jwt" { interface JWT { // add your custom fields here } } The issue with your implementation of the token custom field is that you are making it optional by adding the '?', meaning it is either "ADMIN" | "USER" | undefined, which does not match what you have in the user.role field (it is not optional). So either make them both optional, or both required, and it should work.
@CaseStudyQB
@CaseStudyQB 4 ай бұрын
@@KramCodes I love how the teacher and students learn together! Antonio is my newest favorite teacher on youtube! Much love!
@true227
@true227 2 ай бұрын
@KramCodes could you to write example of the user object?
@GeniusHawlah
@GeniusHawlah 2 ай бұрын
@@KramCodes On adding my custom fields, the adapter started throwing type error too
@user-yg7cx5qe7j
@user-yg7cx5qe7j 5 ай бұрын
Hello, Antonio It took about 14 hours to complete the tutorial as soon as the video came up! Thanks to you, I think it will be a good start to 2024 Thank you and take care of me in 2024 too!
@codewithantonio
@codewithantonio 5 ай бұрын
wow already! amazing job!!! hope you enjoyed it
@nasko235679
@nasko235679 3 ай бұрын
Antonio I've gotta say after completing your Messenger clone tutorial and moving on to this one your teaching skills have really improved and you're actually taking time to explain small details that are very important. Great stuff man.
@rainchei
@rainchei 2 ай бұрын
I cannot express how much grateful I am to be able to learn so much in one single tutorial. The code you provided not just user friendly but also very elegant to use. Thank's a ton!
@beyondthoughts2740
@beyondthoughts2740 5 ай бұрын
Thank you so much Antonio for all the videos this year ❤. You are raising the skill sets of so many people and it's just incredible. My goal for 2024 is to be almost as good as you 😂. Would be super dope though if you made mobile apps though for 2024 as well( maybe using react native coz I think it's up your alley). Anyways thanks so much and I wish you and everyone here a blessed 2024
@codewithantonio
@codewithantonio 5 ай бұрын
Definitely planning on doing some react native as well! Enjoy the content and continue improving! you can do it!
@heguer87
@heguer87 5 ай бұрын
Hey Antonio, I have completed 75% of the course. Its so crystal clear, that I had to come back and thank you again!! Great work man!
@codewithantonio
@codewithantonio 5 ай бұрын
Thank you very much, hope you are enjoying it :)
@michaelcherneski8479
@michaelcherneski8479 2 ай бұрын
This video is a life saver! Best video on Next Auth v5 I've seen anywhere. Thank you so much!
@lala-wb7gi
@lala-wb7gi 5 ай бұрын
Thank you, Antoni! You have no idea how much this channel is helping me. If anyone is learning Next.js, I highly recommend this channel. I'm looking forward to your next video on ts-node API in Node.js. Like this concept
@codewithantonio
@codewithantonio 5 ай бұрын
Thank you for the kind words and suggestion!
@hadeklte5312
@hadeklte5312 5 ай бұрын
Thanks antonio, I am learning tons of skills from your content. Happy new year🎉
@codewithantonio
@codewithantonio 5 ай бұрын
Happy new year!
@godfreyowino1525
@godfreyowino1525 5 ай бұрын
Thank you, Antonio, for this awesome video on authentication. I always learn a lot from your clear and concise explanations. You make a complex topic easy to understand and implement. I appreciate your dedication and passion for teaching. Keep up the good work! 👍
@codewithantonio
@codewithantonio 5 ай бұрын
Happy to hear that, enjoy the video!
@user-bt1rh9rt8j
@user-bt1rh9rt8j 3 ай бұрын
Hi, Antonio! I successfully completed your guide! Step by step, starting from create-next-app and ending with deployment to Vercel THANK YOU SO MUCH!!!! The best tutorial I've ever seen, especially on authjs (aka next-auth)
@simplatory802
@simplatory802 22 күн бұрын
Hey, could you share the codebase with me? It's paywalled now
@dambujopaulo4204
@dambujopaulo4204 4 ай бұрын
This is the best tutorial I have come across on KZfaq, I had many doubts about Next.js, but now I understand most. I want to be grateful to you and continue your work. I believe that in the near future, I will contribute a lot to your channel so it doesn't stop here and goes beyond borders. Congratulations and success.
@codewithantonio
@codewithantonio 4 ай бұрын
Glad to hear that!
@harshpadelkar8413
@harshpadelkar8413 5 ай бұрын
Thanks Antonio for another great tutorial, it will be a very helpful one
@codewithantonio
@codewithantonio 5 ай бұрын
My pleasure!
@novaardiansyah6254
@novaardiansyah6254 5 ай бұрын
Once again, the outstanding quality and benefits provided by the best person like you, Antonio, are truly appreciated. I feel extremely grateful for your assistance 😍.
@codewithantonio
@codewithantonio 5 ай бұрын
Glad you like my content :)
@chrisalonzo1252
@chrisalonzo1252 5 ай бұрын
Thank you for creating this video! 🙏You did an impeccable job covering all important topics about Next-Auth. Out of all the tutorials that I've gone through, this one is by far the best! I'm looking forward learning from you in the future!👏🏽🔥
@codewithantonio
@codewithantonio 5 ай бұрын
Very happy to hear that :) Thank you for watching!
@kungfinehow
@kungfinehow Ай бұрын
Thank you for starting from the very beginning and not skipping steps assuming everyone is already familiar with them in depth. I picked up things that i had been struggling with in how to properly structure my app that no one else was explaining.
@codewithantonio
@codewithantonio Ай бұрын
Glad you liked it!
@husseinmoqbel7
@husseinmoqbel7 5 ай бұрын
My hero is back ❤❤, no words to describe what u do for us, thanks Antonio ❤
@codewithantonio
@codewithantonio 5 ай бұрын
Enjoy :)
@maimunatwork
@maimunatwork 5 ай бұрын
Hey Antonio, love your tutorials! Can you make a tutorial on 3D effects in Next.js? Been following since the Netflix clone - your tutorials are super helpful. Have an awesome day!
@codewithantonio
@codewithantonio 5 ай бұрын
Thank you for the suggestion!
@martinvalenzuelamagallanes640
@martinvalenzuelamagallanes640 4 ай бұрын
I was struggling with the next-auth v5 because of lack of documentation, this video really helped me! Thanks!
@maka55567
@maka55567 Ай бұрын
2 hours into the video I've already grabbed a whole lot. Thanks for this wonderful quality content.
@bluestar1810
@bluestar1810 Ай бұрын
After spending several hours troubleshooting, I have finally found this tutorial and was able to resolve the issue with my assignment project. Thank you for your help.
@dogcodes
@dogcodes 5 ай бұрын
I wanna say how much this helped me in learning authentication, I've not particularly used nextAuth and used iron-session instead but your tutorial on the use client, server actions, middleware as well as the coding practice and over all knowledge really helped me. Thank you
@Ismail-hd4yz
@Ismail-hd4yz Ай бұрын
From noob now i can handle complete authentication after completing this 😅
@omkarghodake4985
@omkarghodake4985 3 ай бұрын
return null; won't work in the middleware, it gives "No overload matches this call" error
@ZiaCodes
@ZiaCodes 5 ай бұрын
Hey Antonio, Please make a video about next auth new version! I installed next-auth@^5.0.0-beta.5 instead of ^5.0.0-beta.4 now even If I go to ^5.0.0-beta.4 it gives types error! Please make a small video to fix it!
@prepperdon
@prepperdon 4 ай бұрын
Just what I needed to implement credentials login using next-auth v5. Thanks for all you do, great work!
@codewithantonio
@codewithantonio 4 ай бұрын
Glad you like it!
@pontylick5800
@pontylick5800 5 ай бұрын
Was sitting here working on a project and I thought about how useful this would have been to have as I knew it was in the works, and u dropped it. Thank you :)
@codewithantonio
@codewithantonio 5 ай бұрын
Fantastic! Enjoy the video :)
@rotanapisey4953
@rotanapisey4953 4 ай бұрын
Your tutorial is very useful, but I got an error in auth.ts callbacks: { async session({ token , session }) { -- error : Property 'token' does not exist on type '({ session: Session; user: AdapterUser; } | { session: Session; token: JWT; }) & { newSession: any; trigger?: "update" | undefined; }' console.log(token); return session; }, async jwt({ token }) { return token; } }
@duykhanhnguyen9274
@duykhanhnguyen9274 4 ай бұрын
this is library bug, and it still happen in 5.0.0 beta 5
@miksterdam
@miksterdam 4 ай бұрын
What is the solution?
@duykhanhnguyen9274
@duykhanhnguyen9274 4 ай бұрын
@@miksterdam ignore it and wait version beta 6
@rotanapisey4953
@rotanapisey4953 4 ай бұрын
thank you dear@@duykhanhnguyen9274
@miksterdam
@miksterdam 4 ай бұрын
Thought so... thanks@@duykhanhnguyen9274
@vishnu-krishna108
@vishnu-krishna108 4 ай бұрын
Watch at 1.5x - you will save 3 hrs..
@vishnu-krishna108
@vishnu-krishna108 2 ай бұрын
@@sarmadrafique426 I mean if you have good knowledge in coding, then we can watch at 1.5x
@ajaya9541
@ajaya9541 2 ай бұрын
​@@sarmadrafique426i think your slow learner😂
@mleite1
@mleite1 2 ай бұрын
No, thank you. His explanation is at a nice pacing
@muhammaduseram9405
@muhammaduseram9405 Ай бұрын
And learn nothing 🤡
@p-00190
@p-00190 Ай бұрын
I always use 2x speed
@sodiqardianto
@sodiqardianto 2 ай бұрын
damn, 8 hours auth next js, I finished it in 3 weeks. thanks man u mean a lot for us. god bless you
@victorgabrielreis8586
@victorgabrielreis8586 4 ай бұрын
I'm learning so much with this complete tutorial, so much clearly and updated! Keep doing more of this guides :D
@codewithantonio
@codewithantonio 3 ай бұрын
So happy to hear that! ❤️
@kharisovruslan5523
@kharisovruslan5523 9 күн бұрын
i cant catch error.type CredentialsSignin
@PauloRdeOFerraz
@PauloRdeOFerraz 5 күн бұрын
any solution?
@user-xg1jv4rw7e
@user-xg1jv4rw7e 5 күн бұрын
I'm getting callbackrouteerror instead of credentialssignin
@PauloRdeOFerraz
@PauloRdeOFerraz 5 күн бұрын
@@user-xg1jv4rw7e I'm also receiving only callbackrouteerror
@Mukuthasan
@Mukuthasan 4 күн бұрын
catch (error) { if (error instanceof AuthError) { switch (error.type) { case "CallbackRouteError": return { error: "Invalid credentials!" }; default: return { error: "Something went wrong!" }; } } throw error; }
@kharisovruslan5523
@kharisovruslan5523 4 күн бұрын
@@user-xg1jv4rw7e console.log(error.type) return same type callbackrouteerror
@user-lm8tu5hs6q
@user-lm8tu5hs6q 19 күн бұрын
This is the first best video I've come across that touches everything about authentication abd authorization with next js, thank you so much 🎉
@user-sj2pg7tz7i
@user-sj2pg7tz7i 5 ай бұрын
Wow! Thank you so much, Antonio! This is by far the best Next JS tutorial from ones out there!
@codewithantonio
@codewithantonio 5 ай бұрын
Happy to hear that! Enjoy!
@SuperPompey77
@SuperPompey77 5 ай бұрын
This was an excellent tutorial for sure. I found it a little hard but went thru it a second time and it's thanks to your method of teaching and explanations on why you take a particular way to achieve what you are developing 😮, I totally understood it. Thankyou so much for your unbelievable content.
@Lic_JJ
@Lic_JJ 5 ай бұрын
Im so gratefull about this
@codewithantonio
@codewithantonio 5 ай бұрын
Glad I could help!
@AjaySingh-jz8qx
@AjaySingh-jz8qx 5 ай бұрын
That is much much simplified and straight foreward.I Hope that in future there will be more foundational tutorials like that😊😊
@codewithantonio
@codewithantonio 5 ай бұрын
Glad you enjoy these different types of videos :)
@melkhywong7594
@melkhywong7594 5 ай бұрын
literally searching for this the whole day yesterday.. glad you upload at the right time today haha.
@k4f
@k4f 5 ай бұрын
Your style is great. I am learning so much! Thank you 🎉
@user-rr8vu3vi7p
@user-rr8vu3vi7p 10 күн бұрын
I can't tell you how much I'm thankful that you posted such great content. I really appreciated the devotion you put into this tutorial. Thanks again!
@iganic7574
@iganic7574 6 күн бұрын
is you completed this project ?
@Yahya_Umar
@Yahya_Umar 5 ай бұрын
Absolutely! Your expertise is truly impressive and has won me over. I'd like to suggest a topic for your next project - an inventory management system. Given your skills, I believe delving into this area would be highly beneficial and insightful for your audience. Thank you for considering this suggestion.
@djubadjuba
@djubadjuba 4 ай бұрын
The best tutorial so far nextjs 14 and nextauth. Really got in the nitty gritty as the documentation of nextauth is not up to date. I am switching back from Clerk to nextauth as well. Thanks Antonio!
@codewithantonio
@codewithantonio 4 ай бұрын
Glad you liked it!
@Alex.Shalda
@Alex.Shalda 5 ай бұрын
Awesome course! halfway through, very informative, I'm going to use this as a base for my personal projects with React and Next. Thanks!!!!!!
@codewithantonio
@codewithantonio 5 ай бұрын
Glad it was helpful!
@markus_dev_cwb
@markus_dev_cwb 5 ай бұрын
Thank you so much Antonio for all projects and amazing content this year. Happy a new year and we see you in 2024. 🙏
@codewithantonio
@codewithantonio 5 ай бұрын
Happy new year!
@doguarunbayraktar
@doguarunbayraktar 5 ай бұрын
Just watched all 8 hour long video. I am happy that I found your channel! Keep up the good work man! +1
@codewithantonio
@codewithantonio 5 ай бұрын
Thank you for watching the entire thing!
@ashishpatel6078
@ashishpatel6078 5 ай бұрын
What a series it is. I was about to read the next auth js document, then your video arrived. It is very helpful. Thank you ❤❤❤❤
@codewithantonio
@codewithantonio 5 ай бұрын
Hope you enjoy it!
@ashishpatel6078
@ashishpatel6078 5 ай бұрын
@@codewithantonio Yes offcourse sir, 2 hours still left I have also watched 4 projects from your playlist
@oluwaseunladeinde410
@oluwaseunladeinde410 4 ай бұрын
Hi Anthonio. This is simply amazing. I was wondering why you decided to go this route since Clerk was already doing a great job. But I followed along nonetheless. I learned a couple of new nextjs skills along the way. You always drop gems. Thank you for the amazing content you share all the time.
@clickadelic7681
@clickadelic7681 5 ай бұрын
In line with the rest of the comments: Thank You very much, Antonio. This is truely an awesome topic for NextJS starters like me in 2024. I've done the Trello Tutorial and I'm amazed by the code-consistency and quality.
@codewithantonio
@codewithantonio 5 ай бұрын
Thank you for watching :)
@mateusleal1254
@mateusleal1254 5 ай бұрын
Hi Antonio, I have no words to thank you for this incredible content. Thank you for taking the time and sharing your knowledge.
@quegiangson3786
@quegiangson3786 5 ай бұрын
Very big thanks to you ! Happy New Year !
@prabeshnarsinghkunwar1540
@prabeshnarsinghkunwar1540 4 ай бұрын
This is the Course I was looking for!! Now I understand auth from the basics. Thank you
@codewithantonio
@codewithantonio 4 ай бұрын
Glad it was helpful!
@Plaswin
@Plaswin 3 ай бұрын
Awesome as always Antonio, can't thank you enough. You are really helping me in understanding how to better structure my code. With respect to extending JWT, in my case I imported the JWT type from next-auth/jwt and then extended the interface from module next-auth/jwt. The key is importing that interface
@ha1dysh
@ha1dysh 5 ай бұрын
I only watched for half an hour, but I already learned new things for myself like parentheses and underscores for routes and that .next stores a cache that is rebuilt every time, also a nice tip thanks for the guide
@theMrM_
@theMrM_ Ай бұрын
I want to thank you for taking the time to make this video. It has been quite challenging to follow you on speed, I finished your video in 2 days LOL, I tried to follow you implementing all this stuff in my own project and I understood pretty much all you explained, and as you mentioned now, I have my own building block framework for authentication. THANKS!! This video is pure gold, the content is relevant, perfectly explained and the best part... it's not just a "how to", you explain the basics and that's what is most appreciated. PS. There is one small bug in the 2FA but you explained the basis we can tweak is as we need
@codewithantonio
@codewithantonio Ай бұрын
Glad it helped!
@hbfl3x50
@hbfl3x50 5 ай бұрын
Waz waitin for this to drop. It's really a good year to start with. Happy new year 🎉
@codewithantonio
@codewithantonio 5 ай бұрын
Happy new year!!
@Samoniel2910
@Samoniel2910 5 ай бұрын
bro, shadcn/ui is just incredibly well written, I definetely using this style for coding my components
@sexy_audios
@sexy_audios 5 ай бұрын
Hi Antonio, Thank You so much for creating this amazing video. You know exactly what a beginner needs. Can't wait see your other tuts!!!
@codewithantonio
@codewithantonio 5 ай бұрын
Thank you for the kind words, enjoy!
@temitopedavid9508
@temitopedavid9508 5 ай бұрын
Thank you antonio for all you do. May this new year bring you the best because you always have us your viewers in mind!!!!! You are awesome Antonio!
@UdaySagar
@UdaySagar 5 ай бұрын
Well I m building similar thing from last couple of days and you made my work soo easy and know better approaches how do you even know what we wanted !! Thank you so much for this❤ !!
@codewithantonio
@codewithantonio 5 ай бұрын
Glad I could help :)
@fabianpetersen2452
@fabianpetersen2452 4 ай бұрын
Thanks alot for this, i like the speed at which you go through this, i sonetimes fall asleep watching coding tutorials
@somsakprasoetkun193
@somsakprasoetkun193 5 ай бұрын
Thank you for uploading the video. I've been eagerly waiting for your video since the announcement.
@codewithantonio
@codewithantonio 5 ай бұрын
Hope you enjoy it!
@Tato-qz6jw
@Tato-qz6jw 5 ай бұрын
Amazing video, greatly helped me learn about the real world scenarios behind authentication and authorization.
@SeasonedChicken5
@SeasonedChicken5 5 ай бұрын
Love the video. Amazing content. Don't think there's a better NextAuth explanation on the web than this. Was following your guide and came up with a different implementation for the account activation and that was to do it on both the register and login page. Just added a conditional to check if the route had a token or not and then run the appropriate code. Kind of a workaround because I had a slight challenge.
@codewithantonio
@codewithantonio 5 ай бұрын
Glad you enjoyed it!
@Labastidaa
@Labastidaa 5 ай бұрын
This is the best video on Next Auth out there, thanks Antonio!!
@codewithantonio
@codewithantonio 5 ай бұрын
Glad you think so!
@Alton_Obinna
@Alton_Obinna 5 ай бұрын
Excellent stuff Antonio. Loving this full stack Auth Course. It's a deep dive 😊.
@codewithantonio
@codewithantonio 5 ай бұрын
Happy to hear that :)
@dickson710
@dickson710 3 ай бұрын
Nowadays, KZfaq isn't rewarding long videos as much as before, but as always, I continue to watch your videos and learn from them. I leave comments and give thumbs up to show my support for you. You've done a great great job! Keep it up, bro.😁
@Selvakumar-hd6zc
@Selvakumar-hd6zc 5 ай бұрын
Hey Antonio this video is really helpful to build authentication mechanism for my next.js project, your content quality is really great 👍 keep doing this.
@codewithantonio
@codewithantonio 5 ай бұрын
Glad you found it helpful!
@m3phisto92
@m3phisto92 5 ай бұрын
awesome man thank you for this, cant wait for more outstanding content dropping on 2024 and happy ny👏
@codewithantonio
@codewithantonio 5 ай бұрын
Happy new year to you as well! Enjoy the content!
@dineshdhoni7470
@dineshdhoni7470 2 ай бұрын
Honestly loved every minute. Even if it is 8hrs I don't get bored anywhere. Awesomely awesome
@yiannis_p
@yiannis_p 5 ай бұрын
Cant stress enough how valuable this video is! Just an update I found, authjs pushed a pr that updated that fixed the docs for the type augmentation and it matches your solution to the issue as well!
@codewithantonio
@codewithantonio 5 ай бұрын
Thank you for watching, hope you enjoyed!
@1mrnewton
@1mrnewton 5 ай бұрын
Hey man, I wanna say thank you for creating really amazing videos.
@codewithantonio
@codewithantonio 5 ай бұрын
Glad you like them!
@user-to2go8rw6w
@user-to2go8rw6w 5 ай бұрын
Hi Antonio. There is no need to get user from database in jwt callback in auth.ts. User object is available in jwt callback when a user logins. Just pass it along with token as a parameter. Jwt callback is called when a user logins and when session is accessed. User object is populated with data only when a user logins, but when jwt callback is triggered by accessing the session user object is undefined. So it is important to check if user object exists before copying data from it to the token.
@codewithantonio
@codewithantonio 5 ай бұрын
Thanks for clearing that up! Have you tried this with updating the session? For me the session did not update using this method
@user-to2go8rw6w
@user-to2go8rw6w 5 ай бұрын
@@codewithantonio Yes, my session gets updated upon my login. I'd show my code but it looks like I can not paste code here.
@runankaroy6074
@runankaroy6074 5 ай бұрын
Thanks I needed this as I cannot call db from there. An error about edge is showing up.
@angtuananh5209
@angtuananh5209 2 ай бұрын
i use it and success: async session({ session, token, user }) { if (token?.token) { session.token = token.token; } return session; }, async jwt({ token, account, profile, user }) { if (user?.token) { token.token = user.token; } return token; },
@user-xy5od1um3n
@user-xy5od1um3n 4 ай бұрын
Teaching method is awesome and the way your teaching thing alongside the docs are super cool. loved this.
@codewithantonio
@codewithantonio 4 ай бұрын
Thank you for watching! ❤️
@PattyBeautCode
@PattyBeautCode 2 ай бұрын
Amazing walkthrough and excellent explanation ! Thank you💥💥
@falcan7752
@falcan7752 5 ай бұрын
What an awsome project mate 🥳 Happy New Year!!!!!
@codewithantonio
@codewithantonio 5 ай бұрын
Happy new year!
How Object detection works? | Part 1 | YOLO
3:00
AGI Lambda
Рет қаралды 197
Why Is C SO Dangerous?  #programming #coding #lowcode
0:51
Low Level Learning
Рет қаралды 1,9 МЛН
터키아이스크림🇹🇷🍦Turkish ice cream #funny #shorts
00:26
Byungari 병아리언니
Рет қаралды 23 МЛН
Watermelon Cat?! 🙀 #cat #cute #kitten
00:56
Stocat
Рет қаралды 45 МЛН
Podcast: "Warum scheitern Nationen?" | Lanz & Precht
1:01:16
ZDFheute Nachrichten
Рет қаралды 397 М.
Next js 14 Course - Part 5 : Layout & Metadata  بالدارجة
4:31
This VS Code Extension Is 🔥🔥
0:47
Dave Gray
Рет қаралды 1,4 МЛН
What Authentication System Should I Use For My App?
20:41
IAmTimCorey
Рет қаралды 65 М.
How to create a responsive landing page with HTML & CSS #Shorts
0:55
Code With Bubb
Рет қаралды 224 М.
Next.js App Router Authentication (Sessions, Cookies, JWTs)
11:31
Podcast: Wie unsere Sprache entstanden ist | Lanz & Precht
1:01:08
ZDFheute Nachrichten
Рет қаралды 383 М.
NextJS Tutorial - All 12 Concepts You Need to Know
44:38
ByteGrad
Рет қаралды 242 М.
터키아이스크림🇹🇷🍦Turkish ice cream #funny #shorts
00:26
Byungari 병아리언니
Рет қаралды 23 МЛН