Node.js API Authentication With JWT

Ғылым және технология

In this overview we will take a look at Node.js and JSON web tokens. I will show you how to create a route to generate a token and use that token to make a request to a protected route.
SPONSOR:
Check out Coding Dojo - www.codingdojo.com/l/yt/tr
CODE: Github Repo With Example
github.com/bradtraversy/node_...
💖 BECOME A PATRON: Show support & get perks!
/ traversymedia
ONE TIME DONATIONS:
www.paypal.me/traversymedia
VISIT MY WEBISTE: Check Out My Udemy Courses
www.traversymedia.com
FOLLOW TRAVERSY MEDIA:
/ traversymedia
/ traversymedia
/ traversymedia
/ discord

Пікірлер: 448

  • @RealToughCandy
    @RealToughCandy6 жыл бұрын

    Thank you Patreon patron for this request and thank you Brad for the tut!

  • @TraversyMedia

    @TraversyMedia

    6 жыл бұрын

    You're very welcome. Great channel by the way, guys check it out

  • @hakhinds
    @hakhinds4 жыл бұрын

    Brad comes along to save the day once again. Honestly bro I don't know how you do it.. 5 days of pain, dozens of videos and dozens of blog posts with unclear non-relevant over engineered information, then you come along and in one fell swoop answer EVERY SINGLE QUESTION I had around the topic in a clear, detailed and swift manner. Thank you brother once again...

  • @desbutler4257
    @desbutler42575 жыл бұрын

    One of the shortest, yet most succinct, useful tutorials I've seen. Brad rocks!

  • @chriszhang3629
    @chriszhang36296 жыл бұрын

    You are not the only one who makes video about JWT, however, you deliver the knowledge in clearest and easiest way. Thank you Brad!

  • @emmanuel4699
    @emmanuel46996 жыл бұрын

    You're a role model to us all. I plan to improve my Patreon participation this coming year. I've grown in confidence as a software dev and have a job now thanks to your videos. Overall my life has seen a lot of improvement as a result of this channel, So thank you and Merry Christmas, Brad.

  • @TraversyMedia

    @TraversyMedia

    6 жыл бұрын

    Thank you, Merry Christmas to you as well :)

  • @Zawodowieec

    @Zawodowieec

    3 жыл бұрын

    Great to hear buddy, hope you're still doin' well :)

  • @nehascorpion
    @nehascorpion3 жыл бұрын

    I always struggle understanding the auth stuff but you have managed to explain it so well. Thank you so much for this tutorial Brad!

  • @nosferathu258
    @nosferathu2585 жыл бұрын

    Reaaaaaly liked the straightforwardness of the tutorial. Implemented it on an existing server in under 40min thanks to your tutorial, keep up the good work :D

  • @thexs1118
    @thexs11186 жыл бұрын

    I was literally just looking up how to do this and this video pops up. This video is a God send lol. Perfect timing.

  • @jaboyak
    @jaboyak6 жыл бұрын

    This is exactly what I needed. Short, sweet, and to the point! Have a great holiday, man!

  • @devonmarantz3324
    @devonmarantz33244 жыл бұрын

    Thank you so much! I’ve been struggling trying to make a protected route with passport for the past month. I couldn’t get it working on a side project I was working on would get super frustrated. I watched this video last night and was able to get it working today! You are a God send! 🙏🏽

  • 4 жыл бұрын

    I came from the MERN series part 9 to learn more about JWT before implement it to the project. And I made it even it is my first time using auth. Thanks, Brad. 👏🏽 Excellent content as always!!

  • @mohammedabdel-baki7253
    @mohammedabdel-baki72532 жыл бұрын

    Clear & to the point without irrelevant information. Thanks Brad you've been helping me so much for almost a year. Cheers 🍻

  • @Somsubhra_Das
    @Somsubhra_Das5 жыл бұрын

    Man I love this tutorial... Other KZreadrs take more than 1 hr to explain just this. But you did it in less than 25 mins..

  • @datapro007
    @datapro0072 жыл бұрын

    Brad, your videos are amazing. Whenever I need to cut through the b.s. and learn something quickly, I come to your channel. This video is an enormous help to me. Thanks!

  • @haroldcrane1595
    @haroldcrane15954 жыл бұрын

    This is the course I've been looking for! Brad, you are the best!!

  • @shashanksshetty9870
    @shashanksshetty98706 жыл бұрын

    Merry Christmas Brad. I wanted this video badly. I was stuck with server side route authentication. Thanks for it and keep the good work going 😊. If possible please make a video using front end application, so that we will get more clear cut idea on this.

  • @Baal93Ash

    @Baal93Ash

    3 жыл бұрын

    yes please, agreed !

  • @danielkimani5431
    @danielkimani54316 жыл бұрын

    I have been waiting for this Brad, I can't thank you enough

  • @GeekMustHave
    @GeekMustHave6 жыл бұрын

    Merry Christmas to you and your family. You have been a big help and inspiration over the last year. I appreciate you and the extreme effort you put into helping people to learn. As always keep broadcasting!!

  • @vidalroland
    @vidalroland6 жыл бұрын

    This is exactly what I was looking for ! Now I know how to make it work. Clear and simple.

  • @edward481
    @edward4812 жыл бұрын

    This is an excellent, no-nonsense, straight-forward explanation of using JWTs to protect API routes, thanks.

  • @keyone415
    @keyone4154 жыл бұрын

    In 2020, with v12.15.0 everything still works exactly the same, I just run through your tutorial. Thank you Brad!

  • @AnonymousDeveloper1

    @AnonymousDeveloper1

    3 жыл бұрын

    That's good, because I'm going to do this tutorial soon.

  • @adriatic123
    @adriatic1234 жыл бұрын

    I needed a refresh about JWT functionalities and this little course was very helpful. Just one mention. Token name that we send with res.header can be anything for example 'auth-token', not just 'Authorizatiion'. And token value in a name-value pair doesn't have to start with 'Bearer' word, it's enough to send token only. In that case we do not have to split result into name 'Bearer' and token value.

  • @arpitagrawal7771
    @arpitagrawal77715 жыл бұрын

    I have seen two of your videos and found this channel very helpful. Thank u :)

  • @Xero1216
    @Xero12166 жыл бұрын

    Thank you, i learned how to use a token to access protected routes. LOVE IT MAN!

  • @muhammadyasirjaved6377
    @muhammadyasirjaved63774 жыл бұрын

    Simple, To the point and concrete. Thanks Buddy!

  • @sabinhertz4145
    @sabinhertz41454 жыл бұрын

    This video was very well done, very informative, and exactly what I was looking for. Thank you, I learned much more than I bargained for.

  • @kirillfishuk5553
    @kirillfishuk55534 жыл бұрын

    Very useful even after 3 years! Thank you Brad!

  • @gulfcoastflyfishing8458
    @gulfcoastflyfishing84586 жыл бұрын

    Doing the lords work. Thanks a bunch, this just helped me through the toughest part of my current project.

  • @BlakeEdwards333
    @BlakeEdwards3336 жыл бұрын

    Best technical videos on youtube, keep up the good work!

  • @2wheelsonline
    @2wheelsonline6 жыл бұрын

    I love watching your tutorials and this is brilliant. Many thanks!

  • @varolo74
    @varolo746 жыл бұрын

    Thank you from Italy, very clear and helpful!

  • @bouidiaabdelrahmene1617
    @bouidiaabdelrahmene16176 жыл бұрын

    I am a huge fan of your tutorials, thank you so much for all these great videos

  • @Tanzeel431
    @Tanzeel4313 жыл бұрын

    Best video on node and jwt so far. Thanks a lot.

  • @kedarnadkarny4718
    @kedarnadkarny47186 жыл бұрын

    I implemented this 100% successfully. Thanks, Brad.

  • @devlondres
    @devlondres5 жыл бұрын

    Thanks for recording this video. Things are a lot clearer now.

  • @ajitsingh4346
    @ajitsingh43465 жыл бұрын

    Brad Bhai (brother in India), thanks a lot for the succinct explanation..always love the explanation in code.

  • @niccubagonoc2153
    @niccubagonoc21535 жыл бұрын

    Perfect! Thank you, Brad! My hero!

  • @billkariri
    @billkariri5 жыл бұрын

    I found this video at the right time, thanks Brad

  • @neoskribe8986
    @neoskribe89866 жыл бұрын

    Thanks Brad, great video, happy holidays.

  • @safwanmohammed7715
    @safwanmohammed77154 жыл бұрын

    Very nice explanation with working code examples

  • @stringedstories823
    @stringedstories8233 жыл бұрын

    This is exactly what i needed, amazing stuff!!!

  • @exapsy
    @exapsy6 жыл бұрын

    I love you. Thanks so much for the video. Crystal Clear in all aspects and I got the exact and even more information I needed.

  • @aldobangun223
    @aldobangun2232 жыл бұрын

    Very clear explanation. Thanks Brad.

  • @guyfrompei
    @guyfrompei5 жыл бұрын

    Very informative and easy to follow. Thanks!

  • @peter11612
    @peter116124 жыл бұрын

    Thanks for the video, clear and easy to understand!

  • @Koyi_supremacist
    @Koyi_supremacist2 жыл бұрын

    october 2021 still works! thx brad

  • @dgdev1024
    @dgdev10246 жыл бұрын

    Thank you for this! I can expand upon this and save a good few lines of code and a dependency with it.

  • @Juzzh
    @Juzzh6 жыл бұрын

    You have some of the best web tutorials I've found yet. I bought also your Udemy MERN stack course, can highly recommend! Thanks.

  • @kazz94
    @kazz945 жыл бұрын

    Your explanation was perfect. Thank you so much!! You have my like and my sub :)

  • @user-re5le7ei3k
    @user-re5le7ei3k3 жыл бұрын

    Awesome! I wish each my question on the Internet had such a clear explanation

  • @NaveenKumarasinghe
    @NaveenKumarasinghe3 жыл бұрын

    Probably the best JWT tutorial on the internet.

  • @alexcharlton2316
    @alexcharlton23166 жыл бұрын

    Great tutorial, clear & simple to follow!

  • @imjustnobody6893
    @imjustnobody68933 жыл бұрын

    now i understand jwt and how to use it... thanks Brad!

  • @tusharmaurya1668
    @tusharmaurya16684 жыл бұрын

    This is exactly what i was looking for!

  • @gmjitendra
    @gmjitendra6 жыл бұрын

    Don't dislike knowledge. Knowledge can be appreciate only. It's not a movie which can be like/dislike. Humble request to the people. Brad I really appreciate your knowledge which improve my understanding and skills. Thank you Brad for this fantastic tut.

  • @jarecturner5602
    @jarecturner56026 жыл бұрын

    Again, you're amazing.

  • @psychonighty3076
    @psychonighty30763 жыл бұрын

    That was a huge amount of help , really easy to understand and you explained it in a calm , quite and nice manner which is really important

  • @chainmaven6026
    @chainmaven60262 жыл бұрын

    thanks traversy, such a legend for me and an inspiration...

  • @rp962
    @rp9625 жыл бұрын

    Well, this is one of the breakthrough demos of oauth present in youtube. Great job man.

  • @markleodionisio2669
    @markleodionisio26693 жыл бұрын

    Thank you sir, youve been such an inspiration for me, get well soon.

  • @LongqiZhang
    @LongqiZhang5 жыл бұрын

    Make things pretty clear. Simple and Clean. Thanks.

  • @divyanianerao5205
    @divyanianerao52052 жыл бұрын

    Woww this cleared my all the doubts. Thank you so much ❤

  • @javidking63
    @javidking632 жыл бұрын

    you saved my day ! again! thank you brad!

  • @nimasoufiloo2626
    @nimasoufiloo26265 жыл бұрын

    Perfect video as always. short and useful.

  • @hardikjhamb229
    @hardikjhamb2293 жыл бұрын

    thanks its really helpful video, my boss was struggling with this authentication for a very long time, but now we will prove that who is the boss

  • @aliahmadi719
    @aliahmadi7192 жыл бұрын

    Very well explained . Thanks so much for this video

  • @akshayshelke5833
    @akshayshelke58335 жыл бұрын

    A very nice tutorial sir , you r a role model for all of us , thank you sir !!

  • @husniddinqurbonboyev2634
    @husniddinqurbonboyev26345 жыл бұрын

    Thanks Brad for such a useful content!

  • @Dinesh-ql1ok
    @Dinesh-ql1ok5 жыл бұрын

    Congrats 🎊 Brad for 500k subscribers ✌️👍👏🎈🎁💐

  • @adamcrap
    @adamcrap5 жыл бұрын

    Awesome stuff brad as always!

  • @nikospx812
    @nikospx8123 жыл бұрын

    Thanks for all! Nice videos, you are the best!!!

  • @fojupanda1728
    @fojupanda17283 жыл бұрын

    Thank you so much.. So clear and lucid explanation

  • @andrewfong101
    @andrewfong1016 жыл бұрын

    Once again, thank you for your awesomely tutorial

  • @anag2125
    @anag21254 жыл бұрын

    Thank you very much!! Just used it and worked perfectly! :D

  • @rgh1986aka199
    @rgh1986aka1996 жыл бұрын

    Awesome tutorial. Thanks for making it for us.

  • @rupinderkaur304
    @rupinderkaur3044 жыл бұрын

    Sir really awesome video. Made me understand completely about jwt

  • @Huongpham-gz1vm
    @Huongpham-gz1vm5 жыл бұрын

    This turorial was help me solve my problem. Thanks!

  • @belscode3941
    @belscode39414 жыл бұрын

    Thank you brad for this awseome tutorial , just a note we should send only the id in the payload as far as read in articles

  • @sirruffalot
    @sirruffalot4 жыл бұрын

    Thank you great tutorial. Helped me a lot.

  • @tigranavagyan5922
    @tigranavagyan59222 жыл бұрын

    Thank you SO MUCH for your lesson. It really helped me a lot!!!

  • @norrisdamianus5250
    @norrisdamianus52505 жыл бұрын

    very good, simple and clear tutorial

  • @jondavies2843
    @jondavies28433 жыл бұрын

    Fantastic, and well explained.

  • @higherpurpose1212
    @higherpurpose12122 жыл бұрын

    Great post Brad, thanks!

  • @JohnMcCullough97
    @JohnMcCullough976 жыл бұрын

    Great video. Succinct and informative. Thanks. Merry Christmas.

  • @aparvaiz1999
    @aparvaiz19995 жыл бұрын

    Brilliant video Brad! Thanks a lot!

  • @spirytusrektus
    @spirytusrektus6 жыл бұрын

    Loved this one. Thanks for the video :)

  • @gicharu
    @gicharu4 жыл бұрын

    Thank you so much for your tutorials. They are very informative. You are an inspiration to us all. Could you do a refresher for the PostresSQL tut?

  • @tushargoyal8262
    @tushargoyal82623 жыл бұрын

    Amazing code-along, thank you!

  • @eqdatshit8406
    @eqdatshit84066 жыл бұрын

    Just what i needed !

  • @Etronic101
    @Etronic1015 жыл бұрын

    Thanks !it really helpful beside simplification!

  • @barjosa31blogspot83
    @barjosa31blogspot836 жыл бұрын

    Helpful! Thanks!

  • @AnselmoBattisti
    @AnselmoBattisti6 жыл бұрын

    Thanks for the tutorial, it was very helpful

  • @mustafakosmaz178
    @mustafakosmaz178 Жыл бұрын

    good and short explanation! thanks

  • @alexn2566
    @alexn25665 жыл бұрын

    You could have handled the JWT verification in the middleware, to keep responsibilities nicely separated. Other than that, nice tutorial :)

  • @morphman86

    @morphman86

    3 жыл бұрын

    That also gives the nice advantage that the token itself doesn't get passed on the request object twice (req.token = bearerToken is no longer required). May not seem like much, but if you ever need to scale an application, even a few bytes of data per request can save a lot in the long run.

  • @martinmendez695

    @martinmendez695

    3 жыл бұрын

    Yes. The authentication should be done at the middleware. What Brad did works better for authorization once in the route handle.

  • @ripichipi
    @ripichipi6 жыл бұрын

    Really nice as always!!!

  • @srcmake
    @srcmake6 жыл бұрын

    Amazing video, thanks for sharing.

  • @kds-2049
    @kds-20493 жыл бұрын

    great simple explanation. thanks

  • @kps2642
    @kps26426 жыл бұрын

    thanks a lot man, helped me learn jwt :)

  • @gk0r
    @gk0r5 жыл бұрын

    Excellent video. Short and to the point. Thank you for not building a client and using PostMan instead.

  • @yadavlokesh
    @yadavlokesh5 жыл бұрын

    Ton of thanks Brad for putting up this tutorial. it's really easy to follow and understand the every bit of code. Thank you again. Just a quick question, did you put up any tutorial for Login / registration user flow? If yes, please share link to the same.

Келесі