Authentication and session
Login
POST User/LoginAuthenticate with { userName, password, fcmToken } (details on the Account page).
userNameis the user's HRMS username. For most employees it is their mobile number (the web login field is labelled mobile number, and forgot-password looks users up by mobile number).- Send
fcmToken(the device's Firebase token) when you have it; the server stores it for push. See Push notifications. - Failures are validation errors (
isSuccess: false,errorCode: 1):UserName or Password is incorrect.Your Account is currently blocked.
Keep from the response: token, id (user id), employeeId, fullName, designationName, profileImageUri, isApprover, isClarify, isPasswordChange.
The token
- A JWT signed by the server, sent as
Authorization: Bearer <token>. - It carries the user id, username, tenant, role, employee id and company ids. The server reads who you are only from it, never from ids in the body (see Server rules).
- Store it in the device keychain, never in plain storage.
Token expiry
- The token is valid for 24 hours (
Expires = UtcNow.AddDays(1)). There is no refresh-token endpoint. - When it expires every call returns HTTP 401 (no JSON envelope).
- Decision D3 for the app: if the user enabled biometric unlock, keep the username and password in the keychain behind biometrics and, on a 401, log in again silently and retry the request once. Without biometrics, send the user to the login screen.
HRMS.Mobilealready does this (features/auth/store/sessionStore.ts). - Re-login a little before 24 hours (the app uses 23 hours) to avoid failing in the middle of a form.
Forced password change
isPasswordChange: false in the login response means the password is still the default (the server sets this when the password equals the username). The app must block everything else and show Set new password (S04), which calls User/ChangePassword with the user id from login.
Forgot password
User/SendResetPasswordOTP?userName=…:userNameis matched against the employee's mobile number. The server emails a one-time code to the employee's email address (not SMS).- The code is 6 uppercase letters (A–Z), not digits. Make the OTP input accept letters and uppercase them.
User/ResetPasswordWithOTPwith{ verificationCode, password }. The code is valid for 1 day.
Biometrics and app lock
Biometric unlock is a device feature; there is no API for it. See D3 above for how it combines with the token.
Switch company
Users who belong to more than one company can switch. User/getUserCompany lists them; User/companyAuthenticateToken?companyId=… returns a new token for the chosen company. Replace the stored token and reload all data.
Logout
There is no logout endpoint. On logout: delete the token and stored credentials from the keychain, and delete the FCM token on the device (messaging().deleteToken()). The server keeps the last FCM token per user, so without this a logged-out phone keeps receiving that user's pushes.
Approver flag
isApprover comes from the employee's designation ("can approve"). Show the Approvals segment only when isApprover is true and the tenant setting isLeadersCanApproveApplication is true (Setting/GetAllSettings). The server checks something slightly different: that the applicant is in the approver's team (leader hierarchy) and the setting is on. A user with isApprover but no team members simply gets an empty inbox.