Auth Token
生成 JWT Token 用于 API 其他请求的身份验证。
端点
POST /api/v2/external/auth-token请求头
| 请求头 | 值 | 必填 |
|---|---|---|
| Content-Type | application/json | 是 |
请求体
| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
client_id | string | 是 | API Key 标识符 |
client_secret | string | 是 | API Key 密钥 |
json
{
"client_id": "your-api-key-id",
"client_secret": "your-api-key-secret"
}示例
bash
curl -X POST https://api.owem.com.br/api/v2/external/auth-token \
-H "Content-Type: application/json" \
-d '{
"client_id": "your-api-key-id",
"client_secret": "your-api-key-secret"
}'响应 200
json
{
"worked": true,
"access_token": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9...",
"token_type": "Bearer",
"expires_in": 3600
}| 字段 | 类型 | 描述 |
|---|---|---|
worked | boolean | 表示操作是否成功 |
access_token | string | 用于请求头的 JWT Token |
token_type | string | 始终为 Bearer |
expires_in | integer | 有效期(秒)(3600 = 60 分钟) |
响应 401
json
{
"worked": false,
"detail": "Credenciais invalidas"
}使用 Token
在所有后续请求的 Authorization 头中包含 Token:
Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9...有效期
Token 在 60 分钟后过期。请在过期前实现自动续期。