Login
Authentication
Login
Authenticate existing users and receive tokens
POST
Login
Endpoint
http://localhost:3000/api/v1
This endpoint is public and does not require authentication.
Request Body
string
required
User’s registered email address (works for both job seekers and companies).
string
required
User’s password. Minimum 6 characters.
Request Shape
Response
Success Response (200 OK)
TypeScript Types
For Job Seeker
For Company
boolean
Indicates if the login was successful.
object
Contains the user/company data and access token.
string
Human-readable success message.
object
Request metadata from global response interceptor.
Important: Refresh Token Cookie
The server sets a cookie with these properties:- Name:
refreshToken - HttpOnly: true (cannot be accessed via JavaScript)
- Secure: true (in production, requires HTTPS)
- SameSite: Strict
- Max-Age: 24 hours (86400 seconds)
What Happens on Login
1
User Lookup
System searches for user in both JobSeeker and Company tables
2
Email Verification Check
Verifies that the user’s email has been verified
3
Password Validation
Compares provided password with hashed password using bcrypt
4
Token Generation
Generates new JWT access and refresh tokens
5
Refresh Token Storage
Stores refresh token in Redis and sets HTTP-only cookie
6
Response
Returns user data with access token
Error Responses
400 Bad Request - Validation Error
Returned when request validation fails.401 Unauthorized - Invalid Credentials
Returned when email or password is incorrect.- Email doesn’t exist
- Password is incorrect
- Typo in email or password
401 Unauthorized - Email Not Verified
Returned when user hasn’t verified their email yet.500 Internal Server Error
Returned when an unexpected error occurs.Validation Rules
Security Notes
Automatic User Type Detection: The API automatically detects whether you’re logging in as a
job seeker or company based on the email. You don’t need to specify the user type.
Response Types
Related Endpoints
- Register Job Seeker - Create new job seeker account
- Register Company - Create new company account
- Verify Email - Verify email after registration
- Refresh Token - Get new access token when expired
