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

Поделиться
HTML-код
  • Опубликовано: 27 ноя 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

  • @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!

  • @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

  • @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 😆

  • @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.

  • @vkray
    @vkray 4 года назад +2

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

  • @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

  • @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

  • @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

  • @trunojoyo84
    @trunojoyo84 2 года назад

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

  • @loganbramwell5209
    @loganbramwell5209 Год назад

    You are insanely talented at teaching

  • @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 4 года назад +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?

  • @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!!

  • @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.

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

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

  • @musthasinalam8769
    @musthasinalam8769 4 года назад

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

  • @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!

  • @aditiranjan303
    @aditiranjan303 2 года назад

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

  • @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.

  • @kurniamassidik5798
    @kurniamassidik5798 2 года назад

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

  • @brohogany9920
    @brohogany9920 3 года назад

    Thank you very much for posting these videos man.

  • @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 !!!!! 👌❤️.

  • @rankokoturic6633
    @rankokoturic6633 2 года назад

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

  • @wanyi8761
    @wanyi8761 3 года назад

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

  • @eduardocarvalho4232
    @eduardocarvalho4232 3 года назад

    Very intuitive tutorial, greetings from Portugal :D

  • @blankname44
    @blankname44 4 года назад +1

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

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

    Good job and I like your explanation simple and clear

  • @Inthedark72
    @Inthedark72 4 года назад +1

    Thank you for this tutorial, it was really helpful!

  • @gavincoulson3900
    @gavincoulson3900 3 года назад

    Great stuff man, keep up the good work.

  • @JimmyCheng
    @JimmyCheng 4 года назад

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

  • @maximbazadji4895
    @maximbazadji4895 4 года назад +4

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

  • @lolashepota4050
    @lolashepota4050 2 года назад

    Perfect tutirial! Well done!

  • @panos7853
    @panos7853 4 года назад +1

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

  • @SuperVladikk
    @SuperVladikk 3 года назад

    I want to say thank you and you the master!

  • @creatorsremose
    @creatorsremose 3 года назад +2

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

  • @santinomantineo5275
    @santinomantineo5275 Год назад

    You sir just saved my life!

  • @MichaelOReillySD
    @MichaelOReillySD 2 года назад

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

  • @zoltancaputo9562
    @zoltancaputo9562 Год назад

    Amazing explantion! Tks

  • @leanprogrammer
    @leanprogrammer 2 года назад

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

  • @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?

  • @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

  • @Yaanzz1551
    @Yaanzz1551 4 года назад

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

  • @sadidarhamar4393
    @sadidarhamar4393 3 года назад

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

  • @brotskyCode
    @brotskyCode 3 года назад

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

  • @rishrauz3469
    @rishrauz3469 Год назад

    great video dude, thankyou

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

    thanks a lot. learned so muchhh!!!

  • @rizkymahendra5732
    @rizkymahendra5732 3 года назад

    You save my homework, thanks!

  • @parfaitmombo7471
    @parfaitmombo7471 4 года назад

    Thanks, bro! Nice tutorial.

  • @alokp3357
    @alokp3357 4 года назад +1

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

  • @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

  • @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.

  • @jacosh3924
    @jacosh3924 3 года назад

    Really nice guide man

  • @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

  • @ankush1880
    @ankush1880 3 года назад

    Great content, thank you so much 🙂

  • @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!

  • @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?

  • @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.

  • @eddiechen6389
    @eddiechen6389 4 года назад

    very well explained!

  • @m2tdev
    @m2tdev 3 года назад

    exactly what i wanted

  • @ajeetworking
    @ajeetworking 4 года назад

    great tutorial, thanks for that

  • @codr6934
    @codr6934 4 года назад

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

  • @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

  • @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 ?

  • @kaseabernathy3642
    @kaseabernathy3642 2 года назад +1

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

  • @mer2550
    @mer2550 4 года назад

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

  • @RavenGuirao
    @RavenGuirao 2 месяца назад

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

  • @ИлијаРадивојевић
    @ИлијаРадивојевић 3 года назад

    Quality content

  • @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?

  • @fathantn
    @fathantn 2 года назад

    Thank u sir for ur help

  • @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?

  • @joshxone
    @joshxone 4 года назад +1

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

  • @rajdeeppurkayastha3287
    @rajdeeppurkayastha3287 3 года назад

    Please make more content on this stack

  • @saadahmad1848
    @saadahmad1848 2 года назад

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

  • @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?

  • @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?

  • @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.

  • @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.

  • @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

  • @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?

  • @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

  • @lotusea7964
    @lotusea7964 3 года назад

    thank you thank you thank you

  • @muhammadhatifmujahid7832
    @muhammadhatifmujahid7832 2 года назад

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

  • @kiattisakphanphu3823
    @kiattisakphanphu3823 4 года назад

    thank you sir

  • @sagarjain4128
    @sagarjain4128 3 года назад

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

  • @deepmind8260
    @deepmind8260 2 года назад

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

  • @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.

  • @roselpadilla
    @roselpadilla 4 года назад

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

  • @sarangcheruvattil5762
    @sarangcheruvattil5762 4 года назад

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

  • @SuperMBARutgers2013
    @SuperMBARutgers2013 Год назад

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

  • @sagarjain4128
    @sagarjain4128 3 года назад +1

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

  • @shambhaviaggarwal9977
    @shambhaviaggarwal9977 3 года назад

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

  • @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 ?

  • @lasnak6273
    @lasnak6273 4 года назад +1

    nice tutorial, but unfortunately is not working
    please help me

  • @melissatermin5551
    @melissatermin5551 3 года назад +1

    does any one having problem with the authorization.js part ?

    • @gearoidfly
      @gearoidfly 2 года назад

      I am now my token is expired

  • @amarnathlaishram2835
    @amarnathlaishram2835 3 года назад

    Why my length says cannot read length of undefined

  • @litDevYT
    @litDevYT 3 года назад

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

  • @Youngtimmyy
    @Youngtimmyy 3 года назад

    does anybody know how setup postman because I keep trying to test mine on postman but it is not working

  • @juiceontheloose123
    @juiceontheloose123 2 года назад

    thanks!!!!