Files
second-brain/knowledge/methods/auth.md
T
kiskaadee a1152d4075 docs(brain): add document metadata frontmatter
Add YAML frontmatter to all 54 retained markdown documents.
Frontmatter schema is type-specific — no universal status field.

Type contracts applied:
- knowledge: type + status (draft|stable) + topics
- project:   type + status (planned|active|paused|completed)
- plan:      type + status + project context
- guide:     type + project context (no lifecycle status)
- journal:   type + date (no status — journals are historical by definition)
- practice:  type + status (completed|active) + topics
- inbox:     type + created date

54 documents tagged across:
  knowledge/concepts/     (3)
  knowledge/technologies/ (7, including python/ subdirectory with 4)
  knowledge/methods/      (6)
  projects/homelab/       (1 overview + 6 plans + 6 guides)
  projects/magnetflix/    (1)
  projects/nekoweb/       (1)
  records/journal/        (7)
  practice/LeetCode/      (14)
  inbox/                  (1)
2026-09-05 21:49:17 -05:00

1.0 KiB

type, status, topics
type status topics
knowledge draft
auth
jwt
security

Authentication & Authorization Notes

JWT (JSON Web Tokens)

  • A compact, URL-safe means of representing claims to be transferred between two parties.
  • Consists of three parts separated by dots: Header.Payload.Signature
  • Header: Algorithm & token type (e.g. HS256, JWT).
  • Payload: Claims (e.g. user ID, expiration, roles).
  • Signature: Verifies that the sender of the JWT is who it says it is and ensures the message wasn't changed along the way.

Session/JWT flow

  1. Client logs in with credentials.
  2. Server verifies and issues an Access Token (short-lived, e.g. 15m) and a Refresh Token (long-lived, e.g. 7 days).
  3. Client stores Refresh Token in a secure, HttpOnly cookie and Access Token in memory or storage.
  4. Client includes Access Token in the Authorization header (Bearer <token>) for protected requests.
  5. When Access Token expires, client calls /refresh with the Refresh Token to get a new Access Token.