Тёмный

Register and Login Tutorial | ReactJS, NodeJS, MySQL - Cookies, Sessions, Hashing 

PedroTech
Подписаться 214 тыс.
Просмотров 127 тыс.
50% 1

Checkout my discord for any questions: / discord
code: github.com/mac...
-
I decided to make 3 videos talking about login/register and authentication. This video is a very simple beginners version of a register/login page. It includes registering users, inserting data into a DataBase, and reading the data to allow a login. The second video will include sessions, passportJS, and hashing passwords. The final video will be on authenticating using JSON Web Tokens (JWT).
Tech Stack: ReactJS, NodeJS, Express, MySQL
-
Please leave a comment on what topic you guys want me to cover next!
SUBSCRIBE!
Social
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
Website: machadopedro.com
Twitter: / machadop1407
Instagram: / _pedro.machado_
Github: github.com/mac...
Email: machadop1407@gmail.com

Опубликовано:

 

28 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 256   
@lucylu184
@lucylu184 Год назад
Funny how I come back to this video. Previously I watched it to help me get into an intership. Now I'm watching it again in an amazing job. Thanks dude.
@nicolasbarcelo4258
@nicolasbarcelo4258 4 года назад
Pedro you`re a truly teacher, i love your videos because you explain so well and teach everything excellent, greetings from Argentina!
@PedroTechnologies
@PedroTechnologies 4 года назад
Your comment makes me extremely happy hahaha! I am loving the journey of making videos so far, and i am very happy I have been helping people! If you have any questions please let me know!
@nicolasbarcelo4258
@nicolasbarcelo4258 4 года назад
@@PedroTechnologies keep up!
@aarthikannan7559
@aarthikannan7559 3 года назад
Thanks for this. I came here for JWT. But now I am binge-watching your course
@PedroTechnologies
@PedroTechnologies 3 года назад
Awesome hahaha! Thank you for watching!
@ImDino
@ImDino 3 года назад
telling the client the user doesnt exist is a bad idea, you don't want to give hackers any hints. Just say wrong username or password no matter what, unless of course there's an error of sorts, in which case you just send "Oops! Something went wrong."
@KingsleyOkeze
@KingsleyOkeze Год назад
Helpful tip!
@Aziqfajar
@Aziqfajar 2 года назад
0:00 Bcrypt tutorial 11:00 Cookie and session
@bogdanmarian3786
@bogdanmarian3786 Год назад
You are the man Pedro, simple and well explained! Thank you!
@samuelkamau1550
@samuelkamau1550 2 года назад
thanks Pedro... most of this tutorials are rare to find... fullstack application for React,Node and MySQL... thanks for that
@siddharthvaishnav
@siddharthvaishnav 2 года назад
how to check if user is already registered
@saumyashah456
@saumyashah456 3 года назад
Good work mate, pl keep posting videos and I'll keep learning!
@PedroTechnologies
@PedroTechnologies 3 года назад
Thank you! I will continue hahaha
@haquyen5504
@haquyen5504 4 года назад
thanks for your videos. they help me a lot. i'm still waiting for the final video xD
@PedroTechnologies
@PedroTechnologies 4 года назад
Thank you for the kind words! I will try to make it as soon as possible! I have an interview this week so I won't have much time to post videos, but after the interview this will be the first video I put out!
@haquyen5504
@haquyen5504 4 года назад
@@PedroTechnologies oh thank you for your reply. i'm sure you'll do great xD
@wotizit
@wotizit 3 года назад
Man u have every tutorial ever, thanks!
@PedroTechnologies
@PedroTechnologies 3 года назад
Hahaha glad you like them!
@jahanshah1538
@jahanshah1538 3 года назад
Your sublminal message worked, thanks for a very clear and concise video.
@PedroTechnologies
@PedroTechnologies 3 года назад
Lmaooo glad it worked! Thank you for subbing!
@bryanDaMazo16
@bryanDaMazo16 3 года назад
Just make sure that telling that the user does not exist could expose the system to a security vulnerability by letting the attacker know that, let say an email used as user exists. It should be better treated as invalid credentials without given away which one is wrong the username or the password. Best regards!
@dhwanitranjan7383
@dhwanitranjan7383 3 года назад
I want to give an alert when the username exists while signing up. How can I do that?
@ΑρηςΕμπαντα
@ΑρηςΕμπαντα Год назад
I totally understood that video. So my question is, since you can do it with bcrypt and sessions, WHYYYYY everybpdy is using passport? what is passport doing? what is the actual reason of its existence? I ve seen so many tutorials and sitll cannot understand!
@apeiron4409
@apeiron4409 3 года назад
Thank you for this awesome tutorial! Now I understand how login works!
@PedroTechnologies
@PedroTechnologies 3 года назад
Awesome! Glad it helped!
@krasimirss
@krasimirss 3 года назад
Amazing video! Thank you, man! I'm new in React ... learned so much from you. Thanks, again! I just have problems publishing project in XAMP env. I couldn't start the project on Apache with MySql. Clients part started fine, but server side cannot respond on this env. I'll appreciate for explanation how to publish and setup this example on XAMP env. Thanks
@hanazouari3397
@hanazouari3397 2 года назад
Thank you Pedro for these videos, they're extremely helpful! Although can there be another video to this series on how to code logout?
@dlefinc
@dlefinc 3 года назад
Thank you very much for helping me setup my backend and frontend. Your tutorials really helped. Can you please slow down a bit though lol. It's hard ot keep up sometimes, and I consider myself a fast typer lol. I undersstand you're trying to keep[ the videos short but it makes it difficult to follow you.
@PedroTechnologies
@PedroTechnologies 3 года назад
Hahahaha sorry about that! This video is pretty old, I think i improved with time. I used to get nervous while recording hahaha
@sitdown.listen.3358
@sitdown.listen.3358 2 года назад
Awesome tutorials, so much knowledge, but ummm... If you could make a video about user authentication with crypto.js like in a Password Manager project, but to make all of verification and decryption on a server side... Ex. You type only a login and password, front-end sends it to server side and then server get data from db, decrypt it and compare data 🤔 I'm trying so hard, but can't make this work 😥
@EDROCKSWOO
@EDROCKSWOO 3 года назад
nervmind i just saw your json one. I love you.. man you literally saved my life..where's the donate ?
@PedroTechnologies
@PedroTechnologies 3 года назад
Hahaha no need to donate! Thank you though! I love posting this videos!
@filipmasny9778
@filipmasny9778 3 года назад
this year I finnishing work for bachelor's degree, and you are saving my life with all react, node and mysql stuff
@mauriciobento9763
@mauriciobento9763 2 года назад
it's so weird to have a DB connection in a js file. It seems wrong and not good for security.... just my thoughts.
@oltirestelica522
@oltirestelica522 2 года назад
Bro thank you so much you helped me out a lot with this video
@2005bgva
@2005bgva 2 года назад
High Pedro, thanks for video. I would like to ask you wich is the 3 video? I can´t find it.
@teddy3387
@teddy3387 3 года назад
Hi pedro thanks for the video, apparently i'm getting this error (or not?) {loggedin: false} keeps appearing in the response even though i can properly login and call the response with the data in it, but when i'm trying to call which users that logged in it's empty, i tried to see what happens in the cookies and it's surpsingly empty normally when you logged in the cookies will be filled with the name and value that've been set in the server but now it's not. oh just telling it's working wonderfully in localhost:3000, this happens in netlify and heroku as server.
@PedroTechnologies
@PedroTechnologies 3 года назад
Interesting, I've never seen this problem in production. So this is working on the localhost but not after its deployed right? I will search more on this!
@teddy3387
@teddy3387 3 года назад
@@PedroTechnologies here it is the code i tried to code all over it again and the result is still the same. github.com/izanagi4/webapp-library
@amitnino
@amitnino 3 года назад
Hello! thanks for the content!!! I'm trying to follow your guide and I'm not using Axios.. Instead I'm using async funcs and fetch from frontend. How do I allow cookies without Axios?
@PedroTechnologies
@PedroTechnologies 3 года назад
Hey, I believe that this is only necessary if ur using axios cause it causes issues. If you are getting a CORS error, lmk!
@amitnino
@amitnino 3 года назад
@@PedroTechnologies Ok, so I managed to get the cookie, the next problem is on 21:40 you create a route that checks if there's a current session, but I don't get that user key in session, I only have the cookie key. What did I miss? Thanks for all your help!
@amitnino
@amitnino 3 года назад
Figured it out.. In fetch() , In order to allow the cooky to go through the request you need to add fetch({ credentials: ' include ' }). Pedro keep up the great content! Thanks!
@Materofmuppets
@Materofmuppets Год назад
I've got a question: what can I do to remove that cookie session?
@jorgedavalos5663
@jorgedavalos5663 2 года назад
good tutorial!, i just made this with login form, redirect and protected routes using router v6, it gets complicated. any update on this tutorial eventually for something like that?
@pablobaiz9401
@pablobaiz9401 3 года назад
Thank you very much for saving me. Do you have a post where the credentials are explained in depth?
@parameswaranesnsce-cse9491
@parameswaranesnsce-cse9491 Год назад
Error is showing on session middle ware dehinning section
@mrjoony
@mrjoony 3 года назад
I wish you would have shown how to store the session in mysql. Where is the session stored in your video?
@PedroTechnologies
@PedroTechnologies 3 года назад
I agree! I will make a new video on this that will include everything from scratch!
@maxiequa567
@maxiequa567 3 года назад
@@PedroTechnologies Hey Pedro, You ROCK! Did you make this video yet?
@islamicinterestofficial
@islamicinterestofficial 3 года назад
If I want to publish my react app in the production, then I still have to use this way to keep the user logged in??? plz guide me
@vijaypatneedi
@vijaypatneedi 4 года назад
Try to make MVC architecture medium size project using nodejs, MySQL, so that we can understand architecture as well
@PedroTechnologies
@PedroTechnologies 4 года назад
Funny enough i'm currently working on a startup using the MVC architecture hahaha Its an awesome idea! Probably next week I can make a video on the topic!
@vijaypatneedi
@vijaypatneedi 4 года назад
@@PedroTechnologies even I'm working in start-up and building application using MVC architecture, but stuck at few places...so I asked you 😅
@PedroTechnologies
@PedroTechnologies 4 года назад
@@vijaypatneedi Thats awesome! I wouldn't say I am that experienced with it, as I first learned it for my job. But I know the fundamentals behind in a large scale backend, so I can definitely make a video about it!
@lovermira7465
@lovermira7465 3 года назад
Thank you for this wonderful vedio!!! But I also want to know how to logout, I just can't remove my cookie by using react, any ideas??
@gauravmavani1413
@gauravmavani1413 3 года назад
How can i access that userid from different module...i am not able to use it please help...asap
@PedroTechnologies
@PedroTechnologies 3 года назад
Hey, wdym a different module? Like another file?
@seyedruzaik5727
@seyedruzaik5727 3 года назад
Nice. can you tell me how to use the app.get function in index.js for 'register' instead of 'login'?
@PedroTechnologies
@PedroTechnologies 3 года назад
I have a video on registration! It's the first of this series!
@seyedruzaik5727
@seyedruzaik5727 3 года назад
@@PedroTechnologies i watched it bro but there is no app.get function for registration
@seyedruzaik5727
@seyedruzaik5727 3 года назад
I just want to send a message to the front end if a user enters an existing username in registration form....
@flowingray
@flowingray 3 года назад
Hi Pedro, I have a question. Why my web app can only access server from the host computer and other devices from the same LAN would always be blocked? (Getting XMLHttpRequest error) I suspect it's something to do with my CORS config but I don't know more details. Need some help. Thanks!
@PedroTechnologies
@PedroTechnologies 3 года назад
Hey, if u are getting a CORS error, did u apply the cors middleware? Like, did u put something like this: app.use(cors())?
@flowingray
@flowingray 3 года назад
@@PedroTechnologies Yes I did. It is weird because session works perfectly on the host computer. But when I use cell phone browser or simply another computer to test my website, I'm getting error, and simply can't get resource from the server.
@sharanjeetsingh4053
@sharanjeetsingh4053 3 года назад
hi, that was very helpful but what if I want to logout when I press the logout button!
@PedroTechnologies
@PedroTechnologies 3 года назад
Thank you! You can destroy the session and clear the cookies.
@sharanjeetsingh4053
@sharanjeetsingh4053 3 года назад
@@PedroTechnologies okay, thanks for clarification, love your channel😀
@MsCrycry
@MsCrycry 3 года назад
Hi Pedro, if I put axios.default.withcredentials in the child component, will it make all axios requests in the app including the parent’s one need the credential?
@PedroTechnologies
@PedroTechnologies 3 года назад
I believe so, but I am not sure tbh!
@lilianandres5272
@lilianandres5272 3 года назад
Your function login() in your page Registration.js doesn't work bro. => can't read property of undefined
@klincoder
@klincoder 3 года назад
Thanks for the tutorial. How do you implement logout?
@max221b4
@max221b4 3 года назад
( axios.defaults.withCredentials = true ) this part gives me network error how to fix it please help me
@harinim139
@harinim139 3 года назад
Hey Pedro! great video. Helps a lot. I'm trying to integrate machine learning python code with my react web app. Any suggestion on how to go about it?
@PedroTechnologies
@PedroTechnologies 3 года назад
I am not that experienced with ML, but u can create a ML that runs on a sevrer and sends the data to a flask api that sends the data to ur react app
@harinim139
@harinim139 3 года назад
@@PedroTechnologies Thank you so much.
@mayurjogiya7491
@mayurjogiya7491 2 года назад
Could anyone send me the video for clearing the session and logout the user when he click a button.
@wwt8027
@wwt8027 3 года назад
Hi Pedro, amazing stuff there, but I couldn't find the whole series as you said its 3 part video thanks.
@PedroTechnologies
@PedroTechnologies 3 года назад
Here it is :) ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-KgXT63wPMPc.html
@wwt8027
@wwt8027 3 года назад
@@PedroTechnologies Thanks bud, much appreciated.
@KeeviinBMTH
@KeeviinBMTH 2 года назад
Thanks for the video!! amazing!!
@nightowl5804
@nightowl5804 3 года назад
Nice video👍👍 but how to implement login and authentication with react native, node js and mysql
@PedroTechnologies
@PedroTechnologies 3 года назад
I am not that experienced with React Native, but I imagine it would be very similar.
@lucylu184
@lucylu184 3 года назад
if loggedIn is true, and I'm on the login page, I want to redirect the user to the home page ('/home'). Do you happen to know how to do this?
@PedroTechnologies
@PedroTechnologies 3 года назад
I made a video on this: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-tiAlSpyWIDs.html
@lucylu184
@lucylu184 3 года назад
@@PedroTechnologies Wow! Thanks
@oabouassy
@oabouassy 3 года назад
Amazing tutorial bro, Thanks for your effort. I wanna know how to delete this cookie when i click on sign-out button ?
@PedroTechnologies
@PedroTechnologies 3 года назад
THank you! You can just do req.session.destroy() to logout!
@oabouassy
@oabouassy 3 года назад
@@PedroTechnologies you mean: make a new GET request to /logout and then do req.destroy ?
@nagato6819
@nagato6819 2 года назад
Thank you for this great tuto.
@gogugo3481
@gogugo3481 4 года назад
you're the best. thank you very much
@PedroTechnologies
@PedroTechnologies 4 года назад
Thank you so much!
@tomasvila8555
@tomasvila8555 3 года назад
great video but could you also put the github repo in the description?
@PedroTechnologies
@PedroTechnologies 3 года назад
Thank you! Just updated the description to include the code!
@tomasvila8555
@tomasvila8555 3 года назад
@@PedroTechnologies thanks bro!!
@Sanguchazo
@Sanguchazo Год назад
Hello, does anyone had the issue where the resquest sent by other routes than the one the session was created on, will not send the cookie with them? even with withCredentials : true? can't figure out why and i've been wih this for days
@patrykK1028
@patrykK1028 Год назад
Same here. Also the React part doesn't work for me like at all (only the blank HTML loads), so I had to make my own front-end
@lavaboi4828
@lavaboi4828 Год назад
I had the same issue, for me i forgot that I had extra app.use(cors()) at the bottom, removing it fixed my issue.
@YehudaTzin
@YehudaTzin 3 года назад
why do i get TypeError: Cannot set property 'user' of undefined
@PedroTechnologies
@PedroTechnologies 3 года назад
Maybe there is some error in getting the data from the db. Where does this error appear? In the browser or in the server?
@YehudaTzin
@YehudaTzin 3 года назад
@@PedroTechnologies in the vs code terminal: req.session.user = result; ^ TypeError: Cannot set property 'user' of undefined
@YehudaTzin
@YehudaTzin 3 года назад
@@PedroTechnologies I found the answer Basically I divide the query into several pages. There is the page of the routers that reads the controller page where the sessions are performed. What I had to do was pass some of the settings and declare them on the page of the routers and not of the controllers. Also, because of the progress in the versions, So instead of writing about the bodyParser, Need to write: app.use (express.json ()); app.use (express.urlencoded ()); And of course thank you so much for the reference and the video you made. You have excellent explanatory power. Keep it up and succeed!
@Chempox
@Chempox 3 года назад
Hi pedro, I got an error in the bcrypt.compare function, the code detects when the username or password is wrong and when the user is not in the data base, but when I enter the correct password it keeps telling me wrong user or password when im putting the correct one. I already check my code and it is the same as yours, do you know why this is happening?
@Chempox
@Chempox 3 года назад
I already fixed the error, the only problem was that my maximum characters in my database were 50, so I raised them to 150 and it already works.
@panashelunga1444
@panashelunga1444 3 года назад
Ca I have link to the previous video to this one
@MsCrycry
@MsCrycry 3 года назад
Hi Pedro, is there any video about logout??
@PedroTechnologies
@PedroTechnologies 3 года назад
To logout you can just clear the session!
@MsCrycry
@MsCrycry 3 года назад
@@PedroTechnologies thanks a lot! I guess req.session.destroy() do the job? Right?
@jagadeesanp6246
@jagadeesanp6246 3 года назад
Can you add functionality like logout
@vanngalleta3421
@vanngalleta3421 3 года назад
Hello sir. Will this be able to handle many users logged in?
@PedroTechnologies
@PedroTechnologies 3 года назад
This is supposed to work with more than one user, however it is not the most secure. You need to have authentication in every api call, so I use JWT's to do that. This video is the second of a 3 video series about authorization and authentication, the third video is called authentication with JWT
@amir-ww4dd
@amir-ww4dd 5 месяцев назад
thank's bro from algeria
@refaeldimri8007
@refaeldimri8007 3 года назад
do not we use jwt?
@fitiavanarex
@fitiavanarex Год назад
nice tuto thanks a lot
@cielocapalini
@cielocapalini 3 года назад
Thanks!
@PedroTechnologies
@PedroTechnologies 3 года назад
Thank you so much for the support!
@fikridzakir4185
@fikridzakir4185 3 года назад
how to logout ?
@PedroTechnologies
@PedroTechnologies 3 года назад
You can just destroy the session!
@karangovindaraj8844
@karangovindaraj8844 3 года назад
Just add the session destroy part too.. please
@Ribyum
@Ribyum 2 года назад
You didn't show how to make a proper logout... :(
@eusouluao
@eusouluao 3 года назад
Cara, será que você pode me ajudar? Desde ontem não consigo fazer o login validar, o registro funciona, a senha é salva com o hash no banco de dados, mas sempre que tento fazer o login ele retorna a mensagem de erro, no node meu código tá assim: app.post('/api/login', (req, res) => { const login = req.body.login; const password = req.body.password; db.query( "SELECT * FROM users WHERE user_login = ?", login, (error, result) => { if (error) { res.send({ error: error }) } if (result.length > 0) { bcrypt.compare(password, result[0].password, (error, response) => { if (response) { res.send(response) } else { res.send({message: "Deu ruim"}) } }) } else { res.send({ message: "User not found" }) } } ) }) E no react a função: const submitValues = () => { Axios.post('localhost:3001/api/login', { login: login, password: password }).then((response) => { if (response) { setLoginStatus(response.data.message); console.log(response) } else { console.log(response.data[0].login) } }) } Sempre retorna a mensagem 'deu ruim', vc sabe o pq?
@eusouluao
@eusouluao 3 года назад
Resolvi já, tava passando uma variavel errada do back pro front
@minimeimei
@minimeimei 4 года назад
I was waiting for this, thanks! Had issues with session. Can I ask if want to log out and kill loggedIn session, how do I go about that?
@PedroTechnologies
@PedroTechnologies 4 года назад
I should have included that in the video hahaha I forgot. To logout you would make a route called /logout and write something like: app.get('/logout', (req, res)=> { if (req.session.user) { res.clearCookie('userId'); res.send({loggedIn: false}) } }
@minimeimei
@minimeimei 4 года назад
Thanks!
@PedroTechnologies
@PedroTechnologies 4 года назад
Your welcome, any questions lmk!
@minimeimei
@minimeimei 4 года назад
Hi Pedro, I need help on how after successful login, will redirect to another page?
@minimeimei
@minimeimei 4 года назад
and maintain that loggedIn = true when on other pages until loggedOut
@grldfaure
@grldfaure 3 года назад
Thank you
@PedroTechnologies
@PedroTechnologies 3 года назад
Thank you For Watching!
@fernandotrovao4093
@fernandotrovao4093 2 года назад
What I find interesting is: " you write this here but you don't need to know what it means...". Maybe you can't explain what it is...
@juandavidgomezrestrepo6110
@juandavidgomezrestrepo6110 3 года назад
Thanks a lot
@dsa66253
@dsa66253 3 года назад
10:30 for session
@TitoTabs
@TitoTabs 3 года назад
is there anyone who can help me on creating a logout for this?
@omikhse4438
@omikhse4438 2 года назад
25:50 LMFAOO
@xghoststeerx9366
@xghoststeerx9366 3 года назад
gracias rey.
@abhishekrawat8579
@abhishekrawat8579 3 года назад
awesome video🔥🔥
@PedroTechnologies
@PedroTechnologies 3 года назад
Thanks 🔥
@mamaafrica2512
@mamaafrica2512 2 года назад
25:08 response.data.loggedin == true :Ddddddd chill bro
@nevezcaf
@nevezcaf 4 месяца назад
se tu n for brasileiro eu sou maluco
@arvindhk4713
@arvindhk4713 2 года назад
This video was really helpful, thanks a lot. I did run into an issue. Could you please help in this?. Currenly using ["express": "^4.17.1", "express-session": "^1.17.1",] but getting an error in line 86 => req.session.user = result; says Property 'user' does not exist on type 'Session & Partial'.ts(2339) have tried to searching a fix but nothing helped so far
@arrchix
@arrchix 3 года назад
Great video, man, but I've noticed one thing worth specifying: in 16:03 you said 'this is in milliseconds", and set the value to 60 * 60 * 24. It looks like you forgot to multiply this by 1000.
@PedroTechnologies
@PedroTechnologies 3 года назад
Good point! Sorry about that!
@DBDrumss
@DBDrumss 3 года назад
Great work!, very complete, it would have been great if you created a button to log out and close the session. Keep it up!
@PedroTechnologies
@PedroTechnologies 3 года назад
Thank you! I agree, should have added a part where a showed logout!
@danielbravoleguia638
@danielbravoleguia638 3 года назад
thanks bro this video helped me too much, small channel but with great content.
@PedroTechnologies
@PedroTechnologies 3 года назад
Glad to hear it!
@ICTechProductions
@ICTechProductions 3 года назад
Thank you very much ❤️, i spent hours searching for the problem of Cors credentials then i remembered that you have a video of Login where you get session using axios and it solved it
@PedroTechnologies
@PedroTechnologies 3 года назад
Hahaha Awesome! I am glad you were able to fix it, I remember it took me days to solve this cors credential error!
@wamid455
@wamid455 3 года назад
Oh my God, why are you so smart? Of course, I'd got a lot of stuff to do starting from preparing front and backend, but, despite this, you helped me a lot! Much love from Kazakhstan.
@PedroTechnologies
@PedroTechnologies 3 года назад
Lmaoo I am not that smart! Programming is about trusting the process and continuing working!
@wamid455
@wamid455 3 года назад
@@PedroTechnologies Please, can you help me? I've got some troubles with making logout: I tried to use Axios, fetch, on client side and app.get/post on server side with req.session.destroy(); Nothing happens, cookie session still running
@lauratravin618
@lauratravin618 2 года назад
Could you upload how to do Log out? I have been trying to find a tutorial and no one is working.
@Materofmuppets
@Materofmuppets Год назад
I'm trying to create a logout button to delete the cookie but I can't find the way, could you help me please?
@aristosxanthus658
@aristosxanthus658 2 года назад
Thanks so much for your insight! I was wondering where req.sessions comes from. Is that a part of the request object, or is it added by the middleware?
@andalonds
@andalonds 6 дней назад
The set to true thing did it for me. Thank you so much
@swagistian5594
@swagistian5594 Год назад
Cookie is sent but is not saving to cookie
@patrykK1028
@patrykK1028 Год назад
How do you know it's sent? I also have a problem with cookies, they don't appear on frontend and idk if its frontend or backend issue
@mosajova7717
@mosajova7717 Год назад
Anyone knows like, how could i use that when im loging in, and im redirecting to my Homepage, that i can display it there, like logged in as:
@sh44ko58
@sh44ko58 Год назад
How to grap the cookies ? My session expires every 2 minutes ? For what ur creating cookies, when ur not using it ??
@채종민-c7m
@채종민-c7m Год назад
cicked subscribe and like! Thank you this video helps me a lot
@yordankrushkov6958
@yordankrushkov6958 2 года назад
It doesn't work with me... When I refresh I am using the session :(
@shazud
@shazud 3 года назад
BIG LIKE BIG SUBSCRIBE! I had a problem with the cookies and I searched for a long time to fix it and the credentials parameter did the trick. Thanks!
@PedroTechnologies
@PedroTechnologies 3 года назад
Thanks for the sub! I remember trying to fix this error hahaha It took me ages too!
@apeitpanthiya9578
@apeitpanthiya9578 2 года назад
hello pedro can you recommend book for learning react..
@김태현-z9r1k
@김태현-z9r1k 3 года назад
Thank you for the good video. I have a question that I need to log in and { loggedIn: false } in the console window, but it's fixed to false. I don't see a separate error log. I don't know how to check. No, there isn't.
@PedroTechnologies
@PedroTechnologies 3 года назад
Thank you! What do you mean? Is it always set to false?
@florentindumitrache3251
@florentindumitrache3251 3 года назад
Hi, Pedro. I have a question, if I login to the main page and travel around the website like products page and more. I will be still login to the site?
@PedroTechnologies
@PedroTechnologies 3 года назад
Hey, it depends on how you save your login state. I recommend creating a login context state that keeps track if u are logged in. But at the same time, store your login info in the cookies or session storage to make sure you have access later on.
@shadmanfatin777
@shadmanfatin777 3 года назад
You are the best! Bro ♥
@MrNazar1000
@MrNazar1000 2 года назад
I am confused, the session cookies did kind of work for me, but they did not expire, and after something I did they totally stopped working. I did some research and found that since 2020 March a property "sameSite" was mandated and you need a https connection for it to be able to pass cookies to third party, which means it won't work on non https localhost. So it should not be possible for the cookies to work on your localhost since I assume that video was made past that date, unless mac uses https localhost or something ? Idk, perhaps my code is wrong.... Lol, confusion haha.
Далее
Difference between cookies, session and tokens
11:53
Просмотров 633 тыс.
FATAL CHASE 😳 😳
00:19
Просмотров 709 тыс.
I tried 8 different Postgres ORMs
9:46
Просмотров 413 тыс.
Why aren't you using Fastify? Or Koa? Or NestJS?
9:58
Node.js Passport Login System Tutorial
36:28
Просмотров 1 млн