Understanding Authentication in Node.js - Sessions and Cookies - Web Development Concepts Explained

Поделиться
HTML-код
  • Опубликовано: 1 окт 2024
  • Understanding Authentication using Cookies and Sessions is a very important topic to understand in web development. I will be using Node.js and Express and MongoDB to build a very basic example of login and register.
    In this video I try my best to explain the basic workings of how this process of sessions and cookies work together to make it possible to authenticate users in you website.
    I hope you enjoy the video and if you did don't forget to like and subscribe and then I will see ya'll in the next one....🤓
    Express-Session Docs:
    www.npmjs.com/...
    Connect-MongoDB-Session Docs:
    www.npmjs.com/...
    If you want to know how To implement Authentication when building a RESTfull API go check out my video on this.
    My personal website
    =================
    www.thefullsta...

Комментарии • 290

  • @the_full_stack_junkie
    @the_full_stack_junkie  4 года назад +40

    GitHub Repo for the project code in the video 🤓:
    github.com/LloydJanseVanRensburg/Authentication_Node_Sessions_Cookies
    Hope you liked this video. In the next authentication video I will be handling authentication from a API using JWT check it out in the web development concepts explained playlist!
    Have a great day peace out...

    • @engespress
      @engespress 3 года назад +1

      Good tutorial. Thanks!

    • @elyasarkin0991
      @elyasarkin0991 2 года назад +1

      Awesome and clean tutorial thank you

    • @mushfiqurniaz_
      @mushfiqurniaz_ 20 дней назад

      I was about to comment if you don't put in source code you're gay but thanks

  • @emilejuniorada6670
    @emilejuniorada6670 3 года назад +22

    48hours. I've been struggling to understand those sessions things for 48 hours, making my ways through bunch of tutorials, and you just saved me. more follower

  • @Blazing_Hotmagma
    @Blazing_Hotmagma Год назад +4

    Think bros struggles with the Rs 💀

  • @muhammadjunaid3684
    @muhammadjunaid3684 3 года назад +18

    What an amazing tutorial!
    I couldn't learn about sessions without this tutorial.
    Really love that 😍😍😍

  • @jesusenriqueperez5307
    @jesusenriqueperez5307 3 года назад +42

    I've watched many videos about express-session and you are the first person that explains what is that cookie's purpose. Thank you

    • @the_full_stack_junkie
      @the_full_stack_junkie  3 года назад +6

      Thanks so much very glad it helped champ

    • @sameerswankar
      @sameerswankar 8 месяцев назад

      what happens when i open two tabs and login from different account on each of them, will the cookie gets overwritten ? How will that work

  • @Abhisheky418
    @Abhisheky418 3 года назад +10

    This was so clean , precise and to the point just loved it. thankyou for making this.

  • @florin1335
    @florin1335 3 года назад +7

    Bro, I watched a few tutorials on this topic but yours was the best.

  • @unessss
    @unessss 3 года назад +5

    I highly recommend this video to beginners... He explained EVERY line and word and code as simple as they could be...
    wish he covered the OAuth tho (like google login or other authenticating platforms )

  • @mohammedjoubba318
    @mohammedjoubba318 3 года назад +2

    thank you , awesome explanation

  • @yehudahimelfarb5935
    @yehudahimelfarb5935 2 года назад +2

    wow...excelent explication !!! 👏

  • @pankajjoshi8292
    @pankajjoshi8292 3 года назад +4

    what is diff between EXPRESS and EXPRESS-SESSION?

    • @the_full_stack_junkie
      @the_full_stack_junkie  3 года назад +1

      Express is web framework for node
      Express-session is a middleware package used for reading and crwating sessions

  • @ajwadmajed3551
    @ajwadmajed3551 2 года назад +1

    A very Important question about this tutorial... how do i post the sign up (form) in Clientside Javascript with http post request? i don't see you using it in this tutorial ? do i need a fetch API on the client-side javascript?

  • @blank2782
    @blank2782 3 года назад +3

    Amazing, clearly explained everything. Thankyou so much for this video.

  • @SanjuKumar-ye8xz
    @SanjuKumar-ye8xz 2 года назад +1

    Very simply explanation. Thank dude☺️☺️☺️

  • @vladosononame6376
    @vladosononame6376 3 года назад +2

    Why 3 people disliked it, they have no soul

  • @__peanut__butter28
    @__peanut__butter28 3 года назад +4

    this video simplified the cookie session, thanks a lot live more!

  • @GaBlack-wo9vx
    @GaBlack-wo9vx 5 месяцев назад +1

    This video is really helpful, thank you so much

  • @RMBK243
    @RMBK243 5 месяцев назад +1

    amazing very helpful thanks

  • @rayensaidani600
    @rayensaidani600 2 года назад +1

    "so tommy shelby is a web dev now"
    think you tho it was very helpful

  • @harrisonvijay8897
    @harrisonvijay8897 3 года назад +3

    Thanks a lot for this video. It helped me, a beginner, understand cookies and sessions. Keep on posting!

  • @rules654
    @rules654 2 года назад +1

    great work made, helped in my project.

  • @ravipayasi6875
    @ravipayasi6875 2 года назад +1

    Amazing explanation, liked and subbed

  • @mohamadabdeen6906
    @mohamadabdeen6906 10 месяцев назад +1

    great video ,thanks very much

  • @Eddie4k
    @Eddie4k 2 года назад +1

    Wow best video I have found tbh on this topic

  • @VijayTamada
    @VijayTamada Год назад +1

    Nice & to the point! Great!!

  • @manishbhardwaj4587
    @manishbhardwaj4587 8 месяцев назад +1

    love it, thank you Teacher!

  • @magdyismail946
    @magdyismail946 Год назад +1

    Thank you
    This was very useful for me

  • @facundoloto1514
    @facundoloto1514 3 года назад +2

    this video help me understand the seccions and the cookies of login and logout,after hours and days search ,thanks so much

  • @iganic7574
    @iganic7574 Год назад +2

    This is surely the easiest video about authontication 😍. Thanks bro your are amazing

    • @sameerswankar
      @sameerswankar 8 месяцев назад

      what happens when i open two tabs and login from different account on each of them, will the cookie gets overwritten ? How will that work

  • @walideker2253
    @walideker2253 7 месяцев назад +2

    bruh tysm i hve been strugling over 2 weeks only ur video did it
    tysm

  • @charansrinivas3149
    @charansrinivas3149 3 года назад +2

    Not working with reactjs. Cookies is not settinh up in browser

  • @felakos1568
    @felakos1568 3 года назад +3

    Very useful lesson and accessible presentation. Congratulations,
    you surpassed the whole Internet. Thank you sir.

  • @mdjahidulislam9205
    @mdjahidulislam9205 2 года назад +1

    everything is fine but in mobile browser cooke get destroyed automatically. if i close the browser and open it again.

    • @the_full_stack_junkie
      @the_full_stack_junkie  2 года назад

      Yes this is so. Unless you set the expires value on the cookie then ut will only be removed once it has expired

  • @0xyz
    @0xyz 3 года назад +1

    Great Video, Thanks for this

  • @ManeelxAkosAdor
    @ManeelxAkosAdor 3 года назад +5

    outstanding tutorial man, thanks so much I learned a lot

  • @stuff3704
    @stuff3704 Год назад +1

    thank you, great explanation

  • @ajwadmajed3551
    @ajwadmajed3551 2 года назад +1

    quick question.. do we need a fetch() API method to send the post request correctly? or is it correct to just use this tutorial ?

  • @AmanRaj-ho5qh
    @AmanRaj-ho5qh 2 года назад +1

    The explanation is very clear

  • @hand-somepaws9285
    @hand-somepaws9285 3 года назад +2

    Perfectly explained. More information given. This is the best video I ever searched for.

  • @vikram87in
    @vikram87in 2 года назад +1

    great video... thanks 😍

  • @harshad1704
    @harshad1704 3 года назад +2

    one of the clear video on the express session very very thank you Junkie

  • @ashfaquemamdu4582
    @ashfaquemamdu4582 2 года назад +1

    Thanks man it was helpful

  • @drupalguy
    @drupalguy 2 года назад +1

    Good tutorial. Thank you

  • @katakuri8350
    @katakuri8350 3 месяца назад +1

    thank you so much

  • @indianafootballer3257
    @indianafootballer3257 3 года назад +2

    thank you... so understandable.. best taught ❤️❤️

  • @codefork94
    @codefork94 2 года назад +1

    Dude!!!! I finally get it!!!!

  • @souravvashisht7153
    @souravvashisht7153 2 года назад +1

    Thank you very Much.

  • @samjacker
    @samjacker 4 месяца назад +1

    thank you so much

  • @carlsagan9808
    @carlsagan9808 Год назад +1

    Great sessions tutorial!

  • @quanduong3390
    @quanduong3390 2 года назад +1

    Thank you so much for making this. You explained it well. Thank you

  • @techyguyaditya
    @techyguyaditya 11 месяцев назад

    Something's bugging me here. In the middleware isAuth, where does it check if isAuth true? Browser cookie or MongoDB session? If it's browser cookie then anyone can fake isAuth and access the dashboard.

  • @哈里森-y9l
    @哈里森-y9l 3 года назад +1

    Nice Share , thanks my bro , it's pretty worth for me !

  • @duggie3026
    @duggie3026 2 года назад +1

    Thank you so much for the video. Your video helped me so much with the login and logout section.

  • @danielEpifanov
    @danielEpifanov 2 года назад +1

    wow, amazing content

  • @franciscosalazar8116
    @franciscosalazar8116 Год назад +1

    Wow, this video is amazing!!!!!Thanks so much it wouldn't have been possible to understand this without your video!!! I could deploy my app finally thanks to you!!!

  • @ayomichaels1204
    @ayomichaels1204 Год назад +1

    This is super helpful

  • @NISHANTRAJ-rl9lf
    @NISHANTRAJ-rl9lf 5 месяцев назад +1

    I should subscribe You from Two emails😍

  • @akinwekomitemitope4748
    @akinwekomitemitope4748 Год назад +1

    this is soooo simplified. its like some authentication and authorization courses🥰🥰🥰🥰🥰

    • @the_full_stack_junkie
      @the_full_stack_junkie  Год назад

      So glad you found it helpful 🤓

    • @adeyemodavidsunday7140
      @adeyemodavidsunday7140 11 месяцев назад

      Thank you so much for this wonderful piece I have been looking for a simplified authentication tutorial for so long but could not get one. I was able to follow your steps to implement AUTH using PostgreSQL database. Thanks a million times.

  • @claudiovitordantas2348
    @claudiovitordantas2348 3 года назад +2

    man, this is the best video on how to do a simple authentication on nodejs! congrats!!

  • @TommyMN
    @TommyMN 11 месяцев назад +1

    Thank you so much, I was searching the web for a good understanding of these subjects and you explained them very well my friend!

  • @balajeemishra
    @balajeemishra 3 года назад +1

    Thank you sir. It was very useful. Today I understood what cookies actually do.

  • @bharatjagoar6092
    @bharatjagoar6092 2 года назад +1

    respect ++++ man !!

  • @liveecofriendly1116
    @liveecofriendly1116 2 года назад

    After login successfully, if i change the url to /login and hit enter, it is taking me back to Login page, it shouldn't do that, because the login is successful, it should remain in dashboard page only.

  • @nagato6819
    @nagato6819 2 года назад +1

    omg!! finally, I found a good video about authentication, thank you for this great explanation

  • @hos7012
    @hos7012 2 года назад +1

    best explanation

  • @BaranivskyVadim
    @BaranivskyVadim 3 года назад +1

    Yes I agree. Very good explanation. I watched many videos, only this made my work finished

  • @randomdudewithabeard7593
    @randomdudewithabeard7593 2 года назад

    Hello,
    When I try to go to my dashboard page, I get this error :
    Cannot read properties of undefined (reading 'isAuth')
    What should I do ?

  • @sukhmanpreetsinghsandhub2042
    @sukhmanpreetsinghsandhub2042 Год назад +1

    Awesome video🙌

  • @rajesht9694
    @rajesht9694 Год назад +1

    Wonderful demo

  • @PradeepKumar-fh2vs
    @PradeepKumar-fh2vs 2 года назад +1

    I have watched many videos but did not get clear picture of how the session is working. your video has cleared my lots of doubts, Thanks for such a wonderful tutorial.

  • @pankajjoshi8292
    @pankajjoshi8292 3 года назад +1

    aw sm tutorial

  • @sandeepkumar-of4wy
    @sandeepkumar-of4wy 2 года назад +1

    Love you man.

  • @UTravis
    @UTravis Год назад +1

    Thanks alot

  • @dipeshmandanka
    @dipeshmandanka Год назад

    Can I use session across multiple modules like
    Student Login, register, Logout
    Teacher Login, Logout, regsiter
    Admin Login, Logout, register???

  • @ayberkd9784
    @ayberkd9784 Месяц назад

    Hi, how about expiration? Should we manually remove the session from the db? Or is there any way to do it automatically?

  • @rasheed9947
    @rasheed9947 Год назад +1

    Real Legend

  • @kevinwilliams6070
    @kevinwilliams6070 2 года назад +1

    Thank you so much. You explained this really well.

  • @HoangAnh-Vu
    @HoangAnh-Vu 2 года назад +1

    Thanks a lot

  • @vickyyadav7155
    @vickyyadav7155 3 года назад +1

    Very helpful

  • @Getentertainedp
    @Getentertainedp 3 года назад +1

    Subscribed!

  • @theunusual4566
    @theunusual4566 3 года назад +1

    Thank you !

  • @sidheart8905
    @sidheart8905 2 года назад +1

    thank you very great and informative video... people are just tend to sue lot of addons or libraries , but from your video we can understand basic fundalmentals of authentication in nodejs using simple cookies and a database.

  • @dilmurod9820
    @dilmurod9820 3 года назад +3

    Best Teacher i have ever seen in programming on youtube respect

  • @theclub372
    @theclub372 3 года назад +1

    Thanks for the video man. How do I go about authorization? Do I just store a property in the session?

  • @TLK3693
    @TLK3693 Год назад +1

    awesome

  • @serenliceackeric9732
    @serenliceackeric9732 Год назад +1

    Best explanation !! thank u so much

  • @captainalpha4853
    @captainalpha4853 Год назад

    Hello, I'm using express-session package. When i log in, i see that there is a cookie in the response.
    However, when i try to make a new request to the server, I don't see the cookie in the request header.
    PS: I'm using Nuxt3 for client side.

  • @ivantrachuk3736
    @ivantrachuk3736 Год назад +1

    Omg dude, thank you so much, it's so clear and easy to understand!

  • @vipinr8473
    @vipinr8473 Год назад

    Thankyou for giving this wonderfull class thankyou so much

  • @blackpeep984
    @blackpeep984 Год назад +1

    Holy shit bro this gotta be the best, easiest and most straightforward tutorial on sessions. Thank you very much!

  • @Opacity5
    @Opacity5 3 года назад +1

    awesome

  • @dileepdilraj5254
    @dileepdilraj5254 3 года назад

    Namaste,This is dileep dilraj.Actually I want to scrap a website which asking login to scrap details but the problem is to request the website "we have to now what is in the form" here I cant see details I have to fill in the form and it showing in the form ids: (number) ,Could you please help me to solve this problem.

  • @giddyvibes-0423
    @giddyvibes-0423 11 месяцев назад +1

    Am the type that really found it hard to understand but this video is solid Gold

  • @xosound5938
    @xosound5938 3 года назад +2

    Nice tutorial man!!! You really explained everything so well. Thanks 😊

  • @benzemamumba
    @benzemamumba Год назад +1

    You've got an Afrikaans accent.

  • @skmahmoodsameer2933
    @skmahmoodsameer2933 Год назад

    I have connected mongdb atlas, and connected successfully but there is no "session" database and "my_session" colleciton are being created automatically, as shown in video, why?

  • @bossysmaxx3327
    @bossysmaxx3327 2 года назад

    dude video is amazing but one question:::
    what is the purpose of saving the session in database?
    please give me answer
    below is bullshit, didn't wanted to write but I was forced.... sorry
    .
    .
    .
    .
    okay I did everything same as the video except that I didn't used connect-mongoose-session at all, it worked the same way, so what is the purpose of saving the session in database, whereas we all know that sessions are used till user close the browser and saving the session in db it's not useful....,
    we can use cookies to save userInfo for long period of time...., okay all I need to know is what is the purpose of saving session in database

  • @byTwest
    @byTwest 2 года назад

    If I am using react and routing on the frontend, how do I check if the user is authenticated to route them to protected pages?

  • @vitorsanto1479
    @vitorsanto1479 2 месяца назад

    I have a question. I wanted to make a forum type site, I would like that after the user is authenticated show on a page as their data such as post, videos, message that he put on the site (through a form) how would I do this?

  • @BrantK147
    @BrantK147 3 года назад

    omg I think it's just me but that "r" is soooo distracting!!!! XD just curl your tongue man! not that hard XD