Documentation Index
Fetch the complete documentation index at: https://ai-gateway.juniortree.com/llms.txt
Use this file to discover all available pages before exploring further.
用户登录接口用于获取访问令牌(access token),该令牌用于后续API调用的身份验证。
认证方式
该接口不需要预先的认证信息,使用用户名和密码进行登录。
请求参数
请求体
响应说明
成功响应
登录成功后,系统会返回访问令牌和用户信息。
响应字段说明
使用示例
用户登录
curl -X POST 'https://your-domain.com/api/v1/login' \\
-H 'Content-Type: application/json' \\
-d '{
"username": "your_username",
"password": "your_password"
}'
响应示例
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"token_type": "bearer",
"expires_in": 3600,
"user": {
"id": "user_123456",
"username": "example_user",
"role": "user",
"status": "active",
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-15T12:00:00Z",
"last_login": "2024-01-15T12:00:00Z",
"api_calls_count": 150,
"max_api_calls": 1000
}
}
使用令牌
登录成功后,您需要在后续API请求的Header中包含访问令牌:
-H 'Authorization: Bearer your_access_token'
安全建议
- 令牌存储:安全存储访问令牌,避免泄露
- 令牌刷新:在令牌过期前重新登录获取新令牌
- 密码安全:使用强密码并定期更换
- HTTPS:始终通过HTTPS协议进行登录请求
- 错误处理:妥善处理登录失败的情况