-
How do you recommend implementing long-lasting user sessions? So that they are not logged out. Typically, in the JWT implementations I've encountered, there are two tokens: a short-lived (minutes) access token that contains encoded user data, and a long-lived (days) opaque refresh token. I understand from the documentation that Payload only has the former. In that case, do you recommend simply setting a high value for |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
@sixers this is a great question! Thanks for opening up this discussion here because I bet this will be of value to a lot of people - and we're going to get a bit theoretical. You're right that the typical "access / refresh" token is pretty standard. But it never made a whole lot of sense to us - because in web apps, if you store both as an Instead of following this pattern, what Payload has built out is a somewhat simpler refresh pattern. I am very interested in hearing thoughts about it. Basically, we have the traditional We have our own This operation is simply an easy way to take a still valid token (no username or password required), and extend its lifetime. It can be very easily used by your applications, too. What we commonly do in our own apps is something like the following:
This pattern is simple, secure, expected, and straightforward. It also allows people to be logged in for however long they need, as long as they're active. And we feel like it's a more straightforward path vs. having to rotate refresh tokens. What do you think? |
Beta Was this translation helpful? Give feedback.
@sixers this is a great question! Thanks for opening up this discussion here because I bet this will be of value to a lot of people - and we're going to get a bit theoretical.
You're right that the typical "access / refresh" token is pretty standard. But it never made a whole lot of sense to us - because in web apps, if you store both as an
httpOnly
cookie, then theoretically if you hijack one, you hijack the other. Meaning... it's not much more secure than a long lasting access token on its own. Even if the access token is expired, an attacker can simply use the refresh token and boom. Get a new access token. Thus, in order for the refresh token to be secure, you need to take even more s…