expressjs / expressjs/session

Expose a property on session to know whether the session was uninitialized

Open
#414 4 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
JavaScript
Stars
6.4k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

Hey,

maybe I can't read the doc properly :) but I couldn't find how to know if the session is new. A easy-ish way is to check `connect.sid` and compare with `req.sessionId` but this is not very elegant, especially that the information is easy to get from inside the session middleware.

Another possibility is to set a specific boolean in the session and check this.

My use case is that I want to prevent from accessing a resource if there is no active session yet.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.