Login
Authentication
Login
Authenticate a user with email and password
POST
Login
Documentation Index
Fetch the complete documentation index at: https://mintlify.com/GoodnessFx/GatePass/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Authenticate a user with their email and password. This endpoint validates credentials, generates new JWT tokens, and returns user information.Request Body
User’s email address. Must be a valid email format.
User’s password.
Response
Success message confirming login.
JWT access token valid for 15 minutes. Include this token in the
Authorization header as Bearer {token} for authenticated requests.Authenticated user information.
Authentication Tokens
Access Token
- Type: JWT (JSON Web Token)
- Expiration: 15 minutes
- Payload: Contains
userId,email, androle - Usage: Include in
Authorization: Bearer {token}header
Refresh Token
- Type: JWT (JSON Web Token)
- Expiration: 7 days
- Storage: HttpOnly cookie named
refreshToken - Usage: Automatically sent with requests to refresh access token
Example Request
cURL
Example Response
Error Responses
Invalid email format or missing password.
Invalid credentials (email or password is incorrect).
Token Refresh
When the access token expires (after 15 minutes), use the refresh token to obtain a new access token:cURL
Using the Access Token
Include the access token in theAuthorization header for all authenticated requests:
cURL
Security Features
- Password Hashing: Passwords are hashed using bcrypt with 12 rounds
- Email Normalization: Email addresses are normalized before comparison
- HttpOnly Cookies: Refresh tokens stored in HttpOnly cookies prevent XSS attacks
- Secure Cookies: In production, cookies are only sent over HTTPS
- SameSite Protection: Cookies use
SameSite: strictto prevent CSRF attacks
Session Management
The refresh token is stored in the database and can be invalidated by:- Calling the
/api/auth/logoutendpoint - Token expiration (7 days)
- Manual token revocation