Skip to content

Token now expires after 12h#63

Merged
Spampa merged 2 commits into
mainfrom
development
May 23, 2026
Merged

Token now expires after 12h#63
Spampa merged 2 commits into
mainfrom
development

Conversation

@Spampa
Copy link
Copy Markdown
Contributor

@Spampa Spampa commented May 23, 2026

This pull request extends the authentication token and session expiry from 6 hours to 12 hours across both the backend and frontend. It also improves how the frontend parses and synchronizes token expiry, ensuring consistency between the backend JWT and frontend session handling.

Backend expiry updates:

  • Increased JWT expiry from 6 hours to 12 hours in the TokenService (apps/backend/src/modules/auth/token.service.ts).
  • Updated the mysagra_token cookie's maxAge to 12 hours in the AuthController (apps/backend/src/modules/auth/auth.controller.ts).

Frontend expiry handling and synchronization:

  • Added a parseTokenExpiry function in auth.ts to extract the expiry from the JWT and use it for setting the cookie's maxAge, ensuring the frontend cookie matches the backend token's expiry (apps/frontend/lib/auth.ts). [1] [2]
  • Updated the session and cookie maxAge values to 12 hours to match the backend, and propagated the token expiry throughout the authentication flow (apps/frontend/lib/auth.ts). [1] [2]
  • Ensured the token expiry (exp) is included in the JWT and session objects for consistent expiry tracking on the frontend (apps/frontend/lib/auth.ts). [1] [2]

@Spampa Spampa merged commit 545a1cb into main May 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant