curl -X POST "http://localhost:5001/manager/login" \
-H "Content-Type: application/json" \
-d '{
"username": "admin",
"password": "your_password"
}'
const response = await fetch('http://localhost:5001/manager/login', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
username: 'admin',
password: 'your_password'
})
});
const data = await response.json();
console.log(data);
import requests
data = {
"username": "admin",
"password": "your_password"
}
response = requests.post('http://localhost:5001/manager/login', json=data)
result = response.json()
print(result)
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
data := map[string]string{
"username": "admin",
"password": "your_password",
}
jsonData, _ := json.Marshal(data)
resp, err := http.Post(
"http://localhost:5001/manager/login",
"application/json",
bytes.NewBuffer(jsonData),
)
if err != nil {
panic(err)
}
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Printf("%+v\n", result)
}
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expire": 3600,
"user": {
"username": "admin",
"role": "administrator",
"permissions": ["read", "write", "admin"]
}
}
{
"error": "Invalid username or password"
}
Administrator
Manager Login
Manager user login to obtain access token
POST
/
manager
/
login
curl -X POST "http://localhost:5001/manager/login" \
-H "Content-Type: application/json" \
-d '{
"username": "admin",
"password": "your_password"
}'
const response = await fetch('http://localhost:5001/manager/login', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
username: 'admin',
password: 'your_password'
})
});
const data = await response.json();
console.log(data);
import requests
data = {
"username": "admin",
"password": "your_password"
}
response = requests.post('http://localhost:5001/manager/login', json=data)
result = response.json()
print(result)
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
data := map[string]string{
"username": "admin",
"password": "your_password",
}
jsonData, _ := json.Marshal(data)
resp, err := http.Post(
"http://localhost:5001/manager/login",
"application/json",
bytes.NewBuffer(jsonData),
)
if err != nil {
panic(err)
}
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Printf("%+v\n", result)
}
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expire": 3600,
"user": {
"username": "admin",
"role": "administrator",
"permissions": ["read", "write", "admin"]
}
}
{
"error": "Invalid username or password"
}
Overview
Manager user login interface for obtaining access tokens for the management backend.Request Body
Required Parameters
string
required
Manager username
string
required
Manager password
curl -X POST "http://localhost:5001/manager/login" \
-H "Content-Type: application/json" \
-d '{
"username": "admin",
"password": "your_password"
}'
const response = await fetch('http://localhost:5001/manager/login', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
username: 'admin',
password: 'your_password'
})
});
const data = await response.json();
console.log(data);
import requests
data = {
"username": "admin",
"password": "your_password"
}
response = requests.post('http://localhost:5001/manager/login', json=data)
result = response.json()
print(result)
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
data := map[string]string{
"username": "admin",
"password": "your_password",
}
jsonData, _ := json.Marshal(data)
resp, err := http.Post(
"http://localhost:5001/manager/login",
"application/json",
bytes.NewBuffer(jsonData),
)
if err != nil {
panic(err)
}
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Printf("%+v\n", result)
}
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expire": 3600,
"user": {
"username": "admin",
"role": "administrator",
"permissions": ["read", "write", "admin"]
}
}
{
"error": "Invalid username or password"
}
Response Fields
string
required
Access token for authentication in subsequent API calls
integer
required
Token expiration time (seconds)
object
required
Status Codes
| Status Code | Description |
|---|---|
| 200 | Login successful |
| 401 | Invalid username or password |
| 429 | Too many login attempts |
| 500 | Internal server error |
Best Practices
- Password Security: Use strong password policies, change passwords regularly
- Token Management: Implement automatic token refresh mechanism
- Access Control: Role-based and permission-based access control
- Login Restrictions: Implement login attempt limits
- Session Management: Set reasonable token expiration times
- Secure Storage: Don’t store sensitive information in insecure places

