Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make session expiry parametric #367

Closed
ab-smith opened this issue May 5, 2024 · 1 comment · Fixed by #443
Closed

Make session expiry parametric #367

ab-smith opened this issue May 5, 2024 · 1 comment · Fixed by #443
Labels
deployment This issue deals with deployment enhancement New feature or request

Comments

@ab-smith
Copy link
Contributor

ab-smith commented May 5, 2024

Add an ENV variable to make the cookie lifespan parametric.

@ab-smith ab-smith added enhancement New feature or request deployment This issue deals with deployment labels May 5, 2024
@nas-tabchiche
Copy link
Contributor

As things are, it can already be passed through the AUTH_TOKEN_TTL environment variable in the backend. I see the README was not updated when we switched from session to token-based authentication. My mistake, I'm pushing a small PR for this shortly.

The single source of truth for the token's lifespan is the backend. When it expires, the fetch to /current-user will return an erroneous response, then the user is logged out in the frontend. This ensures synchronization between the authentication state of the front and backend at all times for very low added complexity, especially considering the "sliding" nature of the token's TTL (by default, AUTH_TOKEN_AUTO_REFRESH is set to True and AUTH_TOKEN_TTL to 15 minutes, meaning every time a request authenticated with a token is made, its TTL is reset to 15 minutes). Both these variables can be passed as environment variables.

async function validateUserSession(event: RequestEvent): Promise<User | null> {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployment This issue deals with deployment enhancement New feature or request
Projects
None yet
2 participants