Skip to main content
POST
/
admin
/
login
curl -X POST http://localhost:8080/admin/login \
  -H "Content-Type: application/json" \
  -d '{
    "email": "admin@medagenda.com",
    "password": "SecurePassword123!"
  }'
Login successful!
Authenticates an administrator using email and password credentials.

Request Body

email
string
required
Administrator’s email addressExample: "admin@medagenda.com"
password
string
required
Administrator’s password

Response

Returns a plain text message indicating the login status.
Success
string
"Login successful!" - Returned when authentication succeeds (HTTP 200)
Error
string
"Invalid email or password." - Returned when authentication fails (HTTP 401)
curl -X POST http://localhost:8080/admin/login \
  -H "Content-Type: application/json" \
  -d '{
    "email": "admin@medagenda.com",
    "password": "SecurePassword123!"
  }'
Login successful!

Error Responses

401 Unauthorized
string
Returned when the email doesn’t exist or the password is incorrectResponse body: "Invalid email or password."

Security Considerations

Security Recommendations:
  • Session Management: This endpoint currently only returns a success message. In production, implement proper session management or JWT token generation
  • Rate Limiting: Implement rate limiting to prevent brute force attacks (e.g., max 5 attempts per minute)
  • Password Hashing: Ensure passwords are compared using secure hashing algorithms (bcrypt, argon2, etc.)
  • Account Lockout: Consider implementing account lockout after multiple failed attempts
  • HTTPS Only: Always use HTTPS in production to encrypt credentials in transit
  • Audit Logging: Log all login attempts (successful and failed) for security monitoring
  • Two-Factor Authentication: Consider implementing 2FA for additional security

Implementation Notes

Current Limitations:
  • The endpoint returns a simple text message instead of a session token or JWT
  • No session state is maintained after successful login
  • Consider enhancing this endpoint to return an authentication token that can be used for subsequent API requests

Next Steps

After successful login, you may want to:
  1. Store the session/token securely (if implemented)
  2. Use the token in subsequent requests via Authorization header
  3. Implement token refresh mechanisms for long-lived sessions

Build docs developers (and LLMs) love