No video

Access token and refresh token in Backend

  Рет қаралды 68,942

Chai aur Code

Chai aur Code

Күн бұрын

Visit chaicode.com for all related materials, community help, source code etc.
Welcome to chai aur code, a coding/programming dedicated channel in Hindi language. Now you can learn best of programming concepts with industry standard practical guide in Hindi language.
github.com/hit...
All source code is available at my Github account:
github.com/hit...
Our Open-Source Project is here: freeapi.app
Join me at whatsapp: hitesh.ai/what...
for community discord: hitesh/ai/discord
Instagram pe yaha paaye jaate h:
/ hiteshchoudharyofficial
HTML video series: • HTML and VSCode - gett...
Complete javascript series: • Javascript for beginne...
Complete Reactjs series: • React JS roadmap | cha...
Javascript and react interview series: • 1 call se shuru hui pl...
Backend development with Javascript: • Javascript Backend Roa...

Пікірлер: 831
@omwarade1847
@omwarade1847 8 ай бұрын
Thanks to Hitesh Sir, I overcame challenges at my tier 3 college, only because of him, I had no guidance earlier but this man, is the greatest teacher of all time. His teaching style is a game-changer. I've created projects, gained confidence, and salute him. May his influence endure for centuries. Hats off, Sir!
@drlovephukn
@drlovephukn 6 ай бұрын
Meri Logic bohot Improve ho gayi hain iss series follow karne ke bad. many many thank you from bottom of my heart .....
@anonyone8834
@anonyone8834 5 ай бұрын
i am happy ki jo bhi aapne mistakes batayi meri unme se ek bhi nhi thi :)
@harshit8525
@harshit8525 5 ай бұрын
Access points are the key which a suer generated post login . This is generally of shorted duration . When the session is complete , now user has two options one is to enter the password again and other one is to hit an api end point to refresh token . From both the two, second one is more useful since it is long duration key and can bee refreshed to increase the session and user had not to enter the password manually AND LOVE TO HITESH SIR 👌👌👌👌❤❤
@TenzDelek
@TenzDelek 6 ай бұрын
i have been following your series from the javascript ,react and now this.. and i can now confidently say that now i know what I am coding, back then use to watch so much of tutorials just to forget it the next day.. but yours teaching approach tends to make me understand why this things are being used from a simple concept of cors to the advance. you have made me understand the core of it. I hope you keep on teaching such valuable resources..
@adarshjhaxiif-1289
@adarshjhaxiif-1289 8 ай бұрын
Right now, you're heartbeat of every 2nd-3rd year student. Hopefully we will complete this project. Thanks a lot sir
@vishal-shinde
@vishal-shinde 5 ай бұрын
no, for everybody knows trying to be a developer.
@ayushyajaiswal6857
@ayushyajaiswal6857 8 ай бұрын
Thank you soo much sir, I'm currently working as a frontend dev in my org and got the opportunity in the current project to almost handle everything be it a frontend, backend or db reports. I was able to understand the things but in backend I do get few dobuts in multiple places while developing the new functionality. But since we've little tight schedules and project is also live so have to handle bugs as well so mostly I fail to clear all my doubts and just wrote the things just to make things work. But after the end of this 16th video I'm understanding most of the things and able to work in backend as well now as easily as I work in frontend. Thanks alot sir for your guidance.
@meet_rakholiya
@meet_rakholiya 7 ай бұрын
its a complete package of backend. any course can not have this type of quality. thank you for this sir.
@sufiyanahmad1603
@sufiyanahmad1603 8 ай бұрын
Guruji aapka bahot sukriya, aaysa course quality duniya me kahi or exist hi nhi krta ❤❤❤❤
@soumyajitnaskar8300
@soumyajitnaskar8300 8 ай бұрын
Access Token - Short lived, not stored in db Refresh Token - Long lived, stored in db When access token expires, the frontend sends the refresh token to the backend to validate user (login), once again.
@ShuklaManeesh-qv1yl
@ShuklaManeesh-qv1yl 3 ай бұрын
can you please tell me how can i hit that endpoint of refreshToken in frontend? like in what section of frontend i should make a call to that RESTAPI of refreshToken?
@user-yr5fl8uv4u
@user-yr5fl8uv4u 3 ай бұрын
I think in third line u meant access token instead of refresh token because, when access token expires how can frontend send refresh token which is in backend send to backend??
@maneeshshukla9885
@maneeshshukla9885 3 ай бұрын
​@@user-yr5fl8uv4u ig when access token expires after a certain period of time, we have to hit the endpoint of API which will match our refresh token with the refresh token stored on db and again generate a new access and refresh token.
@Rahul-jo1mp
@Rahul-jo1mp 3 ай бұрын
@@user-yr5fl8uv4u because accessToken is already saved in cookies of front end . Whe front end send cookies to server then server will check incoming refreshtoken with refresh token stored in database
@Rahul-jo1mp
@Rahul-jo1mp 3 ай бұрын
i also have same question if refresh token is also new generated with acess token then whats the point of givng longer expiry time to refresh token
@boomaboom6458
@boomaboom6458 8 ай бұрын
HItesh sir is mentor and true inspiration for me i come from that background that i can't even finance my livehood and i am studying my diploma in electrical and electronics i watch hitesh sir videos in my 2nd hand broken phone and visit the cyber shop monthly twice and make notes in my notebook and code the project and learning full stack development from chai aur code may this channel growth increase exponentially in 2024 because for sure if he wasn't there i would not be able to learn this much insights of tech thank you very much sir for sure .... bus aj tak kabi kisi kay saat apnay internal matter share nhi kiye hai aj karnay ka man kara thanks a lot hitesh sir bus aur kya chai ☕ piyo aur 😭😭😭😭 chil karo
@saadatbadgujar
@saadatbadgujar 4 ай бұрын
Making a separate video for this was actually great, awesome!
@len5755
@len5755 4 ай бұрын
I am following your videos on this channel and your English channel now Not only I have learned JavaScript (in depth), React and now back-end, I have also learned to debug my code properly by reading the errors calmly. I used to get anxious & frustrated, then quit projects just because of that, thanks for changing my habits
@mohammad-aman1105
@mohammad-aman1105 7 ай бұрын
Sir, Thank you ki aapne video ko 2 part me rakha. Isme concept clear hogai meri.
@Nitesh_Saini_
@Nitesh_Saini_ 8 ай бұрын
Guruji Dil se sukriya 😅 .iska bahut time se intezar tha😊
@chaiaurcode
@chaiaurcode 8 ай бұрын
Share zrur krna
@tuhinghosh9737
@tuhinghosh9737 28 күн бұрын
Now I can find out the solution of the errors step by step .. thank you so much sir ❤️
@user-rv1rj2xp8k
@user-rv1rj2xp8k 8 ай бұрын
thanks sir for your hardwork for the students to providing the quality and production leevel content
@shahhussain56
@shahhussain56 3 ай бұрын
Itne detailed me koi nahi padhata h even paid course me bhi nahi koi padhata sir. Hats off for your hardwork❤ lots of support.
@mohsinzia8566
@mohsinzia8566 4 күн бұрын
I am learning so much from this series thank you hitesh sir!!!
@arifsaleem-7377
@arifsaleem-7377 3 ай бұрын
thanks sir , quality + teaching style is unparalleled .
@Lazyogesh
@Lazyogesh 7 ай бұрын
Thank you Hitesh sir for this series , the knowledge you are providing us is very precious (Gulabi Dil)
@najmulhc
@najmulhc 8 ай бұрын
Am lovin the series. learning backend from an industry standerd level.
@zeeshankhan-yc4oy
@zeeshankhan-yc4oy 8 ай бұрын
series bohat pasand arhi he. thank you sir!
@haseebhijazi6295
@haseebhijazi6295 3 ай бұрын
Kudos Hitesh! A great series for backend for developers who lack professional experience. One of my friends recommended this series to me for my Full-stack project and I must say you have put a lot of hard work in making this amazing series. Even though, I am using MySQL as the backend for my project, the series was still helpful for code style and logic building. I never felt for watching any other tutorial besides the available docs of the technologies which I used. While testing my logout route was throwing errors as it could not fetch any token. Upon inspecting, I saw that I was not receiving cookies in login route, which was inturn causing issues with the logout route. So, I commented out the secure option in the "cookie options". And Voila! It worked. Shared it as someone struggling with same issue might find it helpful. Thanks Hitesh!
@sagaryenkure5112
@sagaryenkure5112 8 ай бұрын
I remember when I was trying to learn redux and other YT videos are very confusing their ,then the video on redux of hitesh sir came then the concept of redux became very easy for me
@sanchit_H
@sanchit_H 7 ай бұрын
This Series helped me a lot with errors when earlier I use to get error I was scared of them didn't know how to handle them and even how to approach an error. Today while I was checking Login page I got couple of error first was password was incorrect, checked my DB it was not encrypting the password went through all the code and didn't wrote an await in a single line that caused the error. few others were I wrote user instead of User when trying to find the id, thanks a lot For building my confidence with your explanation and deep dive into topics
@vivekbhatt3932
@vivekbhatt3932 7 ай бұрын
Awesome content, really like how the things are connected and dependent on each other in backend. Frontend + Backend = 🔥🔥. Thankyou sir for such content.
@Codewithrasheed
@Codewithrasheed 8 ай бұрын
thanks sir , quality + teaching style is unparalleled . ❤
@vaibhavchopra5297
@vaibhavchopra5297 8 ай бұрын
Great sir 😊😊. Please continue this series as fast as possible. I have also shared on LinkedIn and to my friends as well. ❤❤❤ Best teacher....🎉❤
@devmangrani1482
@devmangrani1482 7 ай бұрын
Sir you already finish this series But I am learning from it now Thank You so much
@user-tg5xf2mp2y
@user-tg5xf2mp2y 8 ай бұрын
Best video explaining about the refresh token and access token
@user-mi6el1vs2l
@user-mi6el1vs2l 3 күн бұрын
this is unbelievable content!
@shubhamgurjar912
@shubhamgurjar912 8 ай бұрын
I was eagerly Waiting for Part 2 of Backend series now finally it's came❤😊.
@vishal-shinde
@vishal-shinde 5 ай бұрын
thanks for the video. refresh token ko samajna pehle difficult tha, now I have understood.
@kirankuyate6056
@kirankuyate6056 8 ай бұрын
great videos sir please make this series complete there will be non of other videos compare with this series at all Time Top no matter people is likeing or sharing or not but getting involved in it that is most important impact of this videos.. Make and completed it Love from Kiran to Chai aur COde 💖💖
@sherebanoburhani8939
@sherebanoburhani8939 8 ай бұрын
Right now I completed hitesh sir JavaScript series and starting react❤
@Ofcl-Javed
@Ofcl-Javed 7 ай бұрын
First I watched the videos learns a bit this and that, then I code without video sometimes refer to github repo and do it in typescript then now rewatching to look if I've missed something else or any assignment Lovely series sir While doing this I already got so many project ideas and this series will be base of all that
@fabulousgamer2293
@fabulousgamer2293 8 ай бұрын
Lovinggg the seriess alwayss❤❤❤.. I am a tier 3 college student.. And it really helps me to know how a project is really made and I am going through it and also enjoying😊
@theshubhagrwl
@theshubhagrwl 8 ай бұрын
Kuch mahine pahale mai Linkedin ki api se kuch develop kar raha tha, usme bhi kuch refresh aur access token ka scene tha. Access token to pata tha but ye refresh token wala concept mujhe to bilkul samj nahi aaya tha tab. Ye video dekhne ke baad aur khud code karne ke baad clear hua hai concept 😌
@devanand4269
@devanand4269 8 ай бұрын
Thank you sir ache se samjh agya refresh and access token
@ravisingh5906
@ravisingh5906 8 ай бұрын
sir please continue this series , i am studying very seriously
@pococopo2538
@pococopo2538 7 ай бұрын
i had spend 3 hours on previous video just to figure out how everything was working like cookies , accessToken, refreshToken , etc how a refresh token added to our userInfo documents when it logs in how it removes the refreshToken property from the document when it logs out how if we didn't give authorization headers from postman it was still logging out (this thing confused me for a long time then i did some Console.log all over our code and after that i figured out that postman was also sending the cookies with out post logout request... i guess) but afterall it was really fun This whole series is Amazing Thank You Hitesh Sir
@lalmanthakur7899
@lalmanthakur7899 8 ай бұрын
great teacher comes with great videos 😊
@mdrafehqureshi5409
@mdrafehqureshi5409 2 ай бұрын
At 22:07 Only generate new access token don't generate refresh token again as it is already long lived and while sending back cookies send new access token and old incoming refresh token. Still if you want to generate both the tokens and send them back to the frontend then make sure that you save the new refresh token in the database . Otherwise there is no use of keeping long lived refresh token. I think sir might have missed this point while recording.
@vishakhakhanna8115
@vishakhakhanna8115 2 күн бұрын
I have a doubt. We didn't updated the refresh token and access token in DB, this might cause error . Correct me if am wrong.
@mdrafehqureshi5409
@mdrafehqureshi5409 2 күн бұрын
@@vishakhakhanna8115 we will update the refresh token in DB if and only if both refresh and access token have expired. If only acces token has expired then in the backend we will check whether the refresh token, coming from the frontend is same as the refresh token in the DB and has not expired, then we only generate new access token in the backend and send it to frontend. Note that in DB we only store refresh token and not access token.
@parvejkhan4512
@parvejkhan4512 8 ай бұрын
I really follow your video and implement in my day to day its very helpful for me to write clean and production ready code Your are really mentor my coding jauarny❤❤❤🎉
@user-re9ui4fm9j
@user-re9ui4fm9j 3 ай бұрын
I learned alot from this series worth watching👍
@pratyushsharma5963
@pratyushsharma5963 4 күн бұрын
Awesome Playlist Sir, Thank you !!
@ShubhankarSharma-vr6zg
@ShubhankarSharma-vr6zg 8 ай бұрын
Thank you sir for providing a clarity, the difference is cleared now
@MeerUzairWasHere
@MeerUzairWasHere 8 ай бұрын
Sir, we can optimize this by implementing middleware. By utilizing middleware, we can exclude the endpoint and efficiently manage the process of obtaining both cookies and updating the access token through the refresh token. This not only streamlines the workflow for the front-end developer but also ensures a smoother experience by handling these tasks seamlessly in the backend.
@aritra2374
@aritra2374 8 ай бұрын
keep posting videos quickly sir its an amazing series i follow every thing the first day only
@chaiaurcode
@chaiaurcode 8 ай бұрын
Jldi to humse nhi ho paata, apna safar relax hoke hi chalta h
@bhaskargautamdivcroll4607
@bhaskargautamdivcroll4607 8 ай бұрын
sir your teaching skills is next level please don't stop keep moving forward and continue this series i learned Node js from this course THANK U SO MUCH SIR >>>>>
@AyushGupta-xq8fe
@AyushGupta-xq8fe 8 ай бұрын
One of the best playlists on javascript backend
@chaiaurcode
@chaiaurcode 8 ай бұрын
Thanks
@nehabansal370
@nehabansal370 6 ай бұрын
Thanks Hitesh Sir, I am here to refresh my concepts for Production based projects. I am regaining my confidence back. Thanks a lot.
@SC000
@SC000 8 ай бұрын
Great serese sir, please continue rakhiye ise...bech me stop mat kijiye....😢
@rakeshbhetariya
@rakeshbhetariya 7 ай бұрын
The video may be brief, but its content is impactful and truly impressive.
@user-ip1ow4of7u
@user-ip1ow4of7u 8 ай бұрын
hope this might help u : During login we generate 2 tokens 1) access-token 2) refresh token we save refresh-token in DB and set access-token and refresh-token cookie in chrome access-token is for short time and refresh-token is for long time when user access-token is expired it send refresh token to Back-end Back-end checks if DB refresh-token and user refresh-token is same or not if same it generate both token again and repeat process of saving RT in Db and set cookie with RT and AT
@ahmedsnippet
@ahmedsnippet 5 ай бұрын
how to generate token?
@dheerajpali9746
@dheerajpali9746 2 ай бұрын
Thank you so much Hitesh sir, for making such an amazing series.
@vivekkrishan2198
@vivekkrishan2198 7 ай бұрын
Backend seems to be so easy just because of you only. Before your videos, our opinion about backend was "it a very complex tech and it need a lot of complex algos for doing every tasks" and now our opinion is " backend is just a normal logic with some js packages and a bit of production grade standerds"
@deeptisaxena7088
@deeptisaxena7088 2 ай бұрын
Thanks hitesh sir, it is great exposer for me
@mohitwadhwani6024
@mohitwadhwani6024 8 ай бұрын
First of All Thanks Hitesh Sir, and I just want to say that, the ease with which you explain the concepts that too in great detail is just amazing.
@lalitsingh-de1md
@lalitsingh-de1md 6 күн бұрын
thanks and love you sir for your valuable content💖💖☕☕
@sarthaksaraf6640
@sarthaksaraf6640 5 ай бұрын
first time solved bug without taking help of chatgpt and stack overflow on access token and refresh token mene arrow function use kara tha jabki normal function use karna tha due to problem with this keyword uski wajah se token generate nhi ho rha tha.. all thanks to you sir, i usually dont comment but aapko salute hai!!!
@monikabasene2908
@monikabasene2908 3 ай бұрын
hey i am facing the same error
@supersection
@supersection 8 ай бұрын
Sir, this series is just mind blowing and totally love your approach to teach us every topic❤... Please continue ki jiyega iss series ko end tak, bohat helpful hai, aur maza aata hai sikhne mein aapke sath
@user-jv3wn3xf2n
@user-jv3wn3xf2n Ай бұрын
Super lecture deep detail explaination
@earningapp5967
@earningapp5967 8 ай бұрын
Hitesh sir is god for me❤️❤️ Real teacher ❤️ I have no money to read computer engineering so i am reading commerce But i am interested in technology and software engineering So i am reading it from online By Hitesh sir I am learning coding full stack from his KZfaq channel❤❤🎉
@Ansh0R
@Ansh0R 8 ай бұрын
Same bhai👍 keep growing bro
@kanailalmanna5005
@kanailalmanna5005 8 ай бұрын
This series not just a series, this is backend university, we just loved it ❤‍🔥❤‍🔥❤‍🔥❤‍🔥
@kungayounten6346
@kungayounten6346 4 ай бұрын
addicted to this series 💖💖
@cyb3rjunky609
@cyb3rjunky609 7 ай бұрын
subscribers are increasing around 1K per day 😮😮
@munna5553
@munna5553 8 ай бұрын
Wooow great teacher comes with great videos 😊
@ravisingh5906
@ravisingh5906 8 ай бұрын
I am addicted to this channel
@armanali-xq1el
@armanali-xq1el 8 ай бұрын
it really helps me to know how a project is really made and I am going through it and also enjoying😊
@shashwatpal4217
@shashwatpal4217 8 ай бұрын
thank you for the separate access toekn and refresh token video
@smitpatil3785
@smitpatil3785 8 ай бұрын
Thanks for the video sir 😊
@KidsWonderland99
@KidsWonderland99 4 ай бұрын
loved last one and loved this one too😊😊😊
@Ansh0R
@Ansh0R 8 ай бұрын
14:32 Sir in user.controllers.js in refreshAccessToken function in line no. 188. you miss to put "!" In if condition- Mistake - If (incomingRefreshToken) { Throw new ApiError(401, "unauthorized request") ) Fix - If (!incomingRefreshToken) { Throw new ApiError(401, "unauthorized request") ) This is fixed by sir
@huamanraj
@huamanraj 8 ай бұрын
sir is more sucessful still more hardworking than me!!😊😊
@mahithapasupuleti2642
@mahithapasupuleti2642 2 ай бұрын
Thank you so much, Hitesh Sir😇
@forexspectrum4799
@forexspectrum4799 8 ай бұрын
No sir don't stop this series the only hope you are all over the youtube so don't stop this series sir please it's humble request 🙏
@xyzatin
@xyzatin Ай бұрын
Refresh token maintained with http-only cookie (An HTTP-only cookie is a type of cookie that is inaccessible to JavaScript running in the browser, which makes it safer). These are important stuff if you are explaining tokens, I think.
@dipakbadu1057
@dipakbadu1057 16 күн бұрын
Thank you so much, Hitesh Sir
@harshtiwari3928
@harshtiwari3928 8 ай бұрын
You explained it so simply, lot to learn from you apart from your coding
@_sahildahat_
@_sahildahat_ 7 ай бұрын
This content is awesome as always! Sir your teaching style is great!
@Codewithrasheed
@Codewithrasheed 8 ай бұрын
Best video by hitesh sir
@developer_dhanji
@developer_dhanji 3 ай бұрын
😇 mindBlowing Hitesh sir
@prakash399111
@prakash399111 2 ай бұрын
excellent backend series..
@RajCreationAA
@RajCreationAA 6 ай бұрын
thank you so much hitesh sir, i was getting a lot error but i solved that myself by doing console log and by understanding the error problem, and after solving i thought i did something supercool thing! 😃😃
@user-jg2cj2lm4m
@user-jg2cj2lm4m Ай бұрын
accessToken: shortlived, main token used for auth, not stored in database, sent to user only refreshToken: long lived, token used to generate main token ie, accessToken (ofcourse, based on its validity), stored in the db and sent to the user also
@adamyasharma_0135
@adamyasharma_0135 2 ай бұрын
this lecture is tooo good!!
@HarshKrSingh-wq8yu
@HarshKrSingh-wq8yu 3 ай бұрын
following this series excellent content
@Dev-Phantom
@Dev-Phantom 4 ай бұрын
ultra Helpful lecture. best lecture
@nigam_sharma
@nigam_sharma 8 ай бұрын
yess ek benchmark setup krenge
@kushalbhargava8212
@kushalbhargava8212 8 ай бұрын
Sir badiya series hai Continue karte rahiye sir...
@adamyasharma_0135
@adamyasharma_0135 2 ай бұрын
learned alot from this one lecture
@Agni003
@Agni003 6 ай бұрын
Thank you so much Hitesh Sir
@allyn3015
@allyn3015 7 ай бұрын
Amazing explanation sir. Kudos 🙌 to your simple style of teaching. Hope to meet you soon sir❤
@ShivThoughts
@ShivThoughts 5 ай бұрын
comment Number 637. motivation++ Thank You so Much for Quality Content.
@pratiksawant
@pratiksawant 8 ай бұрын
very nice video hitesh sir
@me_vip_0007
@me_vip_0007 7 ай бұрын
Thank u so much for providing us in depth knowledge 🙏🙏🙏🙏
@MuhammadYasir-cl4jp
@MuhammadYasir-cl4jp 8 ай бұрын
Sir Thank you so much for bringing this high quality content. Please sir continue it 🥰🥰🥰
@saurabpoudel9134
@saurabpoudel9134 2 ай бұрын
life changer sir ji !
Writing update controllers for user | Backend with JS
43:15
Chai aur Code
Рет қаралды 44 М.
Access Refresh Token, Middleware and cookies in Backend
1:02:45
Chai aur Code
Рет қаралды 80 М.
艾莎撒娇得到王子的原谅#艾莎
00:24
在逃的公主
Рет қаралды 54 МЛН
Gli occhiali da sole non mi hanno coperto! 😎
00:13
Senza Limiti
Рет қаралды 22 МЛН
КАКУЮ ДВЕРЬ ВЫБРАТЬ? 😂 #Shorts
00:45
НУБАСТЕР
Рет қаралды 3,5 МЛН
هذه الحلوى قد تقتلني 😱🍬
00:22
Cool Tool SHORTS Arabic
Рет қаралды 59 МЛН
What is JWT token and JWT vs Sessions
26:12
Chai aur Code
Рет қаралды 60 М.
Why is everyone LYING?
7:56
NeetCodeIO
Рет қаралды 252 М.
What is a Refresh Token and why your REST API needs it?
4:53
Nick Chapsas
Рет қаралды 133 М.
Learn Mongodb aggregation pipelines
36:45
Chai aur Code
Рет қаралды 58 М.
How to use postman for backend
36:13
Chai aur Code
Рет қаралды 68 М.
JWT token vs Server Tokens
10:25
Hitesh Choudhary
Рет қаралды 31 М.
50+ LPA Roadmap | ezSnippet | Neeraj Walia
17:02
Neeraj Walia
Рет қаралды 1,2 МЛН
艾莎撒娇得到王子的原谅#艾莎
00:24
在逃的公主
Рет қаралды 54 МЛН