What are Cookies in NodeJS?

  Рет қаралды 83,615

Piyush Garg

Piyush Garg

Күн бұрын

Пікірлер: 119
@YashAmbekar-j3p
@YashAmbekar-j3p Жыл бұрын
The thing I love about this playlist is using simple language, very easy to understand and please always give the scenario of how things work at enterprise level in your future video.😌
@santoshdhariwal8979
@santoshdhariwal8979 Жыл бұрын
Excellent Videos Piyush... Explaining it in such a simple way.. makes it so easy
@ravisingh5906
@ravisingh5906 10 ай бұрын
i can't set cookie by res.cookie
@sawaregamer8815
@sawaregamer8815 8 ай бұрын
use cookie parser and if you work on react and node you need to use cors package
@DineshKumar-gt7xm
@DineshKumar-gt7xm 7 ай бұрын
​​@@sawaregamer8815I am also not able to set cookies using react. I have used both cookie parser and cors package.
@muhammadtaimoor2378
@muhammadtaimoor2378 7 ай бұрын
Use res.cookies
@Solo_playz
@Solo_playz 9 ай бұрын
I thought the same even though I used to do the same in my MERN stack projects what shubham has asked But Thanks Piyush for getting us more clear on it also I found that OAuth and NextAuth use the same technique while authenticating users on each request they utilize tokens stored in the cookies and get users' data from it! Very very useful topic you have covered
@shubhamgupta-bl1tr
@shubhamgupta-bl1tr Жыл бұрын
Thanks sir taking my doubts..it's clear now
@pradeeppop8201
@pradeeppop8201 Жыл бұрын
This tutorial of nodejs is more useful to any other paid tut . Thank you so much sir such a amazing series ❤️ 🙌 👏
@weforyouweb1165
@weforyouweb1165 Жыл бұрын
Bro you are explaining very deep things in practical superb bro 🎉🎉
@lillyput2275
@lillyput2275 11 ай бұрын
Bro just don’t stop posting videos u r just amazing tutor❤
@ageshalbhandare2487
@ageshalbhandare2487 Жыл бұрын
No words, how you explain deep fully, at each word meaning fully explain😊 Thank you, Create An KZbin channel and share your knowledge📚
@pallabdandapat1866
@pallabdandapat1866 8 ай бұрын
22:28 -->changes happen
@satyanshgarg9651
@satyanshgarg9651 10 ай бұрын
Great work, it has compelled me to like and subscribe.
@mahendra.k12
@mahendra.k12 6 ай бұрын
If you encounter this error: Cannot read properties of undefined (reading 'split'), Follow the given steps: 1. first make changes only to handleLogin controller and send token as json instead of setting a cookie. 2. Now in postman, make POST req to /user/login and generate a token. 3. Now make change to our middleware functions i.e to checkAuth and restrictLogin middlewares. 4. And now finally make GET req to homepage and set the authorization header in postman. Reason: If you make changes to the middlewares first and then try to generate the token it will result in error because we don't have authorization header during initial token generation and the checkAuth middleware is still executed. Hence generate the token first and then make necesarry changes in the middlewares. Hope it helps!
@Spotlight_Gaming
@Spotlight_Gaming 5 ай бұрын
still getting the same
@knowledgehub.e
@knowledgehub.e Ай бұрын
@@Spotlight_Gaming same issues
@rohitlochib2300
@rohitlochib2300 3 ай бұрын
Thank You Sir, It was one of the Best explanation of cookies on youtube.
@lakshyakhushalani9464
@lakshyakhushalani9464 Жыл бұрын
literally no words for uh bro !...excellent explaination 😃😃
@PrathameshSakore-h1i
@PrathameshSakore-h1i 2 ай бұрын
The authorization header is not present by default in the POST request in postman and hence you can get the error: Cannot read properties of undefined (reading 'split') as there's no authorization header present, you have to set the header in the Headers tab manually as "Authorization" and set its value to null so that it can be used further in the middleware functions.
@sutharjay1
@sutharjay1 10 ай бұрын
Got to know many things this video thank you for the lecture😇😇
@iganic7574
@iganic7574 3 ай бұрын
16:10 what are you trying to do 🤔 According to mdn Fir domain value - "Only the current domain can be set as the value, or a domain of a higher order" "A cookie for a domain that does not include the server that set it should be rejected by the user agent."
@khushichaurasia121
@khushichaurasia121 3 ай бұрын
From where you learn all this so well??
@Believeharsh
@Believeharsh 23 күн бұрын
This is called pure hardworking, he go through all the documenation and dig the google very well. That is the problem, everything is available for everyone but our lazy culture........!!
@dineshsinghbisht07
@dineshsinghbisht07 Жыл бұрын
Thanks for the video 🔥✨
@piyushgargdev
@piyushgargdev Жыл бұрын
My pleasure!
@Muzafar.A
@Muzafar.A 10 ай бұрын
that was so useful and deep knowledge for newbie. awesome bro ❤.
@heyOrca2711
@heyOrca2711 2 ай бұрын
Thank You Piyush For this great video!!! ; )
@Hardik3000
@Hardik3000 7 ай бұрын
21:06 but token match karne ke liye database access chahiye hoga na har bar request aane par!!..........to problem to same hi rahi jo aapne video ke starting me kaha tha
@imPrathamDev
@imPrathamDev Жыл бұрын
can you explain refresh token and access token?
@mayankbadika3101
@mayankbadika3101 11 ай бұрын
Thank you so much for sharing this. Very good explanation :)
@vishalkumarshaw9208
@vishalkumarshaw9208 2 ай бұрын
superb bhai...
@mma-dost
@mma-dost Жыл бұрын
Thanks bhaiya for the video tutorials. 🥳🥳🔥🔥🤘🤘
@piyushgargdev
@piyushgargdev Жыл бұрын
You're welcome 😊
@mr_singhai9778
@mr_singhai9778 7 күн бұрын
@priyam, In Postman, we manually send the token via headers without using local storage or cookies. How can we receive this token in our backend middleware to authenticate the request?
@banothutharun2743
@banothutharun2743 4 ай бұрын
excellent explanation brother
@ashishprajapati825
@ashishprajapati825 Жыл бұрын
Amazing explaination bro ❤👏🏻
@AkashLayal
@AkashLayal 11 ай бұрын
Sir i have a doubt because 11:04 you have directly providing user from jwt token but if the user is deleted from database but the user can still access logged in content.
@vishnugopalakrishnan9539
@vishnugopalakrishnan9539 10 ай бұрын
getUser function doesnt "provide" user directly, it decodes the user data that was signed, i.e. id and email, adds it to req.user (code under restrictToLoggedInUser ) and finds that info from the database for each req, you can check the code at router.get('/'..) under staticRouter,
@kanamithra5062
@kanamithra5062 10 ай бұрын
Good explanation👍
@Raj6026
@Raj6026 Жыл бұрын
Thanks bro..excellent video .really helpful
@Abdullahsiddique-wf2nt
@Abdullahsiddique-wf2nt 9 ай бұрын
Agr hum Map or database ko combined use kry tu excess database request ka issue ni hoga, first time jab user login hoga tu map ma bhi or database ma bhi store hoga or getuser ma hum check laga day ka agr user exist krta ha map ma tu database sa query na kry or agr map sa ma ni ha tu database sa query kr kay usko map store krdy for further request verification
@movocode
@movocode Жыл бұрын
Thank you for this tutorial - you have make an overview video about architecture of SSO (single sign on) authentication - if possible, can you make a full coding tutorial of SSO (basic only will do).
@tarushchandra8993
@tarushchandra8993 Жыл бұрын
Hi Piyush, maine ek website banai hai jiska server or client different domain pe hai but jab mai sever me cookies ke option me domain ko apne client ke domain pe set karta hu, tab bhi cookie send nahi ho rahi. I've also used cors for cross platform sharing. kya browser ka kuch default behavior hota ki third party client par cookie send nahi karna? meanwhile maine localstorage me token send kar diya, but mai cookies me token send karna chahta hu..
@JatinBedi69
@JatinBedi69 Жыл бұрын
Bhai solution mila kya
@DineshKumar-gt7xm
@DineshKumar-gt7xm 7 ай бұрын
​@@JatinBedi69did you get any solution?
@chetu9241
@chetu9241 Жыл бұрын
U got one subscriber ❤
@piyushgargdev
@piyushgargdev Жыл бұрын
Thank you so much ❤️
@Tensor08
@Tensor08 3 ай бұрын
2:00 what about storing user with their session id in redis instead of db
@Fe-ironman
@Fe-ironman 3 ай бұрын
what is the difference? what does reddis do?
@saeedahmed1177
@saeedahmed1177 7 күн бұрын
That is good way
@shamunkhatri6754
@shamunkhatri6754 3 ай бұрын
Really good video but It would be good if you compare localstorage vs cookies which is better, limitations like that.
@himanshuarora1910
@himanshuarora1910 9 ай бұрын
you should set the headers in ejs files only ,whats the use of creating them if we have to use postman only
@lovelymusic3549
@lovelymusic3549 Жыл бұрын
Sir please tell us about new react JS series any idea when it's starting?
@amanmaddhesia120
@amanmaddhesia120 3 ай бұрын
Too good brother
@CodeWavewithShahHussain
@CodeWavewithShahHussain 11 ай бұрын
But jwt be to scrent check krna ka liya br br new page reload phr datbase wala sa match krta ha?
@Ajmal_Hossain
@Ajmal_Hossain 11 ай бұрын
Another potential concern might arise when dealing with stateful authentication in the context of load balancing.
@coderkashif
@coderkashif Жыл бұрын
Bro you are great>>>
@knightcore4062
@knightcore4062 5 ай бұрын
im facing problem regarding non existing authorization header in server side gives Cannot read properties of undefined (reading 'split'), though using res.set('Authorization', `Bearer ${token}`); inside handleUserLogin async function to set the valus, help me to debug it any one...
@rztutul8824
@rztutul8824 6 ай бұрын
Thank you so much bro
@amandeep-pg3vb
@amandeep-pg3vb 3 ай бұрын
I didn't get authorization in req.headers, where am I wrong?
@learner5839
@learner5839 Жыл бұрын
Sir I am sending cookie by res.cookie and 'm able to see that cookie in network but not in application-->Cookies
@DineshKumar-gt7xm
@DineshKumar-gt7xm 7 ай бұрын
Did you find any solution for this problem?
@BiGryuuu
@BiGryuuu 5 ай бұрын
​@@DineshKumar-gt7xm did you?
@NOVAGAMING_08
@NOVAGAMING_08 4 ай бұрын
​@@BiGryuuu add with credentials: true in your frontend code and in backend use cors ( app.use(cors({ origin : '*', credentials: true, })) I think this might work for you
@abhishekgautam2289
@abhishekgautam2289 9 ай бұрын
kaise ho pankaj sir ham bhi yhi se padh rhe😁
@jackma9528
@jackma9528 8 ай бұрын
sir in my code it is showing can't read the properties of undefined after i switched to response section after cookie section, i copied exactly your code but it is not working, if someone know please help
@gautammali768
@gautammali768 3 ай бұрын
Bhaiya please make a video on cross site in which authorization header is sent to the backend my malicious website and produce hacking in the backend :)
@ApurvaKalvadeSDE
@ApurvaKalvadeSDE 11 ай бұрын
if one user logs in, but second user comes and copy your Authorization Bearer token or Cookie..... and that 2nd person then requests in the backend from his own laptop via the copied token/cookie. In this case, how to make it more secure ???? Can you please walk through this scenario ?
@Rahul-yr3up
@Rahul-yr3up 6 ай бұрын
He has said in his video that do not pass exact jwt token in cookie. Encrypt the token before passing it to the cookie
@reactjs-tutorial
@reactjs-tutorial 4 ай бұрын
how to get this code
@utkarshtenguria3836
@utkarshtenguria3836 8 ай бұрын
how we can take user information from tokens Piyush Garg
@utkarshtenguria3836
@utkarshtenguria3836 8 ай бұрын
but first time in mobile device we have to login how can we send token in request in first time does it not required?
@DozSparrow
@DozSparrow 7 ай бұрын
First time we need to login, after successful login server provide us token and subsequent we use provided token by server to communicate server
@ajput0018
@ajput0018 6 ай бұрын
bhaia do you have short notes of this lecture
@Rij-k6p
@Rij-k6p 6 ай бұрын
in browser based applications, in industry standard for authentication tokens are sent through cookies or response?
@theannonymous1430
@theannonymous1430 24 күн бұрын
Even Google is using cookies and you still have doubt 😂
@nishaaa_maurya
@nishaaa_maurya Жыл бұрын
In last, we use header base authentication, Will it work for browser? Because, it is not working for browser in my case.
@Vikassharma-rq5bh
@Vikassharma-rq5bh Жыл бұрын
Same.
@aazimsheikh279
@aazimsheikh279 7 ай бұрын
I am not getting authorization in the headers. Why?
@snehapatidar3122
@snehapatidar3122 7 ай бұрын
why it showing this? C:\Users\toshiba\Desktop\codes ode js\URL shortcut project\index.js:50 res.redirect(entry.redirectURL) ^ TypeError: Cannot read properties of null (reading 'redirectURL') at C:\Users\toshiba\Desktop\codes ode js\URL shortcut project\index.js:50:21 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) Node.js v21.7.3 [nodemon] app crashed - waiting for file changes before starting...
@rishabhgupta9846
@rishabhgupta9846 7 ай бұрын
Are you checking whether entry is null or not
@fatimaiqra2169
@fatimaiqra2169 3 ай бұрын
Thanks
@challarashmitha55
@challarashmitha55 8 ай бұрын
How can I get a token set in cookies in browser
@rishabhkedia9304
@rishabhkedia9304 7 ай бұрын
19:35 reponse
@shubhamdas6519
@shubhamdas6519 9 ай бұрын
Thanks for the video sir
@jatinsharma3792
@jatinsharma3792 Жыл бұрын
I am looking for the content on CSRF and CSP Headers in JAVA Filter. If you could provid it that would be really helpful.
@ApurvaKalvadeSDE
@ApurvaKalvadeSDE 11 ай бұрын
ye Manish Paul bhai hai kya ??
@gopinathk1485
@gopinathk1485 Жыл бұрын
Very useful video Piyush, but it could be helpul if you are teaching in English
@ManojTudu-sc5rb
@ManojTudu-sc5rb Жыл бұрын
Hi.. Need your help.. My req.headers does not contain authorization property
@Solo_playz
@Solo_playz 11 ай бұрын
Bro! You have to set your headers on your own like this that contain Authorization property here is the example! const headers = { 'Authorization':'Bearer ', 'Content-Type:'application/json', // just an example property you can add more property as you want! } now you can pass this header with your fetching methods like fetch or Axios Hope you get it
@pratyushpragyey7002
@pratyushpragyey7002 8 ай бұрын
well if you're using postman then you've to set the bearer token by going in headers
@ibntofajjal
@ibntofajjal Жыл бұрын
Thank's man
@ArpitJain-kc7bl
@ArpitJain-kc7bl 8 ай бұрын
What is the need to send bearer, as it is getting split
@pratyushpragyey7002
@pratyushpragyey7002 8 ай бұрын
It's a way in which bearer token is designed
@ArpitJain-kc7bl
@ArpitJain-kc7bl 8 ай бұрын
@@pratyushpragyey7002 is it just to make code readable or it is compulsory
@pratyushpragyey7002
@pratyushpragyey7002 8 ай бұрын
@@ArpitJain-kc7bl you don't have a choice to include it or not it's just how it's written whenever you'll pass the token in headers it will always be attached with word bearer
@ArpitJain-kc7bl
@ArpitJain-kc7bl 7 ай бұрын
@@pratyushpragyey7002 Okay brother thanks for clearing it
@ishikamalik4183
@ishikamalik4183 11 ай бұрын
excellent
@Ankit-xq3sl
@Ankit-xq3sl 10 ай бұрын
Tenks😊 gruudev
@KirtanPatel552
@KirtanPatel552 11 ай бұрын
still I got One error TypeError: Cannot read properties of undefined (reading 'split') if Anyone have solution for this...
@prateek_saxena2107
@prateek_saxena2107 11 ай бұрын
getting same error. were you able to find the solution?
@KirtanPatel552
@KirtanPatel552 11 ай бұрын
@@prateek_saxena2107 Not yet...
@pratyushpragyey7002
@pratyushpragyey7002 8 ай бұрын
because you've to set authorization property if you're using postman by setting bearer token
@RishiRajxtrim
@RishiRajxtrim Жыл бұрын
Adhyapak Diwas ki Shubhkamnaein! 🙏😇
@piyushgargdev
@piyushgargdev Жыл бұрын
Thank you so much 😄
@ridhamanand8519
@ridhamanand8519 Жыл бұрын
what are http only cookie ?
@nooneknowsme1370
@nooneknowsme1370 Жыл бұрын
this authorization thing got me confused like cookies, tokens, headers and all.
@vinaykumarc4156
@vinaykumarc4156 2 күн бұрын
bhai mene "split" ki jaga "spilt" likh diya aur uss error ko dund ne ke chakkar me mujhe 1/2 ghand lag gaya🥲🥲
@lovishduggal9064
@lovishduggal9064 Жыл бұрын
Bhaiya ji esse he videos aati rehye gii ?
@ShantanuSingh-nu7kv
@ShantanuSingh-nu7kv Жыл бұрын
haa
@GayatriGaikwad-m4e
@GayatriGaikwad-m4e 21 күн бұрын
please share the code
@sufiyanbaraskar234
@sufiyanbaraskar234 7 ай бұрын
Pls provide the source code always
@studyplans3783
@studyplans3783 7 ай бұрын
bade bahiya m soch kyo nahi pa rha hun😟
@ParashUkheda
@ParashUkheda Ай бұрын
ddd
@pradeeppop8201
@pradeeppop8201 Жыл бұрын
@piyushgarg sir
Authorization in NodeJS
19:33
Piyush Garg
Рет қаралды 54 М.
Difference between cookies, session and tokens
11:53
Valentin Despa
Рет қаралды 676 М.
Chain Game Strong ⛓️
00:21
Anwar Jibawi
Рет қаралды 41 МЛН
Каха и дочка
00:28
К-Media
Рет қаралды 3,4 МЛН
JWT Authentication in NodeJS
14:30
Piyush Garg
Рет қаралды 139 М.
Every React Concept Explained in 12 Minutes
11:53
Code Bootcamp
Рет қаралды 923 М.
100+ Web Development Things you Should Know
13:18
Fireship
Рет қаралды 1,6 МЛН
What are HTTP Headers in API
17:38
Piyush Garg
Рет қаралды 95 М.
Server Side Rendering with EJS and Node.JS
25:24
Piyush Garg
Рет қаралды 109 М.
What is JWT token and JWT vs Sessions
26:12
Chai aur Code
Рет қаралды 110 М.
Session Vs JWT: The Differences You May Not Know!
7:00
ByteByteGo
Рет қаралды 325 М.
This New Speculation API Will Make Your Site 10x Faster
20:55
Web Dev Simplified
Рет қаралды 76 М.
JavaScript Cookies vs Local Storage vs Session Storage
14:28
Web Dev Simplified
Рет қаралды 771 М.
Chain Game Strong ⛓️
00:21
Anwar Jibawi
Рет қаралды 41 МЛН