← Back to Engineering

Authentication Flow

Centralized identity via Auth Service with JWT access tokens and refresh rotation.

Authentication Flow

Version: 1.0

Status: Approved

Last updated: 2026-07-06


Overview

NovaDesk uses a centralized Auth Service as the identity provider. All applications obtain JWT access tokens and refresh tokens through this service. The API Gateway validates access tokens on every protected request before proxying to backend services.


System diagram


Token specification

TokenAlgorithmTTLStorage
AccessRS25615 minutesMemory (client)
RefreshOpaque / signed7 daysHttpOnly cookie or secure storage

Access token claims

ClaimPurpose
subUser ID
emailUser email
rolesRBAC roles
tenant_idMulti-tenant scope
scopeAPI permissions
jtiToken ID for revocation

RBAC model

Hierarchy: Organization → Workspace → Resources

LayerEnforcement
GatewayJWT signature, expiry, issuer
Service@Roles() decorator via @novadesk/auth
Repositoryworkspace_id scoping on all tenant tables

Security controls

  1. RS256 — Private key on Auth Service only; public key via JWKS endpoint
  2. Refresh rotation — Each refresh invalidates the previous token
  3. Rate limiting — Login and refresh endpoints throttled at gateway
  4. Fail secure — Invalid or expired token → 401, never passthrough
  5. Audit log — Login, logout, and role changes recorded

Multi-tenant isolation

Tenants are resolved from JWT tenant_id. Services never accept tenant ID from request body on protected routes — only from validated token claims. WorkspaceGuard enforces workspace membership on HelpDesk and Admin routes.