Database Session Authentication with Prisma & NextJS App Directory

Поделиться
HTML-код
  • Опубликовано: 28 авг 2024
  • In-depth tutorial on Next-Auth login authentication - you will learn how to protect your pages with authentication using advanced strategies like NextAuth database sessions and Prisma client extensions. Plus, passwordless login for a seamless user experience! 🔥
    🔑 Key Takeaways
    1. How to set up NextJS app in 2 minutes
    2. How to set up a new database and Prisma query layer
    3. How to set up NextAuth session strategy for secure and effective session management.
    4. How to create a Prisma client extension to get the current user from the session.
    5. How to set up passwordless login for a frictionless user experience.
    🔗 Resources:
    - Prisma: www.prisma.io/...
    - Postgres PSQL: www.postgresgu...
    - NextAuth.js: next-auth.js.o...
    - Create Next App: nextjs.org/doc...
    - Source code: github.com/tay...
    Don't forget to like, share, and subscribe for more in-depth tutorials! Your feedback is essential to improve these videos; please leave your comments below 🙏
    #NextJS #NextJS13 #Authentication #ServerSideRendering #Prisma #WebDevelopment #Postgresql #Login

Комментарии • 36

  • @baqirnekfardev
    @baqirnekfardev 19 дней назад +1

    Amazing content! so cool and straight forward to the topic
    liked it 💗

  • @sohambhikadiya3346
    @sohambhikadiya3346 Месяц назад +1

    I like this speedy tutorial, also it's good as you haven't mentioned the word 'beginner'
    But I am not sure why people is expecting it to be beginner friendly
    Also no worries, I could easily read the code :)

  • @runankaroy6074
    @runankaroy6074 7 месяцев назад +7

    Feedback: Try to narrate why you're doing, and not what you are doing. I can just read the code if I need the "what".

    • @taylorlindoresreeves
      @taylorlindoresreeves  7 месяцев назад +3

      I appreciate the feedback, will take this on board for future videos. Thank you.

    • @blessingjohnson1835
      @blessingjohnson1835 6 месяцев назад

      I totally agree with this, actually explaining what the code does is very important.

  • @user-zu3vr8vq3l
    @user-zu3vr8vq3l Месяц назад

    Where can I get the callback url after submitting an email?

  • @howtocode2296
    @howtocode2296 3 дня назад

    when we get a session within the layout, is it considered best practice? is there any security issue there? Layout not able to change the state i think.

    • @taylorlindoresreeves
      @taylorlindoresreeves  3 дня назад

      Possibly yes. I've since learned it's probably not best practice to include the session in the layout. Would recommend using it in page or Server Component instead.

    • @howtocode2296
      @howtocode2296 3 дня назад

      @@taylorlindoresreeves I'm still confused on how to integrate database session with nextjs middleware. I found that we can do the session strategy jwt (using the next auth library, but need to split authConfig), but if we do this still we are using jwt not database. What's so far i found that according to the official nextjs doc about authentication, we can use the session management library. But I'm still not knowing how to do this with middleware. Perhaps we can share this info

    • @taylorlindoresreeves
      @taylorlindoresreeves  3 дня назад +1

      ​​⁠there are only 3 ways you can get the database sessions working with middleware:
      1. You need to set up an edge compatible database. Personally I've tried setting Prisma up but it's a hassle, I've always resorted to the following;
      2. Set up a redirect based on the cookie existing in the middleware. You are able to use nextjs cookies() method to get the cookie, and use that as the session. In other words, redirect if the cookie exists. However, production cookies are prefixed with Secure__ so you need to account for that in a production environment.
      3. Use nextJS redirect method on the layout or page level, effectively redirecting when the session doesn't exist.
      Only #1 wraps the middleware in auth(). #2 is just standard nextJS middleware. And #3 does not require middleware. Hope this helps!

    • @howtocode2296
      @howtocode2296 3 дня назад

      @@taylorlindoresreeves yeah might be good to do 1# and 2# i think.

  • @huseyinlora
    @huseyinlora 5 месяцев назад +2

    BROOOO ZOOOM ON THIS FKN EDITORR WE CANNOT SEE ANYTHING

  • @harithmu
    @harithmu 8 месяцев назад

    amazing video!

  • @AkashLayal
    @AkashLayal 8 месяцев назад

    Great video ❤

  • @mirkoucho
    @mirkoucho 8 месяцев назад +1

    the content is good but unpleasant to watch too many cuts and little time to take the time to code at the same time because you do not leave time to do what you do at the same time you go directly to the next, you should leave small breaks and that we see less that you cut all your sequences one after another on your editing program, but thank you for the content it is very useful.

    • @taylorlindoresreeves
      @taylorlindoresreeves  8 месяцев назад

      Noted 📝 would you prefer it if it was unedited (or at least edited minimally so that I remove my filler words 😅)?

    • @mirkoucho
      @mirkoucho 8 месяцев назад +1

      @@taylorlindoresreeves just add some little silences, all's so fast, sometimes I want some breath ;)

    • @markmuthii
      @markmuthii 8 месяцев назад +2

      Huh? No one on RUclips will have silences to allow for the person watching to catch up, because people consume at different speeds. While you want some pauses, others are watching the same thing at 2X.
      Use the pause button mate. Or watch at 0.5X speed.

    • @runankaroy6074
      @runankaroy6074 7 месяцев назад

      @@markmuthii chill out. It's called pacing in the video editing world. Being fast paced isn't the issue, but the delivery is.

  • @nightrider1413
    @nightrider1413 6 месяцев назад

    Really nice video! What font is that? MonoLisa?

  • @murtadanazar
    @murtadanazar 9 месяцев назад

    Hello my friend, what is the name of the theme you use in your terminal?

    • @taylorlindoresreeves
      @taylorlindoresreeves  9 месяцев назад +1

      Hey man, the theme is called Dracula Pro 👍

    • @murtadanazar
      @murtadanazar 9 месяцев назад

      @@taylorlindoresreeves Thank you very much

  • @raselhossain8855
    @raselhossain8855 8 месяцев назад

    is Authjs and Next-Auth same?

    • @taylorlindoresreeves
      @taylorlindoresreeves  8 месяцев назад

      Yeah that’s correct, AuthJS is the latest version of next-auth.

  • @user-ck6yl6qb2g
    @user-ck6yl6qb2g 5 месяцев назад +2

    bad tutorial.
    I found it hard to follow you, it was unclear and unstructured

  • @jasondamico_webdev
    @jasondamico_webdev 4 месяца назад +1

    Bro. I appreciate your knowledge, but read the room. How do you expect people to follow what you are doing when you are not only making fast cuts, but completely skipping entire code creations steps that are vital to finish the project. You also never acknowledged when you made mistakes and did not show your changes to the code when you did.
    Constructive criticism: SLOOOOWWWWW DOOWWWWWWNNNNN. Make part 1 and part 2 if you need to. :)

    • @taylorlindoresreeves
      @taylorlindoresreeves  2 месяца назад +5

      Good point, thanks for the feedback. I am going to do more on-the-fly coding and fixing - my concern is it bores people watching me debug, which is why I try and do things quickly. But a lot of feedback I am reading just now is similar to this, so I will do more full-length, less edited videos where I go through the whole process and don't re-use any code or components.

  • @JirayuVijjakajohn
    @JirayuVijjakajohn 9 месяцев назад

    I cant see any code

    • @taylorlindoresreeves
      @taylorlindoresreeves  9 месяцев назад

      Hey! The coding begins around 2 minutes into the video 😊

    • @JirayuVijjakajohn
      @JirayuVijjakajohn 9 месяцев назад

      I meant it was too small

    • @taylorlindoresreeves
      @taylorlindoresreeves  9 месяцев назад +1

      Okay noted 📝 I will make sure to update the zoom in for future videos so the code is larger on screen. Thanks for the feedback.