← 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

EndpointLimit
Login10 / 10 min
Signup5 / hour
Forgot password3 / hour
General100 / min