JWT Authentication with Access Tokens & Refresh Tokens In Node JS

preview_player
Показать описание
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.

╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣
╠╗║╚╝║║╠╗║╚╣║║║║║═╣
╚═╩══╩═╩═╩═╩╝╚╩═╩═╝

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 YouTube 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. 😊🙏👏

daniellobo
Автор

Thank you so much! This is the best video ever! Don't stop, guy! You rock!

fabinhorockfabinho
Автор

great tut sir, one of the best YT teachers

infinioda
Автор

Thank you guy. Its usefull. It helped for me

nalcapital
Автор

Great tutorials. Please make for the client side using Angular or React. Thankyou

thelazyguy
Автор

Nice explanation, do watch with patience guys .

Abhiabhi-qjxv
Автор

awesome tutorial.. please merge this tutorial with your email based authentication and password reset with email video😊🙏

BunkarCode
Автор

Why do you store refresh tokens in database if JWTs are self contained?

justojonathan
Автор

Can I get this vscode theme extension?

sagarandaryal
Автор

Refresh token not expire after 30 days ?not delete in mongodb

babu
Автор

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

Jimmy-ztio
Автор

After Creating The AccessToken when User Logins, where should we store the accessToken and Refresh Token? HttpOnlyCookie or LocalStorage?

shareeqrashid
Автор

Please make the client side of this tutorial.

raichand
Автор

coding like brad traversy media bro, basically simply great

infinioda
Автор

One suggestion plz avoid adding background music, it really divert the mind

vikasni
Автор

Where we can find secret key for access and refresh token? Anyone who know please help me

meetpokal
Автор

The link of the source code doesn't exist

chaimanaoueni
Автор

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

awaisaslam