API Authentication
Authentication endpoints are implemented in Core/api_auth.py.
Main Endpoints
- GET /api/auth/debug/config
- POST /api/auth/signup
- POST /api/auth/login
- POST /api/auth/verify-email
- POST /api/auth/resend-verification
- POST /api/auth/request-password-reset
- POST /api/auth/reset-password
- GET /api/auth/me
- POST /api/auth/logout
Example: Login
Request:
POST /api/auth/login
Content-Type: application/json
{
"email": "operator@example.com",
"password": "your_password"
}
Response:
{
"ok": true,
"data": {
"user": {
"id": "usr_123",
"email": "operator@example.com"
},
"token": "..."
}
}
Example: Current User Profile
GET /api/auth/me
Authorization: Bearer <token>
Common Errors
400invalid payload format401invalid credentials or expired token403account exists but is not verified429too many attempts in a short period
Troubleshooting checklist:
- Verify client and server clocks are synchronized.
- Confirm token is attached to protected endpoints.
- Validate email verification state before login retries.
Usage Flow
- Sign up or log in.
- Verify email if required (
POST /api/auth/verify-emailrequires bothemailand 6-digittoken). - Access profile with /api/auth/me.
- Use logout to terminate active session.
