Skip to content

Login & Registration

EaseLab supports self-service lab registration, email verification, password recovery, and secure session management for both the tenant portal and platform admin portal.

Registration flow

New labs register through POST /auth/register:

FieldRequiredNotes
labNameYesDisplay name; used to generate a URL slug
emailYesBecomes the tenant owner account
passwordYesMust meet password policy
firstName, lastNameNoOwner profile
phoneNoContact number

After registration:

  1. If email verification is required, the API returns requiresEmailVerification: true.
  2. The user verifies via OTP (POST /auth/verify-email-otp) or email link (POST /auth/confirm-email).
  3. On success, access and refresh tokens are issued.

Registration email domains can be restricted by the platform — see Registration Policy.

Login flow

POST /auth/login accepts email and password.

Response flagMeaningNext step
requiresEmailVerificationEmail not confirmedComplete verification
requiresTwoFactor2FA enabledPOST /auth/verify-2fa
Normal AuthResponseSuccessUse access token; refresh cookie set automatically

Blocked sign-in scenarios

ConditionMessage
Invalid credentialsInvalid email or password.
Unverified emailVerify your email before signing in.
Suspended/inactive tenantTenant lock reason or default inactive message
Rate limit exceededHTTP 429

Session tokens

TokenStorageLifetime
Access token (JWT)Client memory / Authorization header15 minutes
Refresh tokenHTTP-only cookie refresh_token7 days

Refresh with POST /auth/refresh (cookie sent automatically). Logout with POST /auth/logout, which revokes the refresh token server-side.

See API Authentication for JWT claims and endpoint details.

Password recovery

EndpointPurpose
POST /auth/forgot-passwordSends reset link if email exists (always returns success to prevent enumeration)
POST /auth/reset-passwordSets new password with token from email

Both endpoints are rate-limited.

Lab slug preview

Before registering, the UI can call GET /auth/lab-slug-preview?labName=... to show the proposed portal URL (e.g. my-labhttps://portal.example.com/my-lab).

Mobile authentication

Mobile apps use POST /auth/mobile/login and related endpoints. Refresh tokens are returned in the response body instead of cookies.

Portal URLs

PortalTypical URLAuth route prefix
Tenant (lab)https://app.example.com/auth
Platform adminhttps://admin.example.com/auth

Best practices

  • Enforce two-factor authentication for tenant owners and admins.
  • Use strong, unique passwords for each staff account.
  • Revoke access promptly when staff leave — see Manage Roles.
  • Never share impersonation links; they expire in 2 minutes.

Ease Lab — Cloud Pathology Lab Management