feat: implement JWT token blacklist and refresh token endpoint - #309
Merged
Leothosine merged 2 commits intoJul 21, 2026
Merged
Conversation
- Add jti (JWT ID) claim to access tokens using uuid - Create TokenBlacklistService with Redis-backed storage - Blacklist access token jti on logout with TTL matching remaining token lifetime - Update JwtStrategy to check Redis blacklist before validating tokens - Issue long-lived refresh tokens on login and register - Add POST /api/auth/refresh endpoint for token rotation - Transmit refresh tokens via httpOnly cookie (not response body) - Invalidate refresh token on logout and clear cookie - Refresh token validation with revocation support - Add moduleNameMapper for src/ path alias in Jest config - Add 10 unit tests covering token blacklist and refresh flow Closes tosirano#262
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
jti(JWT ID) claim to access tokens usinguuidTokenBlacklistServicewith Redis-backed storage for token revocationjtion logout with TTL matching remaining token lifetimeJwtStrategyto check Redis blacklist before validating tokensPOST /api/auth/refreshendpoint for token rotationmoduleNameMapperforsrc/path alias in Jest configTesting
npm run buildpassesnpm testpasses (10/10 tests)Acceptance Criteria
POST /api/auth/refreshwith a valid refresh token returns a new access tokenCloses #262