← Tài liệu← Documentation
API Authentication
API Authentication
JWT Token
API dùng JWT (JSON Web Token) để xác thực. Token có hạn 30 ngày.
Lấy token
``` POST /auth/login Content-Type: application/json
{ "email": "[email protected]", "password": "..." } ```
Response: `` { "success": true, "data": { "token": "eyJ...", "user": {...} } } ``
Dùng token
Thêm header Authorization: Bearer vào mọi request cần auth:
`` GET /auth/me Authorization: Bearer eyJ... ``
Refresh
Token hết hạn → đăng nhập lại. Hiện chưa hỗ trợ refresh token.
Rate limit
| Endpoint | Limit |
|---|---|
| Login | 10 / 10 min |
| Signup | 5 / hour |
| Forgot password | 3 / hour |
| General | 100 / min |