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

  • 400 invalid payload format
  • 401 invalid credentials or expired token
  • 403 account exists but is not verified
  • 429 too many attempts in a short period

Troubleshooting checklist:

  1. Verify client and server clocks are synchronized.
  2. Confirm token is attached to protected endpoints.
  3. Validate email verification state before login retries.

Usage Flow

  1. Sign up or log in.
  2. Verify email if required (POST /api/auth/verify-email requires both email and 6-digit token).
  3. Access profile with /api/auth/me.
  4. Use logout to terminate active session.

Related Pages