Skip to content

Add configurable JWT access token issuance - #1045

Merged
nafiuishaaq merged 5 commits into
MentoNest:mainfrom
Vox-d-glitch:issue-974-jwt-token-issuance
Aug 2, 2026
Merged

Add configurable JWT access token issuance#1045
nafiuishaaq merged 5 commits into
MentoNest:mainfrom
Vox-d-glitch:issue-974-jwt-token-issuance

Conversation

@Vox-d-glitch

Copy link
Copy Markdown
Contributor

Adds a TokenService that issues access tokens carrying sub, wallet, roles, permissions and a jti claim, replacing the previous hardcoded 1h HS256-only signing setup.

  • Signing algorithm (HS256/RS256), secret or key pair, and expiration now come from env (JWT_ALGORITHM, JWT_SECRET or JWT_PRIVATE_KEY/JWT_PUBLIC_KEY, JWT_ACCESS_EXPIRATION, default 15m) via a shared JwtModule factory
  • Permissions are derived from roles through a ROLE_PERMISSIONS map
  • JwtAuthGuard now verifies using the same module configuration instead of a hardcoded secret lookup, so it works transparently with either algorithm

Closes #974

@drips-wave

drips-wave Bot commented Jul 26, 2026

Copy link
Copy Markdown

@Vox-d-glitch Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Rebuilds MentoNest#974 on top of the current wallet-auth/RBAC architecture:
centralizes JWT signing config (HS256/RS256 via JWT_ALGORITHM) into a
shared factory used by both AuthModule and UsersModule, and adds a
permissions claim derived from roles to the access token payload.
@Vox-d-glitch
Vox-d-glitch force-pushed the issue-974-jwt-token-issuance branch from 153e9c8 to 5094cc4 Compare July 26, 2026 20:38
- auth.controller.ts had two full AuthController class bodies concatenated
  (a botched prior merge), which broke parsing for the whole file and
  cascaded into unrelated eslint type-resolution errors repo-wide
- add missing @nestjs/swagger dependency (used throughout but never
  added to package.json)
- fix relative import paths in auth.service.ts (an extra '../' pointed
  outside src/auth, breaking NodeNext module resolution)
- add .js extensions to relative imports per the project's nodenext
  moduleResolution, removing further unresolved-type cascades
- remove JwtAuthGuard's unresolvable third constructor parameter (a bare
  function type Nest can never inject), small unused-import/no-await
  cleanups, and a wrong TypeORM option name (connectTimeout -> connectTimeoutMS)
- apply repo-wide prettier formatting (was never run on ~50 files)

Lint: 95 errors -> 0. Build: failing -> passing. Prettier: 51 files -> 0.
…ation

These specs were written against a device-aware, RefreshTokenService +
UsersService backed refresh-token design that was never wired into
AuthService/AuthController — the real implementation still uses the
simpler in-memory nonce/token-map flow. Rewrite both specs to exercise
what's actually there instead of leaving them permanently red.
@nafiuishaaq

Copy link
Copy Markdown
Contributor

Please reslove conflict

@nafiuishaaq
nafiuishaaq merged commit 321ad44 into MentoNest:main Aug 2, 2026
0 of 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.

JWT access token issuance

2 participants