Login endpoint
Authenticate an employee to access the POS system.Request
Parameters
employeeId(string, required): The unique employee identifierpin(string, required): The employee’s 4-digit PINselectedRole(string, optional): The role selected during login (must match employee’s assigned role)
Success response
Error responses
Employee not found
Invalid PIN
Role mismatch
Validation errors
All failed login attempts are logged for security auditing and tracked in business metrics.
Manager validation endpoint
Validate a manager’s PIN for sensitive operations that require manager approval.Request
Parameters
pin(string, required): The manager’s PIN to validate
Success response
Failure response
This endpoint checks the PIN against all active employees with the “Manager” role or
isManager flag set to true.PIN security
The authentication system includes advanced PIN security features:Hashed PINs
All PINs are stored using secure hashing via the PIN Security Service. The system uses industry-standard hashing algorithms to protect employee credentials.Automatic migration
The system supports backward compatibility with legacy plaintext PINs:- When an employee logs in with a legacy plaintext PIN, the system validates it
- If validation succeeds, the PIN is automatically upgraded to a hashed version in the background
- Subsequent logins use the secure hashed PIN verification
PIN migration happens asynchronously and doesn’t impact login performance.
Activity logging
All authentication events are tracked:- Successful logins: Logged with employee details, role, and IP address
- Failed attempts: Logged with reason (employee not found, invalid PIN, role mismatch)
- Security metrics: All login attempts are tracked in the metrics service for business intelligence
Role-based access
The system supports two primary roles:- Manager: Full access to all POS features including sensitive operations
- Cashier: Standard access for sales transactions
Role validation
When aselectedRole is provided during login:
- The system retrieves the employee’s assigned role from the database
- The selected role is compared against the employee’s role (case-insensitive)
- If roles don’t match, login is rejected with a role mismatch error
- The error message indicates the correct role to use
For backward compatibility, if an employee doesn’t have a role assigned, the system defaults to “Manager” if
isManager is true, otherwise “Cashier”.Session management
The current implementation does not use session tokens or JWT. Authentication state is managed client-side by the Electron application after successful login.
- Session token generation
- Token-based authentication for subsequent requests
- Session expiration and refresh mechanisms