Loading
Current section: Logout 6 exercises
lesson

Intro to Logout

Loading lesson

Transcript

00:00 All right, it's time to make a logout actually work. So when we log in, we have, Cody loves you. We have this logout button, you're gonna be making that work. We're also gonna be doing automatic logout so that the user is automatically logged out after a certain amount of time. Of course, longer than that. But yeah, so there are a couple of things

00:21 that we need to consider with all of this. There's expires and max age, which are properties that you can set on a cookie that will tell the browser when to eject the cookie value. This is actually one really, really nice feature of sessions and cookies is that you have this capability to say, hey browser, I don't want you to send this cookie to me

00:40 anymore after this date or after it's this old. And so yeah, you have a couple options here. We're gonna be using expires, but it's good to know that max age is also an option there. We also need to consider deleted users. So what if the user's logged in and then their account gets deleted? There's kind of this weird state where they have a user ID,

00:58 but that user ID doesn't exist anymore. So we're gonna be dealing with that as well. So a bunch of interesting things to think about with logout and expiration. So let's get to it.