Authenticate a user with email and password. Returns access token and refresh token for subsequent API calls. Supports all user roles (Student, Lecturer, Admin).
POST
/api/v1/auth/login
curl \
--request POST 'http://localhost:3500/api/v1/auth/login' \
--header "Content-Type: application/json" \
--data '{"email":"student@university.edu","password":"securePassword123"}'
Request examples
Student Login
Example login for a student user
{
"email": "student@university.edu",
"password": "securePassword123"
}
Example login for a lecturer user
{
"email": "lecturer@university.edu",
"password": "lecturerPassword456"
}
Example login for an admin user
{
"email": "admin@university.edu",
"password": "adminPassword789"
}
Response examples (201)
{
"message": "Login successful",
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
Response examples (400)
{
"error": "Bad Request",
"message": [
"email must be an email",
"password should not be empty"
],
"statusCode": 400
}
Response examples (401)
{
"error": "Unauthorized",
"message": "Invalid credentials",
"statusCode": 401
}
Response examples (500)
{
"error": "Internal Server Error",
"message": "Internal server error",
"statusCode": 500
}