login
需求描述
登入的 API
登入成功後回傳 Access Token,效期 30 分鐘
Method
POST
Endpoint
/api/auth/token
Request Body
{
"username": "string",
"password": "string",
}
Response
登入成功
- HTTP Status Code: 200
{
"access_token": "string",
"token_type": "bearer",
}
輸入密碼為空字串
- HTTP Status Code: 422
{
"detail": [
{
"ctx": {
"limit_value": 1
},
"loc": ["body", "password"],
"msg": "ensure this value has at least 1 characters",
"type": "value_error.any_str.min_length"
}
]
}
{
"detail": [
{
"ctx": {
"limit_value": 1
},
"loc": ["body", "password"],
"msg": "ensure this value has at least 1 characters",
"type": "value_error.any_str.min_length"
}
]
}
密碼錯誤
- HTTP Status Code: 400
{
"detail": "Invalid email or password."
}