Skip to content

Authentication API

认证 API,用于用户登录、令牌管理和身份验证。

认证方式

方式说明使用场景
Bearer TokenJWT 令牌API 调用
API KeyAPI 密钥SDK 集成
Admin Token管理员令牌内部服务

登录

http
POST /api/auth/login
Content-Type: application/json

{
  "email": "admin@example.com",
  "password": "your_password"
}

响应:

json
{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "refreshToken": "dGhpcyBpcyBhIHJlZnJlc2ggdG9rZW4...",
  "expiresIn": 3600,
  "user": {
    "id": "user_123",
    "email": "admin@example.com",
    "name": "Admin User",
    "roles": ["admin"]
  }
}

刷新令牌

http
POST /api/auth/refresh
Content-Type: application/json

{
  "refreshToken": "dGhpcyBpcyBhIHJlZnJlc2ggdG9rZW4..."
}

使用令牌

http
GET /api/games
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

API Key 认证

http
POST /v1/batch
x-api-key: pk_your_api_key_here
Content-Type: application/json

[...]

权限范围

角色权限
admin全部权限
operator游戏管理、用户管理
analyst查看数据、创建报告
developerSDK 管理、API Key
viewer只读访问

Released under the MIT License.