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: 7 days
  • Usage: Obtain new access tokens
  • Purpose: Maintain session without re-authentication

🛡️ Security Features

Rate Limiting

  • Login attempts: 5 per minute per IP
  • Account lockout: Temporary lock after 10 failed attempts
  • Lockout duration: 15 minutes

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