Learn The MERN Stack - JWT Authentication

Поділитися
Вставка
  • Опубліковано 26 лис 2024

КОМЕНТАРІ • 339

  • @RRCaddick
    @RRCaddick 2 роки тому +27

    Just wanted to say how much I appreciate the effort you've put in to help fellow developers like myself grasp the concepts that you are covering. You have a way of methodically and calmly explaining something, that just make it make sense. Everything seems to clean and easy after following your tutorials. Keep up the amazing work! You truly are an inspiration to all of us, from where you came from to where you are now

  • @felixmelendez6255
    @felixmelendez6255 2 роки тому +8

    Brad,
    Thanks for the MERN Stack series. You hide the complexity with the way you explain it. You're one of those few teachers that really know how to explain things. I'm eager and can't wait to see how/what you'll be explaining in the front-end. Wish you the best!

  • @rj_nelson_97
    @rj_nelson_97 2 роки тому +28

    Thank you for providing these latest MERN tutorials Brad, they came at a great time. I just finished the code along for this tutorial and the MERN stack tutorial you dropped a few days ago. I did manage to get everything working per the videos specs, but of course, the true learning happens when I'm able to take this code and apply to my own projects - breaking stuff along the way. Thanks again for providing friend. I look forward to the front end portion.

  • @MachiBhasad
    @MachiBhasad 2 роки тому +3

    Me : Searching youtube for JWT authentication, 7 minutes ago.
    Brad : Hold my payload.
    Honestly, superb timing!

  • @tresthegoat
    @tresthegoat 2 роки тому +7

    If you have issues with logging in a user. Make sure you are putting email/password in the body in postman and not params. I spent an hour struggling with this and now you don't have to 😅

  • @shivansh901
    @shivansh901 2 роки тому +17

    As always Brad, you're one of the best teach out there, and Brad has a goal! To educate entire humanity 😇 51:20

  • @erics3860
    @erics3860 2 роки тому +7

    These tutorials have made so many things more clear to me!! You're an excellent teacher, thanks so much.

  • @khalidelgazzar
    @khalidelgazzar 2 роки тому +4

    Simply the level of details in this tutorial is insane!
    Thank you Brad!

  • @alpaca_growing_kit
    @alpaca_growing_kit 2 роки тому +2

    Insane quality on this series so far. Very happy about it.

  • @AdityaSharma-lb9bx
    @AdityaSharma-lb9bx Рік тому

    sending love brad. its 4:46 am, and i will sleep with a thought in mind that im better than yesterday all beacuse of you. learnt alot!!

  • @ishtiakahmed6336
    @ishtiakahmed6336 2 роки тому +31

    This series seems to be a very interesting one. I am already working Node. But I am hopeful to learn few advance features in upcoming videos. Thanks a lot Brad.

    • @RyanSmith-qb6dl
      @RyanSmith-qb6dl 2 роки тому +1

      dude ive been following and learning form bad since 2018! HE NEVER CEASES TO AMAZE ME! Its legit because of him, as to why I'm even successful in this industry...

  • @fadygamilmahrousmasoud5863
    @fadygamilmahrousmasoud5863 2 роки тому +2

    less than 1 hour and a lot of well-organized info, thank you for your efforts!

  • @webtutorials4279
    @webtutorials4279 2 місяці тому

    Brad is the 👑King of explaining Authentication in Node.js Express !

  • @Abdiaspeguero
    @Abdiaspeguero 2 роки тому +5

    This Project is awesome, I love the way you explain things, I feel like I've been coding for years! Thank you so much for your dedication and hard work. Looking foward to become a MERN Stack Developer at the end of this Project.

  • @RameshKumar-mv3jd
    @RameshKumar-mv3jd 2 роки тому +2

    Thanks for another great lesson.
    I'm adapting this to a postgreSQL backend using pg-promise instead of mongoose, and your instructions still help a lot!

  • @m.waseem6616
    @m.waseem6616 2 роки тому +4

    Hello Sir,
    You are absolutely a gem to developers community.
    We for sure admire your work.
    Kindly make tutorial on MEAN stack as well.
    Bundle of thanks in advance.

  • @infotech3180
    @infotech3180 2 роки тому

    watched so many videos on youtube related to the MERN stack and confused
    This one is best to completely understand the whole MERN stack

  • @achmadhendarsyah2244
    @achmadhendarsyah2244 2 роки тому

    Since this tutorial is shows up, i just want to say thanks to your 4 years ago tutorial about nodejs api authentication with jwt. When you explain the schema behind how jwt works, and some other tutorial i followed along, i can write an article about how to create nodejs authentication mechanism as that is a test given by the recruiter. Regarding whether or not the test will pass, it's up to the recruiter. I just want to say thanks that i get helped a lot by your tutorial. God bless you with your passion for teach and help people through this journey.

  • @theredbandicoot
    @theredbandicoot 2 роки тому +1

    *_In _**_26:13_*
    You don't always have to restart the server while changing anything in the .env file. Just add these two lines of code in your package.json script section where you are assigned your nodemon[ "dev": "nodemon -w . -w .env *Your file dir* " ]
    " *_-w ._* " = tells nodemon to watch the files in the current directory
    " *_-w .env_* " = tells nodemon to watch the .env file

    • @addliam
      @addliam 2 роки тому +1

      Very usefull! Thanks

  • @monciego
    @monciego 2 роки тому +13

    Thank you so much for this sir! I commend your dedication and hard work for giving us a wonderful content!

  • @MIDNightPT4
    @MIDNightPT4 Рік тому

    Learning a ton from this by coding along, but pausing when I don't understand a piece of code and taking time to ponder on it

  • @mike19mbsc
    @mike19mbsc 2 роки тому +1

    What a phenomenal tutorial Brad. I was able to follow along and get the whole thing working. I learned so much. It was challenging from start to finish especially once it got to the authorization and authentication. I still have a lot to learn about these concepts. Thank you so much for this!

  • @charbelboughazale3994
    @charbelboughazale3994 2 роки тому

    BRAD WHAT A LEGEND, YOU LITERALLY MADE ME THE DEV I AM TODAY! thank you for every course you made 🔥🔥🔥🔥🔥

  • @SimPwear84
    @SimPwear84 2 роки тому +2

    Amazing tutorial! This cleared a lot of doubts for me regarding JWT and protecting routes. Cant wait for the frontend part.

  • @salmanrafi125
    @salmanrafi125 2 роки тому +1

    I'm trying to learn node and this series seems to be a top notch for learning MERN-STACK❣️❣️ Thanks Brad, for such an amazing content 😍 lots of love & respect❣️

  • @johnddonnet5151
    @johnddonnet5151 2 роки тому +2

    Sadly not in TS, but when I was finding all the correct types and ways to actually use this, I learned a lot, so no problem :)

    • @Devilman91
      @Devilman91 2 роки тому

      It's the best way to learn it!

    • @yessirski7868
      @yessirski7868 8 місяців тому

      How different is it to implement type script in this? I've only messed with it once on a small side project that I never really finished/got started on

  • @ZTF666
    @ZTF666 2 роки тому

    i've been using other techniques while making APIs and by following what you've done , it seemed like i've been overlooking some nice additions ! thank you

  • @PaweStepien92
    @PaweStepien92 Рік тому +1

    I initailly had some problems with export modules. This is no longer working as shown, but "export default..." / "export..." is so it's an easy fix.
    Thanks for helping me include new functionality in my project! :)

  • @You.and.me.678
    @You.and.me.678 2 роки тому

    Thank you very much Brad! One small optimization: since the protect middleware is fetching the user's data from the db then you don't need to refetch it again from the db in the user controller, you could just destructure req.user...

    • @TheMoistestClipsForYou
      @TheMoistestClipsForYou 2 роки тому

      See i was thinking the same thing through the update and delete controllers for the goals. Couldnt you just use the req.user.id instead of searching for the user with req.user.id then using the return users id to compare to the req.user.id. Seems like a duplicate process. The auth middle ware would just kick out no authorization before getting to the controller anyways if the user didn't exist that you are trying to update or delete. Or am I wrong and there is a reason for doing it like this?

  • @banderamusicaltv
    @banderamusicaltv 2 роки тому

    Man this was very difficult for me , but I finally pulled out this half my application crashed like 50 million times, Its incredible how you memorize all of this by Heart Brad, You're Stand Up Guy for turning Gangsters into Scientists! Cheers! Thanks a Lot!

    • @piyushaggarwal5207
      @piyushaggarwal5207 2 роки тому +1

      Actually he has more on his screen. He must have some map as to how to go about his project

    • @vladguzun2522
      @vladguzun2522 Рік тому +1

      @@piyushaggarwal5207 i thought the same , there is so much information

  • @djdisconap
    @djdisconap Рік тому

    Phenomenal video as always Brad. Your blend of building projects and explaining the concepts you are implementing makes learning so much easier. This whole video series so far has been great at teaching me Mongo/Mongoose and reviewing JWT. Thank you for all that you and your team do.

  • @cubedev4838
    @cubedev4838 2 роки тому

    I love this kind of series....seriously love it. Very long time never see brad doing this kind of series....

  • @prahascode7195
    @prahascode7195 2 роки тому

    Thanks for you effort Brod. I am a beginner. From your videos I learned best techniques. I am a fan of your channel.

  • @betterbehappythannot3605
    @betterbehappythannot3605 2 роки тому

    Top video about the topic! You are a gem to the community, Brad!

  • @ruznyahamed874
    @ruznyahamed874 2 роки тому +5

    Thanks brad. Love your work. Simple request, Could you please add typescript with react in the upcoming frontend app?

  • @dejvisekkanal
    @dejvisekkanal 2 роки тому

    Thank you for awesome video Brad! I love your quiet and slow voice 😍

  • @jamesijiwade
    @jamesijiwade 2 роки тому +1

    Great tutorial. I couldn't get my frontend work though. The backend works perfectly. I know I am missing something

  • @vinrata
    @vinrata 2 роки тому

    Just finished this tutorial! I want to make a simple website with users and this tutorial series is perfect!

  • @pandaabinash99
    @pandaabinash99 2 роки тому +12

    Can't wait for the whole project, thanks brad appreciate your efforts. You're awesome❤️

  • @antoniuskonovalov
    @antoniuskonovalov 2 роки тому

    Holy grail, second amazing video tutorial which I completed to my project. My head exploded, but totaly worth it, thank you Brad!

  • @dorukozer3591
    @dorukozer3591 2 роки тому

    This channel is just pure gold

  • @felixomundi1495
    @felixomundi1495 2 роки тому

    Awesome work Brad🙂. You have taught me how to make a basic authentication and protect routes.

  • @mahmutyuksel5746
    @mahmutyuksel5746 2 роки тому +2

    For delete operation, Goal.remove() function should be replaced by Goal.deleteOne({_id: req.params.id)} because if you have two goals, Goal.remove() will delete all goals but should not as we are giving goal id in params.

  • @afaqahmad-ef4ky
    @afaqahmad-ef4ky 11 місяців тому +1

    Quality explanation ❤

  • @domeshow
    @domeshow 2 роки тому

    At 40:01 it was no longer important to look up the user again in the database since he was already in the Token. Thanks Brad

  • @carlossosa123
    @carlossosa123 Рік тому +1

    Learned a lot! Thanks for the content Brad. Great pace and thorough

  • @memosk8code
    @memosk8code 2 роки тому

    you can use curl or wget if you are on linux to send http requests from the terminal, you can set the method and the form data to send

  • @sampark3403
    @sampark3403 2 роки тому

    Thank you for sharing, Brad! You made JWT so simple to learn that looks easy!!!!

  • @rexatuzie1756
    @rexatuzie1756 2 роки тому

    Thank you, I have learnt a lot can't wait for the frontend part 🇳🇬🇳🇬🇳🇬

  • @sandibek13
    @sandibek13 2 роки тому

    thank you very much Brad! These are very helpful series. Waiting for front end part.

  • @chriscastillo8068
    @chriscastillo8068 Рік тому

    Here to juice the algo. These videos are fantastic. Thank you for all you do señior.

  • @mahdisalmanizadegan5595
    @mahdisalmanizadegan5595 2 роки тому

    really comprehensive explanation bro, thank you for new upcoming videos, keep strong as always

  • @riteshgarg3176
    @riteshgarg3176 Рік тому

    At 40:20, you don't have to again find the details of the user from the database as the user details are already in the request, we can directly send the details in the response. res.json(req.user)

  • @dmytrob7336
    @dmytrob7336 2 роки тому

    Looks pretty easy.
    Probably I something missed, but I didn't find anything about Auth strategy in current video.

  • @peterluke9392
    @peterluke9392 2 роки тому

    Thanks Brad for the free content, always appreciated !

  • @sanky6114
    @sanky6114 Рік тому

    26:45
    in the generateToken function pass the id as { _id } ... don't forget to put underscore

  • @user23724
    @user23724 Рік тому

    This is SOOOO awesome, love it, thank you so much for the detailed videos!!!

  • @jellycoding
    @jellycoding 2 роки тому

    It would be nice if other tutorial masters would take this backend and do tutorials building front ends with other techs like Vue etc. (If it would be cool with Brad). Me, I'm going to move on to the next video on this awesome channel.

  • @tonmoyroy2350
    @tonmoyroy2350 2 роки тому

    Excellent video on Authentication. Thanks man❤️

  • @dappinstitute
    @dappinstitute 2 роки тому

    thanks Brad. Got through to the end. Nice work & much appreciated.

  • @RyanSmith-qb6dl
    @RyanSmith-qb6dl 2 роки тому +2

    Dude.... That one part has ME CRACKING UP FOR SOME REASON! Like dont get me wrong! Love Brad 100% and it was more so HOW he said it, but the part where he searches the goals for brad, "welp brads a loser" as its an empty array! LOL!!

  • @madhavkwatra5888
    @madhavkwatra5888 2 роки тому

    Thanks for the great content,
    self talking is just awesome.

  • @alte7580
    @alte7580 2 роки тому

    So usefull, thanks very much. I really needed these video to build my full stack projects

  • @mykalimba
    @mykalimba 2 роки тому +6

    42:42 Since you want to protect all of the endpoints here, could you just do router.use(protect) before all of the router.route(...) calls?

  • @andris1337
    @andris1337 2 роки тому

    very nice video, as someone new to webdev, this video was truly enjoyable and easy to follow :D

  • @bencepollak4258
    @bencepollak4258 2 роки тому

    Legendary video from a legendary person. Thanks for the video, it helped me a lot.

  • @kathleenmccarthy6347
    @kathleenmccarthy6347 2 роки тому

    took me so long but finally finished backend thanks so much

  • @i_am_josh
    @i_am_josh 2 роки тому +4

    Yes. The second part 🏋️🏋️

  • @brencancer
    @brencancer 2 роки тому

    Great Video, got new learnings about proper and practical ways.

  • @chrisstucker1813
    @chrisstucker1813 Рік тому

    EPIC tutorial as usual Brad!

  • @Sujith_sundar
    @Sujith_sundar Рік тому

    just wanna say this is fabulous one thanks a lot thanks @brad

  • @MrYyope15555
    @MrYyope15555 Рік тому

    Thank you so much sir! your tutorials are awesome and really helped me along the way!

  • @t.rinity.
    @t.rinity. 2 роки тому

    I really want to know how to secure the mern stack, this should help. Thank you for the mern stack stuff! 👍🤗❤

  • @bohdankhv
    @bohdankhv 2 роки тому

    much love Brad! thanks for your work !

  • @thedailysenior
    @thedailysenior 2 роки тому

    Brad! You're amazing man, thanks a lot for everything literally

  • @ahmedbaklouti2779
    @ahmedbaklouti2779 Рік тому +1

    Thank you very much Brad! One small optimization: since the protect middleware is fetching the user's data from the db then you don't need to refetch it again from the db in the user controller ?
    We can do this: "const { _id, name, email } = req.user;" ??

  • @arunme3553
    @arunme3553 2 роки тому

    waiting for this video great work Brad

  • @wheeler553
    @wheeler553 Рік тому

    42:56 if an entire route needs auth protection you can just put router.use(protect)

  • @m3awna
    @m3awna 2 роки тому +2

    Hey Brad, I think we should not repeat the code that finds the user at 47:00 , since all user data is in the res object (set in the middleweare)

    • @aldolhitlercondensation1363
      @aldolhitlercondensation1363 2 роки тому

      i'm a little new to this. Could you explain a little bit more? we are only setting the req.user inside the authMiddleware right?
      do middlewares automatically send a res object as well?

    • @m3awna
      @m3awna 2 роки тому +1

      @@aldolhitlercondensation1363 nope it does not it only sends what you telll it to send. my point is that we have all the data in the rs object (loaded in the middleware if I remember correctly) and since it's in the res object, IT IS available throughout the request starting from where we initialise it (in this case the middleware)

  • @robinscavo9139
    @robinscavo9139 2 роки тому

    Exactly what I needed. Thank you.

  • @ahmadrindhoni58
    @ahmadrindhoni58 2 роки тому

    This tutorial is awesome, thank a lot Brad.

  • @roryquarrier7337
    @roryquarrier7337 2 роки тому

    video tutorial 2 DONE! thank you!

  • @BCTAHbKA
    @BCTAHbKA 2 роки тому

    هذا أفضل فيديو على الإطلاق

  • @stephenogaraku1996
    @stephenogaraku1996 10 місяців тому +1

    when you wrote the if statement you used or meaning that if any of the values are true it should run but why is it now requiring all values to be true like an and statement

  • @bastaty8241
    @bastaty8241 2 роки тому

    I really appreciate it, Thank you for all these amazing stuff,
    could you please try to complete this journey with Frontend via React Js and then deploy this project to any host website

  • @pliniojr95
    @pliniojr95 Рік тому

    Once again thanks for this valuable video!

  • @paulthomas1052
    @paulthomas1052 2 роки тому

    Great tutorial - well worth looking at. Cheers !

  • @RicardoSilvaTripcall
    @RicardoSilvaTripcall 2 роки тому

    Amazing work, congrats !!!

  • @FFergussond
    @FFergussond 2 роки тому

    amazing tutorial brad !!! thanks you

  • @briancornielle2991
    @briancornielle2991 2 роки тому

    No homo my friend but I love you , certainly yesterday I completed the previous course and today I found this , thanks!!!

  • @corydali
    @corydali 2 роки тому

    Thank you for sharing this awesome content! helped a lot!!

  • @piyushaggarwal5207
    @piyushaggarwal5207 2 роки тому

    This MERN project is my first and it is going mostly over my head 😂😂 But we will get through this

  • @trigoldyoung3358
    @trigoldyoung3358 2 роки тому

    I like this tutorial, it just resolved my problem.😆

  • @rafaelarias9759
    @rafaelarias9759 2 роки тому +2

    @40:30 , since you already have access to req.user, do you need to call the database again.? It seems you dont have to... you can do res.json(req.user) Thoughts?

  • @comradeyeet3522
    @comradeyeet3522 2 роки тому

    hey brad. well done so far with the series. I would appreciate it however if you could add the video number in the series in the title, and not just in the thumbnail? Thanks! 😊

  • @shinnthantminn9758
    @shinnthantminn9758 2 роки тому

    thank u sir that was very helpfull for my studying

  • @mahesha4505
    @mahesha4505 2 роки тому +1

    Brad, we already fetched user from protected middleware. Why we need to do the same again from controller. We can always refer req.user

  • @jainammehta6093
    @jainammehta6093 2 роки тому

    I think there are a lot of people teaching the same thing but no one is teaching microservices in NodeJS or creating APIs in Golang using GoGin or some framework with auth and all
    Can you please cover up those I think that can attract even more audience

    • @gaurav8113
      @gaurav8113 2 роки тому

      Hey Jainam! Are you a self-taught programmer and build projects to learn? If yes, please reach out to me so that we can discuss some interesting software development roles in latest technologies!

  • @mykalimba
    @mykalimba 2 роки тому +1

    36:39 Question on the protect() middleware: should the code starting at line 27 be inside of an else block, and should it even bother doing the if (!token) check? It looks like you just want to catch the condition where there is no 'Bearer' value in header.authorization. Also, I'd think that if you're concerned whether token exists or not, that check should be made up on line 15.

    • @aminblel5655
      @aminblel5655 2 роки тому

      I think you're right, we do not even need the else I think if we use "return next()"

    • @mykalimba
      @mykalimba 2 роки тому

      @@aminblel5655 I agree, and I personally always prefer to add "return" before calling next() in middleware functions, so it's absolutely clear that code execution ends at that point. (I also add "return" before any res.send(), res.json(), res.status(), etc. etc. for the same reason.)

    • @aminblel5655
      @aminblel5655 2 роки тому

      @@mykalimba exactly, I always use return too to guarantee that it stops there

  • @mattoattacko
    @mattoattacko 2 роки тому

    Great video. Well communicated information!