Ask HN: Web developers on this forum, how do you manage user sessions?
The way I am handling sessions is by embedding an "ephemeral session id" and a username in a web token and having that same id set as a separate cookie. When a request is received by the server then the "session id" embedded in the token is compared with the value stored in that separate cookie. If that matches then the username is extracted from the token. In response to that request, a new session id is generated and a new token is created and the value of a separate cookie is set to this new session id.
Do you see problems with this approach? Are there better ways to handle sessions without storing state on servers?