Registration and Login with JWT Authentication Tutorial - NodeJS Tutorial
Video Statistics and Information
Channel: PedroTech
Views: 9,323
Rating: undefined out of 5
Keywords: databases, mysql, nodejs, react js, express js, pedrotech, traversy media, traversymedia, clever programmer, tech with tim, freecodecamp, deved, pedro tech, jwt authentication, jwt authentication node js, authentication node js, authentication node js express mysql, node js authentication middleware, authentication tutorial, nodejs register login, bcrypt, jsonwebtoken, jsonwebtoken nodejs, jsonwebtoken express, jwt, jwt tutorial, node js authentication, json web token, node jwt
Id: b9WlsQMGWMQ
Channel Id: undefined
Length: 47min 8sec (2828 seconds)
Published: Mon Mar 08 2021
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.
I wish people would stop making such complex tutorials about JWT. JWT is very simple and can be fully explained in about 5-10 minutes in isolation. Authentication is its own subject and should be explained independently IMO.
It’s tutorials like this one that made JWT seem so ridiculously complex and unapproachable, but it’s mostly just because the name isn’t really appropriate. This tutorial should probably be called something like “Building a full registration and login system using JWT with NodeJS” instead.
Just my opinion, sorry for ragging on you OP.
I made this comment in a comment thread below but to avoid it being buried I'll post at the top level too. The token here is not encrypted like OP seems to think. OP said:
I replied:
Well JWT doesn't encrypt anything by default, it's just base64 URL encoded with a SHA on the end, you can take any normal JWT and read the contents of the payload and header. You'd have to encrypt it yourself. And if you're encrypting info into a token and storing that in a cookie, you can just store the info in an encrypted cookie, no JWT needed. I didn't watch your whole video to see if you encrypted your JWT, but I believe that's what the other poster u/feketegy is getting at.
Not that I mind JWT. It's fine if the implementation is good. There's just a lot of misconceptions that get echoed when everyone wants to make auth tutorials without backgrounds in security... I see bad security practices thrown around as advice on Reddit all the time unfortunately. This last part isn't necessarily aimed at you since I didn't watch all your video, just an observation.
EDIT: Oof. I was curious and skipped ahead to the part where you create your token. Correct me if I'm wrong but you're not encrypting anything stored in your token. You use
JWT.sign
with no options object. The default algo is HS256, which is a HMAC, not encryption. Worse, you say:"The token is secure because it's completely encrypted, ... we can store whatever we want inside that token"
, so you're leading people down the garden path! Paste one of your tokens here https://jwt.io/ and you'll see the payload. Good job you're not storing anything too sensitive in here in this video, someone else might though.
:/
Good tutorial. But 47 mins! too long. It would be great if the tutorial is within 20 mins. Anyway good tutorial.
Here is complete token based authentication node express backend with email verification and password reset via email. Follow the link in the discription..
https://youtu.be/OwkTQQkZu3Q