Xác thực

Xác thực API

Đăng nhập

POST /api/v1/auth/login
{
  "email": "user@example.com",
  "password": "your_password"
}

Response:

{
  "success": true,
  "data": {
    "token": "eyJhbG...",
    "refreshToken": "eyJhbG...",
    "expiresIn": 900,
    "user": {
      "id": "user_abc123",
      "email": "user@example.com",
      "displayName": "User",
      "role": "premium"
    }
  }
}

Đăng ký

POST /api/v1/auth/register
{
  "email": "user@example.com",
  "password": "strong_password",
  "displayName": "User"
}

Refresh Token

POST /api/v1/auth/refresh
{
  "refreshToken": "eyJhbG..."
}

Lấy thông tin user hiện tại

GET /api/v1/auth/me

Đăng xuất

POST /api/v1/auth/logout

API Key

Pro và Enterprise users có thể tạo API key:

POST /api/v1/auth/api-keys

API key có thể giới hạn quyền (read-only, trading, admin).