Files
digital-psychology/.ai/patterns/jwt.md
T
jackyu66gitandCursor 2fb1dfee14 chore: seal Design Vision v1 and monorepo scaffold
Archive the differentiated YuXinGu product docs, AI engineering system,
design contract, and Go/Vue scaffold. Next execution prioritizes Cece-parity
over early innovation (see .ai/product/STRATEGY.md).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-02 16:00:44 +08:00

14 lines
295 B
Markdown

# Pattern: JWT / Bearer
## Middleware
1. Read `Authorization: Bearer <token>`
2. Parse/verify
3. Put `user_id` into context
4. Reject with code in 1xxxx if missing/invalid
## Service
Always take `userID` from context for mutating ops.
Never trust body `user_id` from client for ownership.