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

  Рет қаралды 36,692

Web Dev Cody

Web Dev Cody

Күн бұрын

A walkthrough on how server side authentication sessions work using cookies.
------------
🔔 Newsletter eepurl.com/hnderP
💬 Discord / discord
📁. GitHub github.com/cod...

Пікірлер: 50
@aissa.bouguern
@aissa.bouguern Жыл бұрын
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!
@mossabDiae
@mossabDiae Ай бұрын
Cody, that was beautifully explained. The note you added at the end about why JWT would be useful is a gem. Subscribed.
@Goofy8907
@Goofy8907 5 ай бұрын
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.
@SkySentry7
@SkySentry7 4 ай бұрын
TYSM man. I've been struggling trying to understand how sessions work with cookies
@JoelGrayson
@JoelGrayson Жыл бұрын
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 7 ай бұрын
@@bitsplode that is correct. number two will just "modify" the cookie value but will not delete it.
@meepk633
@meepk633 Жыл бұрын
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.
@cristianadejola464
@cristianadejola464 Жыл бұрын
Currently working same subject but with SQL database. Bit complicated and stressful. But your tutorial help a lot. Thanks ones again
@devnarula6733
@devnarula6733 5 ай бұрын
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!
@HassanChakkour
@HassanChakkour Жыл бұрын
You sir deserve all the support, thank you so much, you pretty much saved me time. Great work
@marksheard1210
@marksheard1210 7 ай бұрын
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.
@kosidinna_
@kosidinna_ 5 ай бұрын
i know i'm late to this but as someone who is just getting round to backend stuff, this was very useful. Thank you
@ChangaSingh-y4n
@ChangaSingh-y4n 9 ай бұрын
appreciate dumming down the complex concept
@digvijaysingh6882
@digvijaysingh6882 Жыл бұрын
simple and thorough. Glad you didn't use all those fancy abstractions.
@GilP-BM
@GilP-BM 5 ай бұрын
Love your content & input, thanks Cody!
@mayor3367
@mayor3367 2 жыл бұрын
Thank you so much. I had a hard time understanding how jwt does what it does. It is so much clearer now.
@bentheafrican
@bentheafrican 2 жыл бұрын
Nice tutorial Looking forward to watch the next one.
@CoryTheSimmons
@CoryTheSimmons 7 ай бұрын
Best tutorial I've ever seen.
@SeibertSwirl
@SeibertSwirl 2 жыл бұрын
Great job babe!!! You’re killin this!
@raprincis
@raprincis 8 ай бұрын
Simple, helpful, and very instructive
@exe.m1dn1ght
@exe.m1dn1ght Жыл бұрын
I love this explanation ! thanks Cody !
@offgridvince
@offgridvince 7 ай бұрын
Great video! Thx
@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.
@aiknowledge-n2s
@aiknowledge-n2s Жыл бұрын
Simply put together
@cristianadejola464
@cristianadejola464 Жыл бұрын
just subscribe to your channel. you are really helping the junior Dev. Thanks so much
@alexvolkov529
@alexvolkov529 Жыл бұрын
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?
@tljstewart
@tljstewart 10 ай бұрын
Great content
@alexdonoaga89
@alexdonoaga89 Жыл бұрын
whats the extension name for copilot that you used to recive the delete cookie thing ?
@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
@AnonymousPumpkin616
@AnonymousPumpkin616 Ай бұрын
can u provide the code?
@lightsinvalues9856
@lightsinvalues9856 Жыл бұрын
thank you very 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.
@WebDevCody
@WebDevCody Жыл бұрын
If you’re using axios or fetch you usually have to specify withCredentials true for all your requests
@ponderatulify
@ponderatulify 2 жыл бұрын
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 Жыл бұрын
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
@sjfieksnd
@sjfieksnd Жыл бұрын
Cool!
@notfadeaway6617
@notfadeaway6617 Жыл бұрын
nice video
@bamideleprecious3481
@bamideleprecious3481 Жыл бұрын
What plugin can I use
@WebDevCody
@WebDevCody Жыл бұрын
Material community
@brianpolly-ei3nk
@brianpolly-ei3nk 8 ай бұрын
Are you on telegram
@ashajanet12-a92
@ashajanet12-a92 4 ай бұрын
This is wayy good explanation!🫴✨
What are Cookies in NodeJS?
30:35
Piyush Garg
Рет қаралды 62 М.
GIANT Gummy Worm Pt.6 #shorts
00:46
Mr DegrEE
Рет қаралды 76 МЛН
Миллионер | 1 - серия
34:31
Million Show
Рет қаралды 879 М.
Why I'd never host my apps on a VPS
13:43
Web Dev Cody
Рет қаралды 52 М.
Oh, Auth Doesn't Have to Suck?
7:16
Josh tried coding
Рет қаралды 63 М.
Difference between cookies, session and tokens
11:53
Valentin Despa
Рет қаралды 631 М.
Your complete guide to understanding the express-session library
25:50
Zach Gollwitzer
Рет қаралды 79 М.
Why aren't you using Fastify? Or Koa? Or NestJS?
9:58
Maximilian Schwarzmüller
Рет қаралды 50 М.
Cookies, Sessions, JSON Web Tokens (JWT) and More 🍪🔐
46:41
LearnWebCode
Рет қаралды 106 М.
Session Authentication in Express
40:43
Code Realm
Рет қаралды 146 М.