Skip to the content.

Sign-in, session and expiration

Client plugin loads versioned sessionStorage before client-only admin rendering. Storage failure falls back to memory. signedIn means a nonempty token, not periodic validation. No issued session cookie, server logout or expiry timestamp is implemented here. Environment token aliases precede runtimeConfig. Safe redirects stay under /admin. adminFetch adds credentials only for same-origin requests; plain sign-in fetch avoids its expiration hook. Media uses its own client. The global request hook precedes route authentication.

Legend: all drawn relationships are source-verified.

sequenceDiagram
  actor U as Administrator
  participant P as Sign-in page
  participant N as Nitro host
  participant H as Session handler
  participant S as Session state and sessionStorage
  participant F as adminFetch
  U->>P: Submit candidate shared token
  P->>N: Plain fetch GET session with Bearer
  N->>N: Global hook selects cached blog store
  N->>H: checkAdminSession
  H->>H: requireAdminToken
  alt Accepted
    H-->>P: ok true
    P->>S: Save token with selected database
    P->>P: Navigate to safe admin redirect
  else Invalid or unconfigured token
    H-->>P: 401
    P->>P: Show error, do not save candidate
  else Non-authentication failure
    N-->>P: Error
    P->>P: Show cannot-reach-server message
  end
  U->>F: Later operation
  F->>N: Same-origin Bearer and database header
  N-->>F: 401
  alt Current-token response or unknown token context
    F->>S: Clear token, preserve database
    F->>P: Shared expired-session navigation
  else Older-token response
    F->>F: Preserve newer session
  end

Source evidence