Learn JWT with the PERN stack by building a Registration/Login system Part 1

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 พ.ย. 2024

ความคิดเห็น • 145

  • @TheQuackLearner
    @TheQuackLearner  4 ปีที่แล้ว +27

    Hey All, to prevent any future confusion, the git repository and the code in the tutorial are a tiny bit different but still work the same way. I provided comments for these two files to show you the difference.
    TL;DR => The payload for the JWT generator was different.
    jwtGenerator.js => github.com/l0609890/pern-jwt-tutorial/blob/master/server/utils/jwtGenerator.js
    dashboard.js => github.com/l0609890/pern-jwt-tutorial/blob/master/server/routes/dashboard.js
    I also notice that I used a post request when accessing our dashboard. This is not right! It should be a get request , because I am simply requesting information. Your application will still work;however I want to make sure you guys get the best practice so don't do what I did.

    • @harishnarasimhan6552
      @harishnarasimhan6552 4 ปีที่แล้ว +13

      Hey, I think you missed out on typing the "next();" code after the line "req.user = payload.user;" in the authorization.js file at 1:12:24, if I'm not mistaken.
      Also, please come up with more tutorials for this stack as this is INSANELY helpful and understandable!! Great tutorial!!

    • @kackupa752
      @kackupa752 4 ปีที่แล้ว +1

      @@harishnarasimhan6552 I have been trying to figure out what my problem was for quite a long time. Thank you for pointing this out!

    • @nikidhan
      @nikidhan 3 ปีที่แล้ว

      i dont know which part i have to change to get request. router.post change to router.get?

    • @ravenhooper9263
      @ravenhooper9263 2 ปีที่แล้ว

      I got eveerything to work, it was the greatest feeling ever. Thanks!

  • @barrytophat
    @barrytophat 4 ปีที่แล้ว +14

    Love the excitement of finding a course that deals with exactly what I need. I've created authentication with this stack before but this is going to be a good refresher

  • @elifdilaraaygun9502
    @elifdilaraaygun9502 3 ปีที่แล้ว +8

    This is really a great approach to have a code review at the beginning, it makes it to be more understandable for sure. Thank you

  • @luisantonioloustaunaubauti7312
    @luisantonioloustaunaubauti7312 3 ปีที่แล้ว +17

    Amazing tutorial. I got stuck at 1:12:46 when you created the authorization middleware. I believe there should be a next() at the bottom so the function continues to run. Once that was fixed it worked fine.

    • @lotusea7964
      @lotusea7964 3 ปีที่แล้ว

      yup that's true

    • @modavikllc9705
      @modavikllc9705 3 ปีที่แล้ว

      Just out of curiosity, just so i can understand this better.. why did it work for Henry during the tutorial w/out next() but not for me/us?

    • @deadlex3711
      @deadlex3711 3 ปีที่แล้ว

      @@modavikllc9705 At 1:21:33, or so, you can see it gets added before he runs the get request

    • @modavikllc9705
      @modavikllc9705 3 ปีที่แล้ว

      @@deadlex3711 ooh yeah i see.. that is one of the formatters he is using?

    • @maj22448
      @maj22448 2 ปีที่แล้ว

      Please where put next () I'm new

  • @FedericoFavaro
    @FedericoFavaro 3 ปีที่แล้ว +1

    Man, your tutorials are awesome. I knew a bit of express and a bit of react and stuff but didn't feel like I could actually build something with these technologies. Then I went through your to-do list and suddenly I realized that I have all the tools I need to be able to make a simple CRUD website, I just never knew how to put it all together. Your tutorials have literally unlocked me, I can now finally build websites for real!

  • @sunderlicious2746
    @sunderlicious2746 ปีที่แล้ว

    Thank you so much for simplifying and explain this! I have gone through many tutorials but after watching this, it all makes sense.

  • @trunojoyo84
    @trunojoyo84 2 ปีที่แล้ว

    such an amazing teacher you are ! Please make another project on PERN stack. Will really help us beginner developers!

  • @adiptabagas1803
    @adiptabagas1803 5 หลายเดือนก่อน

    best pern stack tutorial out there without using an orm of course

    • @onigbindedavid6630
      @onigbindedavid6630 4 หลายเดือนก่อน

      That's why I chose to know this first instead of getting addicted to orm 😆

  • @minercreepmc
    @minercreepmc 2 ปีที่แล้ว

    Thank you so much, you save me when I dive into the Backend with PERN stack, your tutorial is so practical and very easy to understand

  • @jineshpatel007
    @jineshpatel007 4 หลายเดือนก่อน +1

    Really appreciate your videos brother. Thank You So Much. Greetings from India

  • @vkray
    @vkray 4 ปีที่แล้ว +2

    Great tutorial. I need more PERN tutorial like many to many relationship.

  • @saziedhassan3976
    @saziedhassan3976 4 ปีที่แล้ว +6

    Love how you explain each and every step so well man! If you do get the chance and build more complex applications with production level authentication and authorization, that would be amazing! Looking forward to more great content from you, subbed! :D

  • @compteprivefr
    @compteprivefr 4 ปีที่แล้ว +18

    Wow this is awesome! Thanks for the good explanation of each step. I do have a minor complaint: Many tutorials assume that the viewer is too "dumb" to follow more intermediate use-cases and I think this is really unhelpful. If you do know how to incorporate this into a context/state management library and have the time to show that, that would be infinitely more instructive. These are videos after all and we can take as long as we want to understand each step. It would have also been great to see how this works with the exisint todo app you made (like how do you store todos by user? How do you load the correct user's todos once authenticated?)
    There are many scattered tutorials that show bits and pieces of how these things work but too few show how they all fit together. Almost none actually when it comes to this stack.

    • @TheQuackLearner
      @TheQuackLearner  4 ปีที่แล้ว +11

      This is amazing! I typically don't get to see much feedback and idea when teaching so I appreciate you taking the time for giving me a new perspective. Thanks again for the good feedback and idea, I will keep them in mind.

    • @stealtime
      @stealtime 3 ปีที่แล้ว +1

      yes. I totally agree on the point of combining this with the todo app. This is exactly what I would like to do -- be able to login and store each user's todos! does anyone have any tips on how to do this or know of any tutorials that show how to implement this?

  • @loganbramwell5209
    @loganbramwell5209 ปีที่แล้ว

    You are insanely talented at teaching

  • @kurniamassidik5798
    @kurniamassidik5798 2 ปีที่แล้ว

    its been 2 years, but i really thanks bout your content

  • @nikolailchovski9909
    @nikolailchovski9909 3 ปีที่แล้ว

    Perfect example of what I am trying to build with the same exact stack. Thank you very much for creating this video

  • @shaheerzaman620
    @shaheerzaman620 4 ปีที่แล้ว +1

    Enjoyed it.Please do bigger series and go deeper. Like implementing many to many relationship etc.

    • @ignob9591
      @ignob9591 4 ปีที่แล้ว +1

      I think a blogging website on PERN stack might help us to learn alot.

  • @aithrajuniabouty599
    @aithrajuniabouty599 3 ปีที่แล้ว

    i really really really love your tutorial videos because you always explain what the code does but doesn't make me overwhelmed. Thank you so much!!

  • @aditiranjan303
    @aditiranjan303 2 ปีที่แล้ว

    henry your tutorials are awesome.....and very very helpful...pls make more of them

  • @alexkey9372
    @alexkey9372 3 ปีที่แล้ว

    great tutorial! i tried prisma and it really simplifies all the sql queries if you are more familiar with json and mongodb.

  • @kenobi6020
    @kenobi6020 4 ปีที่แล้ว

    Really appreciate your work. All the content everywhere related to authentication is using the MERN stack, I just found this video in the comment section of another video explaining how to do authentication with postgres and express but no react :/ but luckily I ended up here. Thanks a lot! Gonna enjoy this as well as the rest of your videos so I can really master the PERN stack!

  • @leanprogrammer
    @leanprogrammer 2 ปีที่แล้ว

    Great stuff.. Looking forward to learn postgresql..
    Ps: Never store jwt in localstorage... Save it in a cookie instead..

  • @tesfalemhaile8427
    @tesfalemhaile8427 4 ปีที่แล้ว

    Henry, Such an amazing tutorial. The way you explain things is excellent. this is so great! thank you so much. not many programers have the ability to explain the way you did. I was looking such kind of programers, where have you been man!
    keep it up !!!!! 👌❤️.

  • @maximbazadji4895
    @maximbazadji4895 4 ปีที่แล้ว +4

    Thanks a lot, Henry! Can u please make a video about https/cors, Redis, or microservices?

  • @55BLOCKS
    @55BLOCKS 9 หลายเดือนก่อน

    Good job and I like your explanation simple and clear

  • @rankokoturic6633
    @rankokoturic6633 2 ปีที่แล้ว

    Great content, im new to backend development and this video really explains alot

  • @musthasinalam8769
    @musthasinalam8769 4 ปีที่แล้ว

    Great tutorial! Really made jwt with PERN stack totally transparent to me. Thanks!

  • @atishpanday1800
    @atishpanday1800 3 ปีที่แล้ว +1

    Hey, I loved your tutorial, and if you see this, I have a suggestion for you. Please please please, reduce the size of your integrated terminal so that we can see more of the code at once. Half your screen is occupied by the terminal for no reason. It's much easier to follow along when we can see more lines of code at once. Other than that, great explanation. Thanks!

  • @creatorsremose
    @creatorsremose 3 ปีที่แล้ว +2

    Me: "Why is this guy's machine so damn slow?!"
    Video: 43:07
    Me: "Oh, nevermind"

  • @hassanxelamin
    @hassanxelamin 2 ปีที่แล้ว

    if your middleware requests are stuck in a loop on postman, just remember to execute the next(); function so it knows to move on

  • @brohogany9920
    @brohogany9920 3 ปีที่แล้ว

    Thank you very much for posting these videos man.

  • @MusicMan121
    @MusicMan121 4 ปีที่แล้ว +4

    Hello. I read everywhere that the JWT should never be stored in local storage, but in cookies instead. May I ask you why you decided to store it in local storage?

  • @MichaelOReillySD
    @MichaelOReillySD 2 ปีที่แล้ว

    Wrist bellies... lol belly bands? Love the video and the laughs along the way

  • @alokp3357
    @alokp3357 4 ปีที่แล้ว +1

    Very Helpful tutorial, could you please make a tutorial covering S3 redux and postgresql?

  • @eduardocarvalho4232
    @eduardocarvalho4232 3 ปีที่แล้ว

    Very intuitive tutorial, greetings from Portugal :D

  • @wanyi8761
    @wanyi8761 3 ปีที่แล้ว

    for real this is a gem🥳 what a video thank you brother

  • @codr6934
    @codr6934 4 ปีที่แล้ว

    Cool video! Can you say what the main processes are to secure the login and registration like from sql injections?

  • @mer2550
    @mer2550 4 ปีที่แล้ว

    validinfo status missing should be 400 bad gateway for clean. thank you for making tutorials

  • @brotskyCode
    @brotskyCode 3 ปีที่แล้ว

    you are good speker, i am from Ukraine and understand all what you say

  • @blankname44
    @blankname44 4 ปีที่แล้ว +1

    Thanks for the great tutorial bro. I subscribed for the high quality content :D

  • @santinomantineo5275
    @santinomantineo5275 ปีที่แล้ว

    You sir just saved my life!

  • @opensourcerror
    @opensourcerror 4 ปีที่แล้ว +5

    const {Pool} = require('pg') is shorter :)

    • @ignob9591
      @ignob9591 4 ปีที่แล้ว

      cool!! you are right. Just now tried it in db.js

    • @farsikogama6114
      @farsikogama6114 3 ปีที่แล้ว +1

      It is a shorthand which for beginner they might find it hard to understand

  • @badcode8029
    @badcode8029 3 ปีที่แล้ว

    Thanks this is nice tutorial in the internet, the way you explain complicated things more easier to me. I think your pc lagging because your antivirus. haha

  • @kaseabernathy3642
    @kaseabernathy3642 2 ปีที่แล้ว +1

    How many other people came here after a full stack todo tutorial?

  • @Inthedark72
    @Inthedark72 4 ปีที่แล้ว +1

    Thank you for this tutorial, it was really helpful!

  • @joebidenmytime
    @joebidenmytime 3 ปีที่แล้ว

    Thanks for making this! Very helpful and interesting.
    Why in the authorize middleware do you set the payload.user to the req.user? Shouldn't they be the same if they are authorized?
    Also, VSC yelled a lot about both req and payload not containing a user property but I'm like converting this to typescript so that error is a little bit out of the scope of this video

  • @lif5558
    @lif5558 ปีที่แล้ว

    everything is the same with yours until 1.18.39. when I add authorization, it always throw an error such as "email or psw is incorrect". what's wrong with my code?but I do the same things with you? I didn't get what's wrong. but thanks, you explain very well and clearful. I'm thankful to you.

  • @Yaanzz1551
    @Yaanzz1551 4 ปีที่แล้ว

    Really helpfull tutorial, it has way to little thumbs up. Everything works perfect.

  • @rajdeeppurkayastha3287
    @rajdeeppurkayastha3287 3 ปีที่แล้ว

    Please make more content on this stack

  • @panos7853
    @panos7853 4 ปีที่แล้ว +1

    Thanks a lot.Nice explanation too!Keep it up!! You earned a sub

  • @JimmyCheng
    @JimmyCheng 4 ปีที่แล้ว

    great content, best found so far, please keep it up!

  • @lolashepota4050
    @lolashepota4050 2 ปีที่แล้ว

    Perfect tutirial! Well done!

  • @gavincoulson3900
    @gavincoulson3900 3 ปีที่แล้ว

    Great stuff man, keep up the good work.

  • @didymusorotayo7883
    @didymusorotayo7883 3 ปีที่แล้ว

    Thanks for this tutorial man. And you are a really good teacher but quick quest can I understand what this does "(![name, email, password].every(Boolean))"
    I understand every runs through the array and returns true if all conditions are met, what is the Boolean in the every method, is it some sort of callback that is behind the scene?

  • @abirkolin4702
    @abirkolin4702 5 หลายเดือนก่อน

    thanks a lot. learned so muchhh!!!

  • @zoltancaputo9562
    @zoltancaputo9562 ปีที่แล้ว

    Amazing explantion! Tks

  • @SuperVladikk
    @SuperVladikk 3 ปีที่แล้ว

    I want to say thank you and you the master!

  • @rishrauz3469
    @rishrauz3469 ปีที่แล้ว

    great video dude, thankyou

  • @tima8625
    @tima8625 4 ปีที่แล้ว +2

    Hi, I'm not sure why, but I am getting an error "data and salt arguments required" for following the steps up until 52:20 . When I console.log(password) it comes back undefined so the issue is with passing the password from the client side but I don't know how to fix this error. I'd appreciate any advice and help! Thanks.

    • @jamied6835
      @jamied6835 3 ปีที่แล้ว

      Have you resolved this? I’m stuck here too.

  • @RavenGuirao
    @RavenGuirao 2 หลายเดือนก่อน

    I am a bit confused, you send the token as json. but you retrieve it back from header? how is that?

  • @rizkymahendra5732
    @rizkymahendra5732 3 ปีที่แล้ว

    You save my homework, thanks!

  • @inesborges4857
    @inesborges4857 3 ปีที่แล้ว +1

    My route is not working at 44:31 when I try to make a post request. When I open localhost:5000 on browser it says cannot get /. How can I solve this problem?

  • @sadidarhamar4393
    @sadidarhamar4393 3 ปีที่แล้ว

    thank you bro , i expect more content from you :)

  • @parfaitmombo7471
    @parfaitmombo7471 4 ปีที่แล้ว

    Thanks, bro! Nice tutorial.

  • @jacosh3924
    @jacosh3924 3 ปีที่แล้ว

    Really nice guide man

  • @deepmind8260
    @deepmind8260 2 ปีที่แล้ว

    1:05:19 why for me return false? help me...!!. Excellent video

  • @ankush1880
    @ankush1880 3 ปีที่แล้ว

    Great content, thank you so much 🙂

  • @aniketroy2656
    @aniketroy2656 2 ปีที่แล้ว +1

    I get this error in console : Failed to load resource: the server responded with a status of 401 (Unauthorized) when loading any page.
    in post man when I tried doing 44:51, I got 404 not found.
    P.S. i zip downloaded the entire project and installed dependencies (by following beginning part of video) along with creating table and db in my PostgreSQL. Can anyone help ?

  • @joshxone
    @joshxone 4 ปีที่แล้ว +1

    Not generating the JWT token for some reason. Can anyone help?

  • @fathantn
    @fathantn 2 ปีที่แล้ว

    Thank u sir for ur help

  • @m2tdev
    @m2tdev 3 ปีที่แล้ว

    exactly what i wanted

  • @SuperMBARutgers2013
    @SuperMBARutgers2013 ปีที่แล้ว

    "In the client section, it's not too complicated you'll figure it out" then proceeds to chuckle. 🤔🤭

  • @gearoidfly
    @gearoidfly 2 ปีที่แล้ว

    Hi Henry, thank you for the great tutorial, I had a problem ( my doing, your video is flawless) I deleted my table, now my page doesn't work, I'm getting jwt expired and invalid syntax for type uuid: "register", any ideas? thanks in advance, keep up the great work.

  • @blue_0146
    @blue_0146 4 ปีที่แล้ว +2

    Cannot set headers after they are sent to the client, someone with this error????

    • @vryks5385
      @vryks5385 3 ปีที่แล้ว +2

      I know this is a bit late, but incase you never got it or for anyone new to the video in future who also runs into this problem, just delete the two uses of res.json(newUser.rows[0]); as they are not needed. If youre really stuck, youll find that there is an updated code version on hit git (link in the description) that you can compare your code to.

    • @blue_0146
      @blue_0146 3 ปีที่แล้ว

      @@vryks5385 yeah, that was The answer, i really thanks your response, better later than never, thanks to this tutorial i didn't fail The class, thank you very much

  • @sarangcheruvattil5762
    @sarangcheruvattil5762 4 ปีที่แล้ว

    How do you writing query in different lines instead of writing in one line..?

  • @jusuftopic4204
    @jusuftopic4204 3 ปีที่แล้ว

    Hallo. Thank you so much for tutorial. I have one problem. 48:05 When i want to check if user exist, I got this error : Cannot read property 'length' of undefined

  • @ajeetworking
    @ajeetworking 4 ปีที่แล้ว

    great tutorial, thanks for that

  • @eddiechen6389
    @eddiechen6389 4 ปีที่แล้ว

    very well explained!

  • @roselpadilla
    @roselpadilla 4 ปีที่แล้ว

    Thoughts on REPN vs PERN? "REP N" like nginx

  • @shambhaviaggarwal9977
    @shambhaviaggarwal9977 3 ปีที่แล้ว

    I did not get the twotwo reference at 44:17. What was that?

  • @saadahmad1848
    @saadahmad1848 2 ปีที่แล้ว

    My dashboard says status 200, but doesn't print anything ( res.json), what should I do?

  • @brade.silver9852
    @brade.silver9852 3 ปีที่แล้ว

    52:18 still getting a Server Error in POSTMAN and in my terminal am getting an ERROR saying
    null value in column "user_name" of relation "users" violates not-null constraint
    How is it working for him when he has created tables with a Not Null Constraints?

  • @Jonas-qm7ls
    @Jonas-qm7ls 3 ปีที่แล้ว

    When I attempt to post correct token string as the token header nothing happens. However, when I input wrong or empty string as a token, it works. What am I doing wrong?

  • @amarnathlaishram2835
    @amarnathlaishram2835 3 ปีที่แล้ว

    Why my length says cannot read length of undefined

  • @sagarjain4128
    @sagarjain4128 3 ปีที่แล้ว

    What's inside user_id ? At timing 19.19, line number 31?

  • @sagarjain4128
    @sagarjain4128 3 ปีที่แล้ว +1

    kindly give response to your viewers who have questions😅🙃 like me, I am getting server error message in POSTMAN!!

  • @jairuscalvin9769
    @jairuscalvin9769 2 ปีที่แล้ว

    Wow so helpful. can i have a questions?
    I got stuck in dashboard.js. Why on my dashboard cannot response user_id but the status is still 200 omg help me.

  • @ИлијаРадивојевић
    @ИлијаРадивојевић 3 ปีที่แล้ว

    Quality content

  • @muhammadhatifmujahid7832
    @muhammadhatifmujahid7832 2 ปีที่แล้ว

    hey everyone, my req.user is returning as undefined in dashboard.js does anyone have a fix for that?

  • @lasnak6273
    @lasnak6273 4 ปีที่แล้ว +1

    nice tutorial, but unfortunately is not working
    please help me

  • @JoshCodesIRL
    @JoshCodesIRL 3 ปีที่แล้ว

    Hey! Going through the tutorial and trying to use postman on the register route at 44:31 and I'm getting the following error:
    Error: connect ECONNREFUSED 127.0.0.1:5000
    Request Headers
    Content-Type: application/json
    User-Agent: PostmanRuntime/7.26.10
    Accept: */*
    Host: localhost:5000
    Accept-Encoding: gzip, deflate, br
    Connection: keep-alive
    it's also got a note that says it might be missing required headers? Any tips?

  • @ignob9591
    @ignob9591 4 ปีที่แล้ว +1

    Hey Bro! Iam getting an error while installing bcrypt error:" bcrypt@4.0.1 install: `node-pre-gyp install --fallback-to-build`" please let me know where I made the mistake or solution for this error.

    • @ignob9591
      @ignob9591 4 ปีที่แล้ว +2

      Hey Iam using "npm install bcryptjs" instead of " npm install bcrypt" because somewhere I read like both of them do samething.

  • @codr6934
    @codr6934 4 ปีที่แล้ว

    why do we need a jwt token at the registration if it works only 1 hr?

  • @lotusea7964
    @lotusea7964 3 ปีที่แล้ว

    thank you thank you thank you

  • @RebeccaGarcia-h1x
    @RebeccaGarcia-h1x ปีที่แล้ว

    Hello I have a question regarding this code, are you still active and do you mind clarifying some questions that I have ?

  • @patrickkaipainen3301
    @patrickkaipainen3301 3 ปีที่แล้ว

    Does he cover refresh tokens?

  • @shivanshusharma6918
    @shivanshusharma6918 3 ปีที่แล้ว

    Why you didn't use sequelize?

  • @zubairiqbal7047
    @zubairiqbal7047 4 ปีที่แล้ว +1

    bro awesome video but please fix the mike issue

  • @jacobspade739
    @jacobspade739 3 ปีที่แล้ว

    For some reason the jwtToken variable is 'undefined' after this part 'const jwtToken = req.header("token")'. Is anyone else having this problem? The request header is undefined

    • @maj22448
      @maj22448 2 ปีที่แล้ว

      Me. Do you solve problem?

  • @litDevYT
    @litDevYT 3 ปีที่แล้ว

    I wish i had a way to zoom into the video. The words are too small