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

Поділитися
Вставка
  • Опубліковано 12 січ 2025

КОМЕНТАРІ • 256

  • @lucylu184
    @lucylu184 2 роки тому +5

    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.

  • @Aziqfajar
    @Aziqfajar 3 роки тому +24

    0:00 Bcrypt tutorial
    11:00 Cookie and session

  • @nicolasbarcelo4258
    @nicolasbarcelo4258 4 роки тому +12

    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 роки тому +6

      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 роки тому +2

      @@PedroTechnologies keep up!

  • @arrchi-ar
    @arrchi-ar 3 роки тому +10

    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.

  • @CAPS_AMERICA
    @CAPS_AMERICA 3 роки тому +5

    Thank you Pedro, this session/authentication setup is one of those that's difficult to sink in for me, but you made it easy to understand and code. You are a legend! If I can thumb this up a thousand times i'll do it!

  • @aarthikannan7559
    @aarthikannan7559 3 роки тому +2

    Thanks for this. I came here for JWT. But now I am binge-watching your course

  • @wamid455
    @wamid455 3 роки тому +2

    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

  • @ImDino
    @ImDino 3 роки тому +13

    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."

  • @ICTechProductions
    @ICTechProductions 4 роки тому +2

    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  4 роки тому +2

      Hahaha Awesome! I am glad you were able to fix it, I remember it took me days to solve this cors credential error!

  • @bogdanmarian3786
    @bogdanmarian3786 Рік тому +1

    You are the man Pedro, simple and well explained! Thank you!

  • @arfanyoga9110
    @arfanyoga9110 Рік тому

    i loved the way u make all your video kinda modular, it save so much time, i appreciate it

  • @wotizit
    @wotizit 3 роки тому +1

    Man u have every tutorial ever, thanks!

  • @saumyashah456
    @saumyashah456 3 роки тому +3

    Good work mate, pl keep posting videos and I'll keep learning!

  • @danielbravoleguia638
    @danielbravoleguia638 3 роки тому +2

    thanks bro this video helped me too much, small channel but with great content.

  • @haquyen5504
    @haquyen5504 4 роки тому +2

    thanks for your videos. they help me a lot. i'm still waiting for the final video xD

    • @PedroTechnologies
      @PedroTechnologies  4 роки тому +2

      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 роки тому +1

      @@PedroTechnologies oh thank you for your reply. i'm sure you'll do great xD

  • @shazud
    @shazud 4 роки тому +1

    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  4 роки тому

      Thanks for the sub! I remember trying to fix this error hahaha It took me ages too!

  • @apeiron4409
    @apeiron4409 4 роки тому +1

    Thank you for this awesome tutorial! Now I understand how login works!

  • @jahanshah1538
    @jahanshah1538 3 роки тому +1

    Your sublminal message worked, thanks for a very clear and concise video.

  • @samuelkamau1550
    @samuelkamau1550 2 роки тому

    thanks Pedro... most of this tutorials are rare to find... fullstack application for React,Node and MySQL... thanks for that

  • @DBDrumss
    @DBDrumss 3 роки тому +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 роки тому +2

      Thank you! I agree, should have added a part where a showed logout!

  • @andalonds
    @andalonds 3 місяці тому

    The set to true thing did it for me. Thank you so much

  • @bryanDaMazo16
    @bryanDaMazo16 3 роки тому +1

    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!

  • @josevitormarcelino6090
    @josevitormarcelino6090 Рік тому

    sou brasileiro e tenho um inglês bem intermediário, mas mesmo assim consigo te entender!! Muito obrigafo pelos vídeos, estão me ajudando pra caralho

  • @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

  • @snowflake.2604
    @snowflake.2604 Рік тому +1

    I had a query,
    when i hosted my backend with these session and cors settings, cookies and session are not being created but the api's are working fine
    any solutions?

  • @jeraldcolindon741
    @jeraldcolindon741 4 роки тому

    i figure the error in 18:17 mins of why did it insert a another Google acc in database because in the registration input it is not empty look 17:52 it grabs the info on the input and automaticali insert it in the database i spent hours of fixing that and i cant fix it hahaha i wish you can fix that out plss

  • @aristosxanthus658
    @aristosxanthus658 2 роки тому +1

    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?

  • @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?

  • @rowminds5431
    @rowminds5431 3 роки тому +1

    Is not a bad practice to have api on different port? Think about when using ssl ...

  • @dhwanitranjan7383
    @dhwanitranjan7383 3 роки тому +1

    I want to give an alert when the username exists while signing up. How can I do that?

  • @krasimirss
    @krasimirss 3 роки тому +2

    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

  • @prabhusarath7600
    @prabhusarath7600 3 роки тому

    Crystal clear, Nice tutorial

  • @lauratravin618
    @lauratravin618 2 роки тому +1

    Could you upload how to do Log out? I have been trying to find a tutorial and no one is working.

  • @oltirestelica522
    @oltirestelica522 2 роки тому

    Bro thank you so much you helped me out a lot with this video

  • @Shellflower1234
    @Shellflower1234 4 роки тому +1

    Your videos are the best!

    • @PedroTechnologies
      @PedroTechnologies  4 роки тому +1

      Thank you so much for the support! You have been my most loyal sub!

  • @ΑρηςΕμπαντα
    @ΑρηςΕμπαντα 2 роки тому

    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!

  • @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.

  • @siddharthvaishnav
    @siddharthvaishnav 3 роки тому +1

    how to check if user is already registered

  • @pablobaiz9401
    @pablobaiz9401 3 роки тому

    Thank you very much for saving me. Do you have a post where the credentials are explained in depth?

  • @MsCrycry
    @MsCrycry 3 роки тому +1

    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?

  • @apeiron4409
    @apeiron4409 3 роки тому +1

    Have some question about session. I made MERN stack app and followed the auth like this video (+ session store). And it works perfectly on local, but doesn't work when I deploy it to heroku and netlify. Cookie is not made on client, and when I console.log(req.session), nothing logs. Is there anything more to setup on this video except for session store?
    Thank you!

  • @teddy3387
    @teddy3387 4 роки тому +2

    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  4 роки тому

      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 4 роки тому

      @@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 4 роки тому +2

    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  4 роки тому

      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 4 роки тому

      @@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 4 роки тому +2

      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!

  • @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?

  • @flowingray
    @flowingray 4 роки тому +1

    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  4 роки тому

      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 4 роки тому

      @@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.

  • @bondi15
    @bondi15 2 роки тому

    Thanks for sharing your knowledge Pedro! Can you make a video comparing the setData on input to the data that we have in our database? for example to not create the same user in registration page.. im looking for documentation about that , but im not have lucky! :(

  • @dlefinc
    @dlefinc 3 роки тому +1

    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 роки тому +1

      Hahahaha sorry about that! This video is pretty old, I think i improved with time. I used to get nervous while recording hahaha

  • @florentindumitrache3251
    @florentindumitrache3251 4 роки тому +1

    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  4 роки тому +1

      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 роки тому +1

    You are the best! Bro ♥

  • @1minutespotlight
    @1minutespotlight 4 роки тому +1

    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  4 роки тому

      Thank you! What do you mean? Is it always set to false?

  • @tapanbhanot
    @tapanbhanot 2 роки тому

    Great video. Can you please explain how to secure the non-secure pages after the user has logged in ? Thanks.

  • @seyedruzaik5727
    @seyedruzaik5727 3 роки тому +1

    Nice. can you tell me how to use the app.get function in index.js for 'register' instead of 'login'?

    • @PedroTechnologies
      @PedroTechnologies  3 роки тому +1

      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....

  • @eduket7731
    @eduket7731 4 роки тому +1

    Hi pedro, thanks so much once again. You remember I asked about adding email confirmation? Am glad I was able to do it using nodemailer. Now how can I implement page redirect if someone is not logged in? Thanks in advance.. much love from kenya.

    • @PedroTechnologies
      @PedroTechnologies  4 роки тому

      Awesome! I am planning to make a video on email verification with nodemailer! Glad you got it! I have a video on protected routes where I talk a bit about this: ua-cam.com/video/qnH5KNtRYEI/v-deo.html

    • @maxiequa567
      @maxiequa567 3 роки тому

      @@PedroTechnologies Did you make this video yet Pedro? Your work is an inspiration to the community! Keep going :)

  • @mrjoony
    @mrjoony 4 роки тому +1

    I wish you would have shown how to store the session in mysql. Where is the session stored in your video?

    • @PedroTechnologies
      @PedroTechnologies  4 роки тому +1

      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?

  • @2005bgva
    @2005bgva 3 роки тому

    High Pedro, thanks for video. I would like to ask you wich is the 3 video? I can´t find it.

  • @vijaypatneedi
    @vijaypatneedi 4 роки тому +1

    Try to make MVC architecture medium size project using nodejs, MySQL, so that we can understand architecture as well

    • @PedroTechnologies
      @PedroTechnologies  4 роки тому +2

      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 роки тому +1

      @@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!

  • @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?

  • @EDROCKSWOO
    @EDROCKSWOO 3 роки тому +1

    nervmind i just saw your json one. I love you.. man you literally saved my life..where's the donate ?

    • @PedroTechnologies
      @PedroTechnologies  3 роки тому +3

      Hahaha no need to donate! Thank you though! I love posting this videos!

  • @Materofmuppets
    @Materofmuppets Рік тому

    I've got a question: what can I do to remove that cookie session?

  • @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 роки тому +1

      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.

  • @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??

  • @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

  • @nisharasenadheera8658
    @nisharasenadheera8658 4 роки тому +1

    Good tuto. And what is the color theme are you using for vscode?

  • @sh44ko58
    @sh44ko58 2 роки тому

    How to grap the cookies ? My session expires every 2 minutes ? For what ur creating cookies, when ur not using it ??

  • @nikidhan
    @nikidhan 3 роки тому

    Is there any continuation from this? I need to know how to destroy session

  • @thangnguyenvan9586
    @thangnguyenvan9586 3 роки тому

    can you explain to me why when i enter document.cookie in "console" it doesn't show cookies ?

  • @klincoder
    @klincoder 3 роки тому

    Thanks for the tutorial. How do you implement logout?

  • @harinim139
    @harinim139 3 роки тому +1

    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 роки тому +1

      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.

  • @patitorodri
    @patitorodri 2 роки тому

    Great, Pedro, really appreciate.

  • @gauravmavani1413
    @gauravmavani1413 4 роки тому +1

    How can i access that userid from different module...i am not able to use it please help...asap

  • @sharanjeetsingh4053
    @sharanjeetsingh4053 3 роки тому +1

    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😀

  • @kristiyanasparuhov4071
    @kristiyanasparuhov4071 4 роки тому +1

    When everything is set and the cookie is there, how can I logout the user/remove the session and the cookie ?

    • @PedroTechnologies
      @PedroTechnologies  4 роки тому

      Hey, you can just clear the cookie and delete the session! Something like req.session.destroy()

    • @kristiyanasparuhov4071
      @kristiyanasparuhov4071 4 роки тому

      @@PedroTechnologies but if i do a logou route isnt that a new request which the session doesnt exist in

  • @apeitpanthiya9578
    @apeitpanthiya9578 2 роки тому

    hello pedro can you recommend book for learning react..

  • @KeeviinBMTH
    @KeeviinBMTH 2 роки тому +1

    Thanks for the video!! amazing!!

  • @lucylu184
    @lucylu184 3 роки тому +1

    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 роки тому +1

      I made a video on this: ua-cam.com/video/tiAlSpyWIDs/v-deo.html

    • @lucylu184
      @lucylu184 3 роки тому

      @@PedroTechnologies Wow! Thanks

  • @oabouassy
    @oabouassy 4 роки тому +1

    Amazing tutorial bro, Thanks for your effort.
    I wanna know how to delete this cookie when i click on sign-out button ?

    • @PedroTechnologies
      @PedroTechnologies  4 роки тому +1

      THank you! You can just do req.session.destroy() to logout!

    • @oabouassy
      @oabouassy 4 роки тому

      @@PedroTechnologies you mean: make a new GET request to /logout and then do req.destroy ?

  • @siyabongamdletshe1543
    @siyabongamdletshe1543 2 роки тому

    Good tutorial Pedro as always,, where is the third one

  • @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 :) ua-cam.com/video/KgXT63wPMPc/v-deo.html

    • @wwt8027
      @wwt8027 3 роки тому

      @@PedroTechnologies Thanks bud, much appreciated.

  • @MuhammadAli-kd7ox
    @MuhammadAli-kd7ox 3 роки тому +1

    Hi loved the tutorial

    • @PedroTechnologies
      @PedroTechnologies  3 роки тому

      Thank you! I have a tutorial on how to deploy using those technologies!

    • @MuhammadAli-kd7ox
      @MuhammadAli-kd7ox 3 роки тому

      @@PedroTechnologies im using electron js to create desktop application with react as its front end and node as backend I ave use concurrently to start the application but i want to deploy it for build production so ow can i build react and node together for deploying it as build production

  • @lilianandres5272
    @lilianandres5272 3 роки тому

    Your function login() in your page Registration.js doesn't work bro.
    => can't read property of undefined

  • @max221b4
    @max221b4 3 роки тому

    ( axios.defaults.withCredentials = true ) this part gives me network error how to fix it please help me

  • @plumpeacherry7625
    @plumpeacherry7625 3 роки тому +1

    This is the second video right? May i know which one is the third video?

    • @PedroTechnologies
      @PedroTechnologies  3 роки тому +1

      Yes! Here is the 3rd: ua-cam.com/video/KgXT63wPMPc/v-deo.html

    • @plumpeacherry7625
      @plumpeacherry7625 3 роки тому

      @@PedroTechnologies just saved the playlist! thank you so much!

  • @gogugo3481
    @gogugo3481 4 роки тому +1

    you're the best. thank you very much

  • @tomasvila8555
    @tomasvila8555 4 роки тому +1

    great video but could you also put the github repo in the description?

    • @PedroTechnologies
      @PedroTechnologies  4 роки тому

      Thank you! Just updated the description to include the code!

    • @tomasvila8555
      @tomasvila8555 4 роки тому

      @@PedroTechnologies thanks bro!!

  • @MsCrycry
    @MsCrycry 3 роки тому +1

    Hi Pedro, is there any video about logout??

    • @PedroTechnologies
      @PedroTechnologies  3 роки тому +1

      To logout you can just clear the session!

    • @MsCrycry
      @MsCrycry 3 роки тому +1

      @@PedroTechnologies thanks a lot! I guess req.session.destroy() do the job? Right?

  • @mosajova7717
    @mosajova7717 2 роки тому

    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:

  • @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.

  • @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.

  • @pascallim3358
    @pascallim3358 2 роки тому

    Hello ! Can you tell me how to close a session ? You forgot how to tell it

  • @nightowl5804
    @nightowl5804 3 роки тому +1

    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.

  • @vanngalleta3421
    @vanngalleta3421 4 роки тому +1

    Hello sir. Will this be able to handle many users logged in?

    • @PedroTechnologies
      @PedroTechnologies  4 роки тому

      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

  • @panashelunga1444
    @panashelunga1444 3 роки тому

    Ca I have link to the previous video to this one

  • @markodimitrov625
    @markodimitrov625 3 роки тому +1

    Is there any explanation for logout?

    • @PedroTechnologies
      @PedroTechnologies  3 роки тому

      I should make a video on that! Just clear the cookies and delete the session!

  • @nagato6819
    @nagato6819 3 роки тому

    Thank you for this great tuto.

  • @sitdown.listen.3358
    @sitdown.listen.3358 2 роки тому +1

    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 😥

  • @YehudaTzin
    @YehudaTzin 3 роки тому +1

    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!

  • @yordankrushkov6958
    @yordankrushkov6958 3 роки тому

    It doesn't work with me... When I refresh I am using the session :(

  • @jinkachandrakiran1247
    @jinkachandrakiran1247 3 роки тому

    nice video well explaniation , Thanks man

  • @jagadeesanp6246
    @jagadeesanp6246 3 роки тому

    Can you add functionality like logout

  • @EDROCKSWOO
    @EDROCKSWOO 3 роки тому +1

    bro why couldn't this video combine the cookie, and json token this is a nightmare ;-;