JWT Authentication with Access Tokens & Refresh Tokens In Node JS
ฝัง
- เผยแพร่เมื่อ 14 ต.ค. 2024
- What's up guys welcome to my channel. We all know most important feature in every application is authentication. To make that authentication much more secured and make better user experience we need to use refresh and access token based authentication in your app. You might be thinking what is refresh token?, why should we use?, how should we use ?
First let's take a look at older way of authenticating user which is called token based authentication. When user logged in we send a access token which is valid for certain time. When that token expires we have to ask user again to login, Which is tedious user experience. To solve that problem we have to use refresh token.
A refresh token is nothing but a access token but it has life time about 1 or 2 months. Access token has expire time about 10 to 15 minutes. Whenever this access token expire. we don't ask user to login again to get new access token instead we send refresh token to the server here we verify that token and send new access token to the client. with this method user don't have to login again and again. this makes user experience much more easier to user.
To know how to implement refresh token in node js watch this video.
I hope you learn something new today. If you like my work subscribe to my channel and like this video.
Source Code = github.com/cyb...
╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣
╠╗║╚╝║║╠╗║╚╣║║║║║═╣
╚═╩══╩═╩═╩═╩╝╚╩═╩═╝
Tags = {jwt authentication node js, jwt node js, jwt node js express, json web token authentication node js, jwt auth express, jwt auth node js express, refresh tokens, mern stack, user authentication, node js authentication, refresh token authentication, access token, refresh token, TomDoesTech, yoursTruly } - วิทยาศาสตร์และเทคโนโลยี
I'm a junior developer and your video was so fast that it gave me a headache. I had to take a pill and lie down for a bit. But I am actually here to thank you! This was ** THE BEST ** video I found on TH-cam about JWT Access and Refresh tokens. For the past three days I have been watching videos on the subject and now I can finally stop. Your video taught me everything I needed to know and much, much more. By the way, your code is beautiful. Thank you very much, Sir.
I have liked the video and subscribed to the channel. 😊🙏👏
it was an amazing video,even I learnt many new things like, type:module in package.json, enum in models, joi, password strength and a few more things. One of the main thing, video is neat and clean and easy understandable.
great tut sir, one of the best YT teachers
Why do you store refresh tokens in database if JWTs are self contained?
Yes, same question? @CyberWolves ?
Nice explanation , do watch with patience guys .
I also want to upload my apis on any server, I do not know which free server will be best, however, I am thinking to upload APIs on vercel. can you please create or send a video link for same?
Thank you so much! This is the best video ever! Don't stop, guy! You rock!
to be frank, I was searching to integrate the refresh token api in react js and luckly I find your this video which learnt me many things. can you send me the link if you have create a video to integrate refresh token in react js please.
After Creating The AccessToken when User Logins, where should we store the accessToken and Refresh Token? HttpOnlyCookie or LocalStorage?
Can we Create 2 token, store 1 in LocalStorage and one in httpOnyCookie, get both of them in server and then validate both of them instead, Would this improve the security of our website?
Same doubt i have
Till now i didn't get the answer
Where to store both the tokens in frontend
Can you please send a link for reset password video in node js or a playlist with JWT.
One suggestion plz avoid adding background music, it really divert the mind
awesome tutorial.. please merge this tutorial with your email based authentication and password reset with email video😊🙏
Refresh token not expire after 30 days ?not delete in mongodb
Great tutorials. Please make for the client side using Angular or React. Thankyou
Thank you guy. Its usefull. It helped for me
what font are you using?
coding like brad traversy media bro, basically simply great
Thanks for the video, does this work if the user refresh the page?, before i had an issue in which i used httponly cookie (i was using mern stack), but the problem is that if i refreshed the page the user cannot be persisted since im not keeping the jwt in the localstorage, so now i wanna use access tokens + refresh tokens which is said to be secure
Can I get this vscode theme extension?
Please make the client side of this tutorial.
Good Explanation💝
Where we can find secret key for access and refresh token? Anyone who know please help me
both keys are kept in .env file
informative video love it🔥🔥
Excelent. Thankyou
please add this on frontend
Iska frontend kaha hai
I tried to follow and understand your video whole day,,, but I couldn't....
please focus to teach us code + LOGIC equally...
otherwise we end up overwhelmed and demotivated
he has already provided the good video. please first google it out how the access token and refresh token works then come to this video for how to implement in node js
The link of the source code doesn't exist
Check now
@@CyberW0lves yes I works thank you
chaima did this work for you ?