Skip to content

fix(auth): unify JWT config — single expiry constant across all consu…#304

Merged
Xhristin3 merged 1 commit into
XStreamRollz:mainfrom
OlaGreat:fix/unified-jwt-config
Jun 22, 2026
Merged

fix(auth): unify JWT config — single expiry constant across all consu…#304
Xhristin3 merged 1 commit into
XStreamRollz:mainfrom
OlaGreat:fix/unified-jwt-config

Conversation

@OlaGreat

Copy link
Copy Markdown
Contributor

Introduces JWT_ACCESS_TOKEN_EXPIRES_IN = "15m" as a named export in api/src/config/jwt.config.ts and sets it as the default parameter for createJwtConfig, making it the single source of truth for access-token lifetime
Removes the local JWT_EXPIRES_IN = "15m" constant from AuthModule — it now imports and uses JWT_ACCESS_TOKEN_EXPIRES_IN directly
Fixes GatewaysModule, which was calling createJwtConfig("1h") — it now uses the same JWT_ACCESS_TOKEN_EXPIRES_IN constant, closing the expiry mismatch that could cause tokens issued by auth to be treated inconsistently by the WebSocket gateway
Test plan
GET /auth/login issues a token expiring in 15 min
WebSocket handshake with that token is accepted by StreamsGateway
WebSocket handshake with an expired token is rejected
npm test passes for all gateway and auth specs
No duplicate fallback secrets remain in either module

Closes #205

…mers

Introduce JWT_ACCESS_TOKEN_EXPIRES_IN ("15m") in jwt.config.ts and use
it as the default parameter for createJwtConfig. Both AuthModule and
GatewaysModule now import and reference this constant, eliminating the
divergent "15m" / "1h" expiry values and the local JWT_EXPIRES_IN
constant that had been duplicated in AuthModule.

@Xhristin3 Xhristin3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Xhristin3 Xhristin3 merged commit 2d9c7ca into XStreamRollz:main Jun 22, 2026
2 checks 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.

refactor: Consolidate JWT module configuration into a shared module

2 participants