Skip to main content

Login

Authenticate a user with email and password credentials and return JWT tokens.

📝 Endpoint

📋 Request Body

string
required
The user’s email address.
string
required
The user’s password.

📤 Request Example

📥 Response

Success (200 OK)

Error Responses

Invalid Credentials (401 Unauthorized)

Account Locked (401 Unauthorized)

Missing Fields (400 Bad Request)

🔐 Token Information

Access Token

  • Lifetime: 24 hours
  • Usage: Include in Authorization: Bearer <token> header
  • Purpose: Authenticate API requests

Refresh Token

  • Lifetime: 30 days
  • Usage: Obtain new access tokens
  • Purpose: Maintain session without re-authentication

🛡️ Security Features

Rate Limiting

Each IP address can try to log in 5 times a minute. Further attempts get 429 Too Many Requests until the minute passes. See Rate limiting.

Password Security

  • Bcrypt hashing: Passwords are securely hashed
  • Salt: Each password has a unique salt
  • Timing attacks: Constant-time comparison

Session Management

  • Token rotation: Refresh tokens are rotated on use
  • Revocation: Tokens can be revoked if compromised
  • Audit trail: Login attempts are logged

🔄 Using the Tokens

Make API Requests

Refresh Token

🚨 Error Handling

Handle Authentication Errors

📋 Best Practices

1. Secure Token Storage

2. Automatic Token Refresh

3. Handle Logout