Setting up cookies in a React and Express App (locally and in production)
Вставка
- Опубліковано 5 жов 2024
- In this video I explain how you can set cookies from an express Backend to a react front end.
This video explains how you can set cookies locally and in production on a https protocol.
I cover things like the cookie same site attribute and how you should set them up.
Link to How to Deploy a Mern stack application on a server just like heroku:
• How to deploy a React ...
Gist to starting react project: gist.github.co...
Gist to complete Project:
gist.github.co...
after watching your video i fall in love. you save me huge amount of stress. thank you so much
Everywhere on the web talks about this setup but never the Proxy for both client/server. Thanks 🎉
Thanks for the assistance I have been battling with the cookie not showing up in the application tab thinking the cookie was not been sent this video just solved a problem I have been on for days now
Thanks keep it up
Dude!!!! After two four days of hitting my head on the wall!! so simple... THANK YOU!🤩
I forgot to add "withCredentials":true in the POST request as well
Thanks Man!
Thankyou so much bro,Real i was struggling from 2 days because of you i made express-session and passport-local strategy able to work.Thanks a lot
Hi, great stuff man, I was struggling for hours, and after your video I done more in 20min than entire day today because of the two options for cors and client side headers... Thank you so much, you have a subscriber.
Thanks Bro, I try to set cookie from yesterday but after watch your video i finally got it. 😁
Thank you for the video I managed to solve this problem I've been having for 3 days
Thank you very much. Solved my issue with the proxy option.
thanks for your tutorial which save my cors problem just in time!!😆
Man thank you so much. I really needed this!!
Thanks a lot this will solve my issue
Thanks Man, you solved my problems
Great tutorail you solve big problem
man you saved my day
thak you bro . this video was very helpful
Absolutely Amazing Video!!!❤
very helpful and informative video.
Dude, You are a star
I cant make it work with Next.js on frontend / Express.js on backend. Set-Cookie is preent on response but its not being set no Chrome/Firefox. As soon as I put the 'withCredentials: true' I get CORS error ('strict-origin-when-cross-origin'). On postman it gets set. I tried every single possible config combination, no idea what else to do. I haven't used express-session. Any thoughts?
same issue. Did you get any fix?
@@advay6449 yes, my error was that I had on my express app.options('*' cors()) and that sets default setting for every route on my express app. I removed that line
@@abelmurua6980 okay, ill try that out
had to use subtitles!! but video is great
how get cookie store browser in reactjs from nodejs backend program?
Thanks so much for this.
Hi, thanks for the video. I try to exactly do the same with the video. In the production site, whenever I open the site in desktop it works well, but if I open from the phone (Iphone and Samsung), I always got an error, error that I mean is cookie is not stored in the mobile browser. Anyone face same issue or can help?
Thankyou so much!
Thanks
Thank you so much
Thank you for this amazing tutorial. Quick question. Does this still work if the frontend is on firebase and backend on Heroku. Thanks in advance.
Yes this should work as long as its over a HTTPS connection
@@webbase8836 Thank you very much, I read that you cannot send cookies over different domains, however, I do see people doing it, so I was confused. Thank you again!
That means everytime to read cookie I've to make a http request to server. Wouldn't it degrade the performance ? Any alternative way to do the same .?
You can just opt in for Json web tokens
hi man! nice video worked for me,
Just a small improvement for your videos, make them shorter and when everything works, so your audience wants to enter to see 10 minutes instead of 35m (that sells a lot) and if you think necessary, you can upload a second video without editing for the curious user.
happy codding!
I for one enjoy seeing the errors and the way to go around them
@@bonganintshangase6051 yep, but not when you are in a hurry! haha
Actually, the errors are the best part, at least for me.
errors are very important
thanks you
thanks a lot , you debbug me