How do server side authentication sessions work (express & cookies)

แชร์
ฝัง
  • เผยแพร่เมื่อ 15 มิ.ย. 2022
  • A walkthrough on how server side authentication sessions work using cookies.
    ------------
    🔔 Newsletter eepurl.com/hnderP
    💬 Discord / discord
    📁. GitHub github.com/codyseibert/youtube

ความคิดเห็น • 48

  • @aissa.bouguern
    @aissa.bouguern ปีที่แล้ว +37

    I really like how you explained sessions without relying on "express-session" or any third-party library that abstracts the work done behind the scenes.
    This helps beginners to adopt a nice and very simple mental model about what sessions are about.
    Thank you so much!

  • @Goofy8907
    @Goofy8907 2 หลายเดือนก่อน +1

    DUDE, this is how you explain something
    Very well done, I just came from another video on the same topic, watched the whole thing and was still clueless.
    Watched your video for like 3 minutes and had most of my questions answered, kept watching because of how well you explained.
    Thank you, I'm subscribing.

  • @user-wj7gz8dd8b
    @user-wj7gz8dd8b ปีที่แล้ว +3

    You sir deserve all the support, thank you so much, you pretty much saved me time. Great work

  • @marksheard1210
    @marksheard1210 5 หลายเดือนก่อน

    Awesome stuff, Thank you Cody!!!
    I have been using passport-local and figuring my way round. I highly recommend going through THIS BASIC overview before leaning on other modules\packages like passport-local and express-session.

  • @cristianadejola464
    @cristianadejola464 ปีที่แล้ว +2

    Currently working same subject but with SQL database. Bit complicated and stressful. But your tutorial help a lot. Thanks ones again

  • @mayor3367
    @mayor3367 ปีที่แล้ว

    Thank you so much. I had a hard time understanding how jwt does what it does. It is so much clearer now.

  • @exe.m1dn1ght
    @exe.m1dn1ght 11 หลายเดือนก่อน

    I love this explanation ! thanks Cody !

  • @GilP-BM
    @GilP-BM 2 หลายเดือนก่อน

    Love your content & input, thanks Cody!

  • @SeibertSwirl
    @SeibertSwirl 2 ปีที่แล้ว

    Great job babe!!! You’re killin this!

  • @bentheafrican
    @bentheafrican 2 ปีที่แล้ว +1

    Nice tutorial
    Looking forward to watch the next one.

  • @Gamer-gw6nj
    @Gamer-gw6nj ปีที่แล้ว

    Simply put together

  • @raprincis
    @raprincis 5 หลายเดือนก่อน

    Simple, helpful, and very instructive

  • @mferino1960
    @mferino1960 ปีที่แล้ว

    Great video, thanks so much! I am about to build something using remix-auth (which is my first ever auth implementation) and wasn't clear on the cookie / session relationship. Most of the things I found just by browsing the web were like, the session is stored on the server and the cookie is stored on the client... thanks, that helps me not at all. This video cleared it all up and I now have a working mental model.

  • @devnarula6733
    @devnarula6733 2 หลายเดือนก่อน

    exactly what I was looking for, appreciate such low level bare-bone session auth for understanding instead of just using some plugin which teaches no one anything!

  • @SkySentry7
    @SkySentry7 หลายเดือนก่อน +1

    TYSM man. I've been struggling trying to understand how sessions work with cookies

  • @digvijaysingh6882
    @digvijaysingh6882 11 หลายเดือนก่อน

    simple and thorough. Glad you didn't use all those fancy abstractions.

  • @CoryTheSimmons
    @CoryTheSimmons 4 หลายเดือนก่อน

    Best tutorial I've ever seen.

  • @kosidinna_
    @kosidinna_ 2 หลายเดือนก่อน

    i know i'm late to this but as someone who is just getting round to backend stuff, this was very useful. Thank you

  • @user-sz4gp6oc2n
    @user-sz4gp6oc2n 6 หลายเดือนก่อน +1

    appreciate dumming down the complex concept

  • @offgridvince
    @offgridvince 4 หลายเดือนก่อน +1

    Great video! Thx

  • @cristianadejola464
    @cristianadejola464 ปีที่แล้ว

    just subscribe to your channel. you are really helping the junior Dev. Thanks so much

  • @JoelGrayson
    @JoelGrayson ปีที่แล้ว +4

    Thank you for the simple explanation. Helped me a lot.
    Tip: res.clearCookie() does the same thing as res.set('Set-Cookie', `session=null`)

    • @bitsplode
      @bitsplode ปีที่แล้ว

      whats the difference? Number one wipes the cookie out of existance and number 2 just null-ifies it???

    • @jperusm
      @jperusm 4 หลายเดือนก่อน

      @@bitsplode that is correct. number two will just "modify" the cookie value but will not delete it.

  • @alexvolkov529
    @alexvolkov529 ปีที่แล้ว +1

    Hi! Thank you for your video! I have a question how I can store sessionId on my frontend in production?Just using the domain attribute does not work since I'm using a free hosting wich is the Public Suffix List and after all frontend and backend are hosted on different subdomains.
    Should I store sessionId on the front-side? Or is it not the case?

  • @lightsinvalues9856
    @lightsinvalues9856 ปีที่แล้ว

    thank you very much

  • @meepk633
    @meepk633 10 หลายเดือนก่อน

    I learned today that you can use the 'public' and 'private' keywords in TypeScript constructor parameters to auto-assign them. You don't even need to list them as members. It just adds them to the instance automatically. This is completely unrelated btw. Just wanted to share.

  • @tljstewart
    @tljstewart 8 หลายเดือนก่อน

    Great content

  • @alexdonoaga89
    @alexdonoaga89 11 หลายเดือนก่อน

    whats the extension name for copilot that you used to recive the delete cookie thing ?

  • @sjfieksnd
    @sjfieksnd ปีที่แล้ว

    Cool!

  • @notfadeaway6617
    @notfadeaway6617 10 หลายเดือนก่อน

    nice video

  • @codinginflow
    @codinginflow ปีที่แล้ว

    Can you tell me what's this VS Code theme? It's beautiful

    • @WebDevCody
      @WebDevCody  ปีที่แล้ว

      I think this is material community high contrast

    • @codinginflow
      @codinginflow ปีที่แล้ว

      @@WebDevCody Thank you

    • @blackpeep984
      @blackpeep984 ปีที่แล้ว

      shades of purple

    • @codinginflow
      @codinginflow ปีที่แล้ว

      @@blackpeep984 That's what I thought actually

    • @blackpeep984
      @blackpeep984 ปีที่แล้ว

      @@codinginflow it's my personal favorite so i knew right away what theme he's using

  • @ponderatulify
    @ponderatulify ปีที่แล้ว

    How do you go about storing the session? Removing the session? How does it scale?

    • @tudor14
      @tudor14 ปีที่แล้ว

      You could store the session in Redis and other user info too (but the session ID is only sent back in cookie). Removing the session you'd just find the session based on sessionId in your store/database and delete it.. And for scaling well lets just say you're on your own there...

  • @velara314
    @velara314 ปีที่แล้ว

    If I need to authenticate across two different domains should I use Jwt or sessions?

    • @WebDevCody
      @WebDevCody  ปีที่แล้ว +2

      I think jwt might be easier. sessions usually use cookies which often suggest same-site policies. I'd have to research this question to be honest., but google single sign on approaches

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

    • @WebDevCody
      @WebDevCody  ปีที่แล้ว

      If you’re using axios or fetch you usually have to specify withCredentials true for all your requests

  • @bamideleprecious3481
    @bamideleprecious3481 10 หลายเดือนก่อน

    What plugin can I use

    • @WebDevCody
      @WebDevCody  10 หลายเดือนก่อน

      Material community

  • @brianpolly-ei3nk
    @brianpolly-ei3nk 5 หลายเดือนก่อน

    Are you on telegram

  • @ashajanet12-a92
    @ashajanet12-a92 หลายเดือนก่อน

    This is wayy good explanation!🫴✨