Skip to main content
InterviewHubPRO
Section Overview
Q32

Question 32 of 50

Part 3: Advanced Internals, Performance & Production (Senior / Staff)

64%
Nuxt & Universal SSR (50 Qs)•Part 3: Advanced Internals, Performance & Production (Senior / Staff)

What is the recommended Authentication Architecture in Nuxt 3?

senior LevelFormsPerformanceSecurity & Auth

In Simple Words: Client-side tokens in localStorage are vulnerable to XSS and invisible to the Node SSR server, causing flash of unauthorized content.

Production Best Practice:

  1. HTTP-Only, Secure, SameSite Cookies: Server sets encrypted session/JWT cookies.
  2. Universal Request Interception: During SSR, Nuxt's server passes the Cookie header to downstream microservices using useRequestFetch().
  3. Client Route Guard & Server Middleware:
    • server/middleware/auth.ts verifies token before SSR render.
    • middleware/auth.global.ts protects client transitions.