Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Rampop01/HR-Platform/llms.txt

Use this file to discover all available pages before exploring further.

Overview

HCMatrix uses token-based authentication to secure access to the platform. This guide walks you through the login process, session management, and logout workflows.

Logging In

1

Navigate to Login Page

Access the HCMatrix login page at /auth/login. You’ll see a modern login interface with email and password fields.
2

Enter Credentials

Provide your company email address and password. The system validates both fields are required before submission.
const [email, setEmail] = useState('')
const [password, setPassword] = useState('')
3

Submit Login Request

When you click “Sign In”, the application calls the authentication API:
// From: ~/workspace/source/lib/api.ts:188-193
async login(email: string, password: string): Promise<LoginResponse> {
  return apiCall<LoginResponse>('/api/auth/login', 'POST', {
    email,
    password,
  })
}
4

Session Storage

Upon successful authentication, the system stores your session in browser localStorage:
// From: ~/workspace/source/lib/auth.ts:13-17
saveSession(session: AuthSession): void {
  if (typeof window !== 'undefined') {
    localStorage.setItem(SESSION_KEY, JSON.stringify(session))
  }
}
The session contains:
  • token: Your authentication token for API requests
  • user: Your user profile (id, name, email)
5

Redirect to Dashboard

After successful login, you’re automatically redirected to /dashboard where you can access all HCMatrix features.

Session Management

Checking Authentication Status

The system automatically checks if you’re authenticated before allowing access to protected pages:
// From: ~/workspace/source/lib/auth.ts:33-35
isAuthenticated(): boolean {
  return this.getSession() !== null
}

Retrieving Session Data

Your session is retrieved from localStorage when needed:
// From: ~/workspace/source/lib/auth.ts:19-25
getSession(): AuthSession | null {
  if (typeof window !== 'undefined') {
    const session = localStorage.getItem(SESSION_KEY)
    return session ? JSON.parse(session) : null
  }
  return null
}

Getting Authentication Token

API requests automatically include your authentication token:
// From: ~/workspace/source/lib/auth.ts:37-39
getToken(): string | null {
  return this.getSession()?.token || null
}

Logging Out

To log out of HCMatrix:
1

Call Logout API

The logout function notifies the server and invalidates your token:
// From: ~/workspace/source/lib/api.ts:196-198
async logout(token: string): Promise<void> {
  await apiCall('/api/v1/logout', 'POST', {}, token)
}
2

Clear Local Session

Your session is removed from browser storage:
// From: ~/workspace/source/lib/auth.ts:27-31
clearSession(): void {
  if (typeof window !== 'undefined') {
    localStorage.removeItem(SESSION_KEY)
  }
}
3

Redirect to Login

You’re automatically redirected back to the login page.

Error Handling

The login page displays error messages when authentication fails:
// From: ~/workspace/source/app/auth/login/page.tsx:31-32
catch (err) {
  setError(err instanceof Error ? err.message : 'Login failed')
}
Common error scenarios:
  • Invalid email or password
  • Network connectivity issues
  • Server unavailable
If you see “API error” messages, contact your system administrator. These typically indicate server-side issues that require technical support.

Alternative Login Methods

HCMatrix also supports Google OAuth for streamlined authentication. Contact your administrator to enable this feature for your organization.

Security Best Practices

  • Never share your authentication token with others
  • Always log out when using shared computers
  • Your session is stored in localStorage and persists until you log out
  • Tokens are automatically included in API requests via Bearer authentication

Next Steps

After logging in, explore these guides: