2.1 KiB
Story 1.2: Triển khai Backend API Xác thực & JWT (Backend Auth API & JWT)
Status: done
Epic: Epic 1
Story Key: 1-2-backend-auth-api-jwt
📖 Story Requirements (Context & PRD)
This section maps directly to the original Product Requirements Document and Epics definition.
As a Người dùng,
I want gọi API an toàn để tạo tài khoản, đăng nhập và lấy mã Token (JWT) theo chuẩn quy ước OAuth2,
So that hệ thống xác thực được danh tính của tôi và định danh xử lý xác thực qua API backend.
Acceptance Criteria:
Given thông tin đăng nhập hợp lệ
When gửi request form data tới endpoint /auth/jwt/login
Then hệ thống trả về cấu trúc token dạng OAuth2 Bearer: {"access_token": "xxx", "refresh_token": "xxx", "token_type": "bearer"}
And Định danh dữ liệu bảo mật được gắn kết thông qua ORM Filters và Zero-cache access rules thay vì Postgres RLS thuần túy.
🏗️ Architecture & Technical Guardrails
Critical instructions for the development agent based on the project's established architecture.
Technical Requirements
- Language/Framework: React, Next.js (TypeScript) for Web; FastAPI (Python) for Backend.
- Database: Prisma/Supabase.
- Strict Type checking must be enforced. No
anytypes.
Code Organization
This story is currently marked as done. Implementation should target the following components/files:
(Files to be determined during implementation)
Developer Agent Constraints
- No Destructive Refactors: Extend existing modules when possible.
- Context Check: Always refer back to
task.mdand use Context7 to verify latest SDK usages. - BMad Standard: Update the sprint status using standard metrics.
🧪 Testing & Validation Requirements
- All new endpoints must be tested.
- Frontend components should gracefully degrade.
- Do not introduce regressions into existing user workflows.
📈 Completion Status
(To be updated by the agent when completing this story)
- Start Date: _____________
- Completion Date: _____________
-
Key Files Changed: