Node.js API Authentication With JWT

  Рет қаралды 555,382

Traversy Media

Traversy Media

6 жыл бұрын

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
@RealToughCandy 6 жыл бұрын
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
@hakhinds 4 жыл бұрын
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
@desbutler4257 5 жыл бұрын
One of the shortest, yet most succinct, useful tutorials I've seen. Brad rocks!
@nehascorpion
@nehascorpion 4 жыл бұрын
I always struggle understanding the auth stuff but you have managed to explain it so well. Thank you so much for this tutorial Brad!
@emmanuel4699
@emmanuel4699 6 жыл бұрын
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 :)
@chriszhang3629
@chriszhang3629 6 жыл бұрын
You are not the only one who makes video about JWT, however, you deliver the knowledge in clearest and easiest way. Thank you Brad!
@nosferathu258
@nosferathu258 5 жыл бұрын
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
@devonmarantz3324
@devonmarantz3324 4 жыл бұрын
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! 🙏🏽
@shashanksshetty9870
@shashanksshetty9870 6 жыл бұрын
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 !
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!!
@jaboyak
@jaboyak 6 жыл бұрын
This is exactly what I needed. Short, sweet, and to the point! Have a great holiday, man!
@thexs1118
@thexs1118 6 жыл бұрын
I was literally just looking up how to do this and this video pops up. This video is a God send lol. Perfect timing.
@datapro007
@datapro007 2 жыл бұрын
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!
@mohammedabdel-baki7253
@mohammedabdel-baki7253 2 жыл бұрын
Clear & to the point without irrelevant information. Thanks Brad you've been helping me so much for almost a year. Cheers 🍻
@GeekMustHave
@GeekMustHave 6 жыл бұрын
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!!
@Somsubhra_Das
@Somsubhra_Das 5 жыл бұрын
Man I love this tutorial... Other KZfaqrs take more than 1 hr to explain just this. But you did it in less than 25 mins..
@haroldcrane1595
@haroldcrane1595 4 жыл бұрын
This is the course I've been looking for! Brad, you are the best!!
@edward481
@edward481 2 жыл бұрын
This is an excellent, no-nonsense, straight-forward explanation of using JWTs to protect API routes, thanks.
@arpitagrawal7771
@arpitagrawal7771 5 жыл бұрын
I have seen two of your videos and found this channel very helpful. Thank u :)
@vidalroland
@vidalroland 6 жыл бұрын
This is exactly what I was looking for ! Now I know how to make it work. Clear and simple.
@danielkimani5431
@danielkimani5431 6 жыл бұрын
I have been waiting for this Brad, I can't thank you enough
@adriatic123
@adriatic123 4 жыл бұрын
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.
@keyone415
@keyone415 4 жыл бұрын
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.
@Xero1216
@Xero1216 6 жыл бұрын
Thank you, i learned how to use a token to access protected routes. LOVE IT MAN!
@neoskribe8986
@neoskribe8986 6 жыл бұрын
Thanks Brad, great video, happy holidays.
@sabinhertz4145
@sabinhertz4145 4 жыл бұрын
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.
@gulfcoastflyfishing8458
@gulfcoastflyfishing8458 6 жыл бұрын
Doing the lords work. Thanks a bunch, this just helped me through the toughest part of my current project.
@BlakeEdwards333
@BlakeEdwards333 6 жыл бұрын
Best technical videos on youtube, keep up the good work!
@2wheelsonline
@2wheelsonline 6 жыл бұрын
I love watching your tutorials and this is brilliant. Many thanks!
@muhammadyasirjaved6377
@muhammadyasirjaved6377 4 жыл бұрын
Simple, To the point and concrete. Thanks Buddy!
@bouidiaabdelrahmene1617
@bouidiaabdelrahmene1617 6 жыл бұрын
I am a huge fan of your tutorials, thank you so much for all these great videos
@ajit555db
@ajit555db 5 жыл бұрын
Brad Bhai (brother in India), thanks a lot for the succinct explanation..always love the explanation in code.
@kirillfishuk5553
@kirillfishuk5553 4 жыл бұрын
Very useful even after 3 years! Thank you Brad!
@Juzzh
@Juzzh 6 жыл бұрын
You have some of the best web tutorials I've found yet. I bought also your Udemy MERN stack course, can highly recommend! Thanks.
@user-re5le7ei3k
@user-re5le7ei3k 3 жыл бұрын
Awesome! I wish each my question on the Internet had such a clear explanation
@varolo74
@varolo74 6 жыл бұрын
Thank you from Italy, very clear and helpful!
@niccubagonoc2153
@niccubagonoc2153 6 жыл бұрын
Perfect! Thank you, Brad! My hero!
@psychonighty3076
@psychonighty3076 3 жыл бұрын
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
@devlondres
@devlondres 5 жыл бұрын
Thanks for recording this video. Things are a lot clearer now.
@dgdev1024
@dgdev1024 6 жыл бұрын
Thank you for this! I can expand upon this and save a good few lines of code and a dependency with it.
@alexcharlton2316
@alexcharlton2316 6 жыл бұрын
Great tutorial, clear & simple to follow!
@billkariri
@billkariri 5 жыл бұрын
I found this video at the right time, thanks Brad
@exapsy
@exapsy 6 жыл бұрын
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.
@kazz94
@kazz94 5 жыл бұрын
Your explanation was perfect. Thank you so much!! You have my like and my sub :)
@peter11612
@peter11612 4 жыл бұрын
Thanks for the video, clear and easy to understand!
@guyfrompei
@guyfrompei 5 жыл бұрын
Very informative and easy to follow. Thanks!
@kedarnadkarny4718
@kedarnadkarny4718 6 жыл бұрын
I implemented this 100% successfully. Thanks, Brad.
@NaveenKumarasinghe
@NaveenKumarasinghe 3 жыл бұрын
Probably the best JWT tutorial on the internet.
@alexn2566
@alexn2566 5 жыл бұрын
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.
@stringedstories823
@stringedstories823 3 жыл бұрын
This is exactly what i needed, amazing stuff!!!
@akshayshelke5833
@akshayshelke5833 5 жыл бұрын
A very nice tutorial sir , you r a role model for all of us , thank you sir !!
@yadavlokesh
@yadavlokesh 5 жыл бұрын
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.
@markleodionisio2669
@markleodionisio2669 4 жыл бұрын
Thank you sir, youve been such an inspiration for me, get well soon.
@gicharu
@gicharu 4 жыл бұрын
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?
@belscode3941
@belscode3941 4 жыл бұрын
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
@LongqiZhang
@LongqiZhang 5 жыл бұрын
Make things pretty clear. Simple and Clean. Thanks.
@sirruffalot
@sirruffalot 4 жыл бұрын
Thank you great tutorial. Helped me a lot.
@Tanzeel431
@Tanzeel431 3 жыл бұрын
Best video on node and jwt so far. Thanks a lot.
@adamcrap
@adamcrap 5 жыл бұрын
Awesome stuff brad as always!
@rp962
@rp962 5 жыл бұрын
Well, this is one of the breakthrough demos of oauth present in youtube. Great job man.
@husniddinqurbonboyev2634
@husniddinqurbonboyev2634 5 жыл бұрын
Thanks Brad for such a useful content!
@jarecturner5602
@jarecturner5602 6 жыл бұрын
Again, you're amazing.
@safwanmohammed7715
@safwanmohammed7715 4 жыл бұрын
Very nice explanation with working code examples
@aldobangun223
@aldobangun223 3 жыл бұрын
Very clear explanation. Thanks Brad.
@nimasoufiloo2626
@nimasoufiloo2626 5 жыл бұрын
Perfect video as always. short and useful.
@tusharmaurya1668
@tusharmaurya1668 4 жыл бұрын
This is exactly what i was looking for!
@Koyi_supremacist
@Koyi_supremacist 2 жыл бұрын
october 2021 still works! thx brad
@imjustnobody6893
@imjustnobody6893 3 жыл бұрын
now i understand jwt and how to use it... thanks Brad!
@leeyahav4754
@leeyahav4754 5 жыл бұрын
does it will be better to move "jwt.verify(....)" to the middleware function ???
@Dinesh-ql1ok
@Dinesh-ql1ok 5 жыл бұрын
Congrats 🎊 Brad for 500k subscribers ✌️👍👏🎈🎁💐
@norrisdamianus5250
@norrisdamianus5250 5 жыл бұрын
very good, simple and clear tutorial
@gmjitendra
@gmjitendra 6 жыл бұрын
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.
@aparvaiz1999
@aparvaiz1999 5 жыл бұрын
Brilliant video Brad! Thanks a lot!
@Huongpham-gz1vm
@Huongpham-gz1vm 5 жыл бұрын
This turorial was help me solve my problem. Thanks!
@spirytusrektus
@spirytusrektus 6 жыл бұрын
Loved this one. Thanks for the video :)
@javidking63
@javidking63 2 жыл бұрын
you saved my day ! again! thank you brad!
@rgh1986aka199
@rgh1986aka199 6 жыл бұрын
Awesome tutorial. Thanks for making it for us.
@urbanmunda2451
@urbanmunda2451 4 жыл бұрын
Really great explanation sir... Simple and worthy ...
@rupinderkaur304
@rupinderkaur304 4 жыл бұрын
Sir really awesome video. Made me understand completely about jwt
@JohnMcCullough97
@JohnMcCullough97 6 жыл бұрын
Great video. Succinct and informative. Thanks. Merry Christmas.
@andrewfong101
@andrewfong101 6 жыл бұрын
Once again, thank you for your awesomely tutorial
@Etronic101
@Etronic101 5 жыл бұрын
Thanks !it really helpful beside simplification!
@divyanianerao5205
@divyanianerao5205 2 жыл бұрын
Woww this cleared my all the doubts. Thank you so much ❤
@hardikjhamb229
@hardikjhamb229 3 жыл бұрын
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
@tigranavagyan5922
@tigranavagyan5922 2 жыл бұрын
Thank you SO MUCH for your lesson. It really helped me a lot!!!
@AnselmoBattisti
@AnselmoBattisti 6 жыл бұрын
Thanks for the tutorial, it was very helpful
@anag2125
@anag2125 4 жыл бұрын
Thank you very much!! Just used it and worked perfectly! :D
@srcmake
@srcmake 6 жыл бұрын
Amazing video, thanks for sharing.
@tushargoyal8262
@tushargoyal8262 3 жыл бұрын
Amazing code-along, thank you!
@aliahmadi719
@aliahmadi719 2 жыл бұрын
Very well explained . Thanks so much for this video
@STUPIDYOUTUBE_HIDINGMSGS
@STUPIDYOUTUBE_HIDINGMSGS 2 жыл бұрын
Great post Brad, thanks!
@xshad3x348
@xshad3x348 6 жыл бұрын
Hi Brad, cool video and thanks, i needed a refresh! i think only that should be better to handle the verify in the middleware to keep the api clean, but great! thanks.
@nhulongctk10
@nhulongctk10 5 жыл бұрын
Why do we need the Bearer string in the authorization? instead of header['authorization'] = '' ?
@xNameless
@xNameless 5 жыл бұрын
There are different types of Authorization, such as Basic, Bearer, Digest, HOBA, OAuth - even Amazon Web Services has one called AWS4-HMAC-SHA256. The idea behind it is allowing multiple ways of authenticating with the same API, or server. This dates back to the HTTP/1.0 standard from W3C :)
@barjosa31blogspot83
@barjosa31blogspot83 6 жыл бұрын
Helpful! Thanks!
@jomajoms84
@jomajoms84 6 жыл бұрын
Thank you very much Brad!
@kps2642
@kps2642 6 жыл бұрын
thanks a lot man, helped me learn jwt :)
@gk0r
@gk0r 5 жыл бұрын
Excellent video. Short and to the point. Thank you for not building a client and using PostMan instead.
@jondavies2843
@jondavies2843 3 жыл бұрын
Fantastic, and well explained.
@mustafakosmaz178
@mustafakosmaz178 Жыл бұрын
good and short explanation! thanks
@Cfx45321
@Cfx45321 5 жыл бұрын
Excellent explanation!! thank you
What Is JWT and Why Should You Use JWT
14:53
Web Dev Simplified
Рет қаралды 1,1 МЛН
Can You Draw A PERFECTLY Dotted Circle?
00:55
Stokes Twins
Рет қаралды 45 МЛН
Русалка
01:00
История одного вокалиста
Рет қаралды 6 МЛН
Best KFC Homemade For My Son #cooking #shorts
00:58
BANKII
Рет қаралды 14 МЛН
KINDNESS ALWAYS COME BACK
00:59
dednahype
Рет қаралды 152 МЛН
The Importance of Specialization in Coding
7:13
Traversy Media
Рет қаралды 198 М.
Build A Node.js API Authentication With JWT Tutorial
1:15:41
developedbyed
Рет қаралды 732 М.
Why is JWT popular?
5:14
ByteByteGo
Рет қаралды 292 М.
7 minutes: Create a Node API with JWT's (json web tokens)
7:54
Ben Tedder
Рет қаралды 98 М.
What are JSON Web Tokens? JWT Auth Explained [Tutorial]
1:41:00
freeCodeCamp.org
Рет қаралды 123 М.
React Crash Course 2024
3:04:36
Traversy Media
Рет қаралды 363 М.
Custom Authentication (JSON Web Tokens)
13:03
FlutterFlow
Рет қаралды 14 М.
Top 50 Amazon Prime Day 2024 Deals 🤑 (Updated Hourly!!)
12:37
The Deal Guy
Рет қаралды 1,3 МЛН
Зачем ЭТО электрику? #секрет #прибор #энерголикбез
0:56
Александр Мальков
Рет қаралды 443 М.
Clicks чехол-клавиатура для iPhone ⌨️
0:59
Samsung laughing on iPhone #techbyakram
0:12
Tech by Akram
Рет қаралды 432 М.