认证接口
登录
POST /api/auth/login
请求体
{
"password": "your_password"
}
响应
{
"access_token": "eyJhbGciOiJIUzI1NiIs...",
"token_type": "bearer",
"expires_in": 3600
}
注册
POST /api/auth/register
请求体
{
"password": "your_password",
"name": "用户名"
}
响应
{
"id": 1,
"name": "用户名",
"created_at": "2026-01-01T00:00:00Z"
}
刷新 Token
POST /api/auth/refresh
请求头
Authorization: Bearer <current_token>
响应
{
"access_token": "eyJhbGciOiJIUzI1NiIs...",
"token_type": "bearer",
"expires_in": 3600
}
获取当前用户
GET /api/auth/me
请求头
Authorization: Bearer <token>
响应
{
"id": 1,
"name": "用户名",
"role": "user",
"created_at": "2026-01-01T00:00:00Z"
}
修改密码
PUT /api/auth/password
请求体
{
"old_password": "current_password",
"new_password": "new_password"
}